Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge 85225ab into 0ade250
Browse files Browse the repository at this point in the history
  • Loading branch information
pyokagan committed Dec 14, 2017
2 parents 0ade250 + 85225ab commit 0836b90
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 30 deletions.
36 changes: 36 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,36 @@
# CircleCI configuration file
# For more details see https://circleci.com/docs/2.0/

version: 2
jobs:
build:
docker:
- image: openjdk:8-jdk
working_directory: ~/project
steps:
- checkout
- run:
name: Setup environment variables
command: echo 'export TERM=dumb' >>"$BASH_ENV"
- restore_cache:
keys:
# Increment the version number e.g. v2-gradle-cache-...
# to force the caches to be "invalidated".
- v1-gradle-cache-{{ checksum "build.gradle" }}
- v1-gradle-cache-
- run:
name: Build documentation
command: ./gradlew clean asciidoctor
- store_artifacts:
path: ~/project/build/docs/html5
destination: docs
- run:
name: Cleanup for save_cache
command: >-
rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- save_cache:
key: v1-gradle-cache-{{ checksum "build.gradle" }}
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -11,7 +11,7 @@ plugins {
id 'checkstyle'
id "com.github.kt3k.coveralls" version "2.4.0"
id "com.github.johnrengelman.shadow" version '1.2.3'
id 'org.asciidoctor.convert' version '1.5.3'
id 'org.asciidoctor.convert' version '1.5.6'
id 'application'
}

Expand Down
69 changes: 41 additions & 28 deletions docs/DeveloperGuide.adoc
Expand Up @@ -5,6 +5,7 @@
:sectnums:
:imagesDir: images
:stylesDir: stylesheets
:xrefstyle: full
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
Expand Down Expand Up @@ -48,7 +49,7 @@ This will generate all resources required by the application and tests.
=== Verifying the setup

. Run the `seedu.address.MainApp` and try a few commands
. link:#testing[Run the tests] to ensure they all pass.
. <<Testing,Run the tests>> to ensure they all pass.

=== Configurations to do before writing code

Expand Down Expand Up @@ -82,15 +83,16 @@ Having both Travis and AppVeyor ensures your App works on both Unix-based platfo

When you are ready to start coding,

1. Get some sense of the overall design by reading the link:#architecture[Architecture] section.
2. Take a look at the section link:#suggested-programming-tasks-to-get-started[Suggested Programming Tasks to Get Started].
1. Get some sense of the overall design by reading <<Design-Architecture>>.
2. Take a look at <<GetStartedProgramming>>.

== Design

[[Design-Architecture]]
=== Architecture

.Architecture Diagram
image::Architecture.png[width="600"]
_Figure 2.1.1 : Architecture Diagram_

The *_Architecture Diagram_* given above explains the high-level design of the App. Given below is a quick overview of each component.

Expand All @@ -102,17 +104,17 @@ The `.pptx` files used to create diagrams in this document can be found in the l
* At app launch: Initializes the components in the correct sequence, and connects them up with each other.
* At shut down: Shuts down the components and invokes cleanup method where necessary.

link:#common-classes[*`Commons`*] represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.
<<Design-Commons,*`Commons`*>> represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.

* `EventsCenter` : This class (written using https://github.com/google/guava/wiki/EventBusExplained[Google's Event Bus library]) is used by components to communicate with other components using events (i.e. a form of _Event Driven_ design)
* `LogsCenter` : Used by many classes to write log messages to the App's log file.

The rest of the App consists of four components.

* link:#ui-component[*`UI`*] : The UI of the App.
* link:#logic-component[*`Logic`*] : The command executor.
* link:#model-component[*`Model`*] : Holds the data of the App in-memory.
* link:#storage-component[*`Storage`*] : Reads data from, and writes data to, the hard disk.
* <<Design-Ui,*`UI`*>>: The UI of the App.
* <<Design-Logic,*`Logic`*>>: The command executor.
* <<Design-Model,*`Model`*>>: Holds the data of the App in-memory.
* <<Design-Storage,*`Storage`*>>: Reads data from, and writes data to, the hard disk.

Each of the four components

Expand All @@ -121,34 +123,35 @@ Each of the four components

For example, the `Logic` component (see the class diagram given below) defines it's API in the `Logic.java` interface and exposes its functionality using the `LogicManager.java` class.

.Class Diagram of the Logic Component
image::LogicClassDiagram.png[width="800"]
_Figure 2.1.2 : Class Diagram of the Logic Component_

[discrete]
==== Events-Driven nature of the design

The _Sequence Diagram_ below shows how the components interact for the scenario where the user issues the command `delete 1`.

.Component interactions for `delete 1` command (part 1)
image::SDforDeletePerson.png[width="800"]
_Figure 2.1.3a : Component interactions for `delete 1` command (part 1)_

[NOTE]
Note how the `Model` simply raises a `AddressBookChangedEvent` when the Address Book data are changed, instead of asking the `Storage` to save the updates to the hard disk.

The diagram below shows how the `EventsCenter` reacts to that event, which eventually results in the updates being saved to the hard disk and the status bar of the UI being updated to reflect the 'Last Updated' time.

.Component interactions for `delete 1` command (part 2)
image::SDforDeletePersonEventHandling.png[width="800"]
_Figure 2.1.3b : Component interactions for `delete 1` command (part 2)_

[NOTE]
Note how the event is propagated through the `EventsCenter` to the `Storage` and `UI` without `Model` having to be coupled to either of them. This is an example of how this Event Driven approach helps us reduce direct coupling between components.

The sections below give more details of each component.

[[Design-Ui]]
=== UI component

.Structure of the UI Component
image::UiClassDiagram.png[width="800"]
_Figure 2.2.1 : Structure of the UI Component_

*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`]

Expand All @@ -162,13 +165,15 @@ The `UI` component,
* Binds itself to some data in the `Model` so that the UI can auto-update when data in the `Model` change.
* Responds to events raised from various parts of the App and updates the UI accordingly.

[[Design-Logic]]
=== Logic component

[[fig-LogicClassDiagram]]
.Structure of the Logic Component
image::LogicClassDiagram.png[width="800"]
_Figure 2.3.1 : Structure of the Logic Component_

.Structure of Commands in the Logic Component. This diagram shows finer details concerning `XYZCommand` and `Command` in <<fig-LogicClassDiagram>>
image::LogicCommandClassDiagram.png[width="800"]
_Figure 2.3.2 : Structure of Commands in the Logic Component. This diagram shows finer details concerning `XYZCommand` and `Command` in Figure 2.3.1_

*API* :
link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]
Expand All @@ -180,13 +185,14 @@ link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]

Given below is the Sequence Diagram for interactions within the `Logic` component for the `execute("delete 1")` API call.

.Interactions Inside the Logic Component for the `delete 1` Command
image::DeletePersonSdForLogic.png[width="800"]
_Figure 2.3.1 : Interactions Inside the Logic Component for the `delete 1` Command_

[[Design-Model]]
=== Model component

.Structure of the Model Component
image::ModelClassDiagram.png[width="800"]
_Figure 2.4.1 : Structure of the Model Component_

*API* : link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model.java`]

Expand All @@ -197,10 +203,11 @@ The `Model`,
* exposes an unmodifiable `ObservableList<ReadOnlyPerson>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* does not depend on any of the other three components.

[[Design-Storage]]
=== Storage component

.Structure of the Storage Component
image::StorageClassDiagram.png[width="800"]
_Figure 2.5.1 : Structure of the Storage Component_

*API* : link:{repoURL}/src/main/java/seedu/address/storage/Storage.java[`Storage.java`]

Expand All @@ -209,6 +216,7 @@ The `Storage` component,
* can save `UserPref` objects in json format and read it back.
* can save the Address Book data in xml format and read it back.

[[Design-Commons]]
=== Common classes

Classes used by multiple components are in the `seedu.addressbook.commons` package.
Expand Down Expand Up @@ -348,7 +356,7 @@ image::UndoRedoActivityDiagram.png[width="200"]

We are using `java.util.logging` package for logging. The `LogsCenter` class is used to manage the logging levels and logging destinations.

* The logging level can be controlled using the `logLevel` setting in the configuration file (See link:#configuration[Configuration])
* The logging level can be controlled using the `logLevel` setting in the configuration file (See <<Implementation-Configuration>>)
* The `Logger` for a class can be obtained using `LogsCenter.getLogger(Class)` which will log messages according to the specified logging level
* Currently log messages are output through: `Console` and to a `.log` file.

Expand All @@ -359,6 +367,7 @@ We are using `java.util.logging` package for logging. The `LogsCenter` class is
* `INFO` : Information showing the noteworthy actions by the App
* `FINE` : Details that is not usually noteworthy but may be useful in debugging e.g. print the actual list instead of just its size

[[Implementation-Configuration]]
=== Configuration

Certain properties of the application can be controlled (e.g App name, logging level) through the configuration file (default: `config.json`).
Expand Down Expand Up @@ -390,9 +399,10 @@ Here are the steps to convert the project documentation files to PDF format.
. Within Chrome, click on the `Print` option in Chrome's menu.
. Set the destination to `Save as PDF`, then click `Save` to save a copy of the file in PDF format. For best results, use the settings indicated in the screenshot below.

.Saving documentation as PDF files in Chrome
image::chrome_save_as_pdf.png[width="300"]
_Figure 5.6.1 : Saving documentation as PDF files in Chrome_

[[Testing]]
== Testing

=== Running Tests
Expand Down Expand Up @@ -467,15 +477,17 @@ A project often depends on third-party libraries. For example, Address Book depe
a. Include those libraries in the repo (this bloats the repo size) +
b. Require developers to download those libraries manually (this creates extra work for developers)

[[GetStartedProgramming]]
[appendix]
== Suggested Programming Tasks to Get Started

Suggested path for new programmers:

1. First, add small local-impact (i.e. the impact of the change does not go beyond the component) enhancements to one component at a time. Some suggestions are given in this section link:#improving-each-component[Improving a Component].
1. First, add small local-impact (i.e. the impact of the change does not go beyond the component) enhancements to one component at a time. Some suggestions are given in <<GetStartedProgramming-EachComponent>>.

2. Next, add a feature that touches multiple components to learn how to implement an end-to-end feature across all components. The section link:#creating-a-new-command-code-remark-code[Creating a new command: `remark`] explains how to go about adding such a feature.
2. Next, add a feature that touches multiple components to learn how to implement an end-to-end feature across all components. <<GetStartedProgramming-RemarkCommand>> explains how to go about adding such a feature.

[[GetStartedProgramming-EachComponent]]
=== Improving each component

Each individual exercise in this section is component-based (i.e. you would not need to modify the other components to get it to work).
Expand All @@ -484,7 +496,7 @@ Each individual exercise in this section is component-based (i.e. you would not
==== `Logic` component

[TIP]
Do take a look at the link:#logic-component[Design: Logic Component] section before attempting to modify the `Logic` component.
Do take a look at <<Design-Logic>> before attempting to modify the `Logic` component.

. Add a shorthand equivalent alias for each of the individual commands. For example, besides typing `clear`, the user can also type `c` to remove all persons in the list.
+
Expand All @@ -501,7 +513,7 @@ Do take a look at the link:#logic-component[Design: Logic Component] section bef
==== `Model` component

[TIP]
Do take a look at the link:#model-component[Design: Model Component] section before attempting to modify the `Model` component.
Do take a look at <<Design-Model>> before attempting to modify the `Model` component.

. Add a `removeTag(Tag)` method. The specified tag will be removed from everyone in the address book.
+
Expand All @@ -518,7 +530,7 @@ Do take a look at the link:#model-component[Design: Model Component] section bef
==== `Ui` component

[TIP]
Do take a look at the link:#ui-component[Design: UI Component] section before attempting to modify the `UI` component.
Do take a look at <<Design-Ui>> before attempting to modify the `UI` component.

. Use different colors for different tags inside person cards. For example, `friends` tags can be all in grey, and `colleagues` tags can be all in red.
+
Expand Down Expand Up @@ -582,7 +594,7 @@ image::getting-started-ui-status-after.png[width="500"]
==== `Storage` component

[TIP]
Do take a look at the link:#storage-component[Design: Storage Component] section before attempting to modify the `Storage` component.
Do take a look at <<Design-Storage>> before attempting to modify the `Storage` component.

. Add a new method `backupAddressBook(ReadOnlyAddressBook)`, so that the address book can be saved in a fixed temporary location.
+
Expand All @@ -594,6 +606,7 @@ Do take a look at the link:#storage-component[Design: Storage Component] section
** See this https://github.com/se-edu/addressbook-level4/pull/594/files[PR] for the full solution.
****

[[GetStartedProgramming-RemarkCommand]]
=== Creating a new command: `remark`

By creating this command, you will get a chance to learn how to implement a feature end-to-end, touching all major components of the app.
Expand Down Expand Up @@ -728,7 +741,7 @@ Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (un

|`* * *` |user |find a person by name |locate details of persons without having to go through the entire list

|`* *` |user |hide link:#private-contact-detail[private contact details] by default |minimize chance of someone else seeing them by accident
|`* *` |user |hide <<private-contact-detail,private contact details>> by default |minimize chance of someone else seeing them by accident

|`*` |user with many persons in the address book |sort persons by name |locate a person easily
|=======================================================================
Expand Down Expand Up @@ -771,7 +784,7 @@ Use case resumes at step 2.
[appendix]
== Non Functional Requirements

. Should work on any link:#mainstream-os[mainstream OS] as long as it has Java `1.8.0_60` or higher installed.
. Should work on any <<mainstream-os,mainstream OS>> as long as it has Java `1.8.0_60` or higher installed.
. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.

Expand Down
4 changes: 3 additions & 1 deletion docs/UserGuide.adoc
Expand Up @@ -5,6 +5,7 @@
:sectnums:
:imagesDir: images
:stylesDir: stylesheets
:xrefstyle: full
:experimental:
ifdef::env-github[]
:tip-caption: :bulb:
Expand Down Expand Up @@ -37,8 +38,9 @@ e.g. typing *`help`* and pressing kbd:[Enter] will open the help window.
* **`delete`**`3` : deletes the 3rd contact shown in the current list
* *`exit`* : exits the app

. Refer to the link:#features[Features] section below for details of each command.
. Refer to <<Features>> for details of each command.

[[Features]]
== Features

====
Expand Down

0 comments on commit 0836b90

Please sign in to comment.