Skip to content

Commit

Permalink
Merge pull request #95 from le0tan/dg-design-model
Browse files Browse the repository at this point in the history
Update DG on Design-Model
  • Loading branch information
le0tan authored Oct 22, 2019
2 parents 487efe7 + 9a06def commit 6d453b7
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 43 deletions.
14 changes: 6 additions & 8 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,22 @@ image::DeleteSequenceDiagram.png[]

NOTE: The lifeline for `DeleteCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.

//@@author le0tan
[[Design-Model]]
=== Model component

.Structure of the Model Component
image::ModelClassDiagram.png[]

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

The `Model`,

* stores a `UserPref` object that represents the user's preferences.
* stores the Address Book data.
* exposes an unmodifiable `ObservableList<Person>` 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.
* stores the AlgoBase data.
* exposes unmodifiable `ObservableList<Problem>`, `ObservableList<Tag>`, `ObservableList<Plan>`, `ObservableList<Task>` 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.

[NOTE]
As a more OOP model, we can store a `Tag` list in `Address Book`, which `Person` can reference. This would allow `Address Book` to only require one `Tag` object per unique `Tag`, instead of each `Person` needing their own `Tag` object. An example of how such a model may look like is given below. +
+
image:BetterModelClassDiagram.png[]

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

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

//@@author le0tan

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

Expand Down
141 changes: 106 additions & 35 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -1,56 +1,127 @@
@startuml
!include style.puml
left to right direction
skinparam arrowThickness 1.1
skinparam arrowColor MODEL_COLOR
skinparam classBackgroundColor MODEL_COLOR

Package Model <<Rectangle>>{
Interface ReadOnlyAddressBook <<Interface>>
Interface Model <<Interface>>
Interface ObservableList <<Interface>>
Class AddressBook
Class ReadOnlyAddressBook
Class Model
Class ModelManager
Class UserPrefs
Class ReadOnlyUserPrefs

Package Person {
Class Person
Class Address
Class Email
Class Name
Class Phone
Class UniquePersonList
}
show <<enumeration>> fields

Package Model <<Rectangle>> {

Interface ReadOnlyAlgoBase <<Interface>>
Interface ReadOnlyUserPrefs <<Interface>>
Interface Model <<Interface>>
Interface ObservableList <<Interface>>
Class LocalDateTime
Class Index
Class IntegerProperty
Class AlgoBase
Class ModelManager
Class UserPrefs
Class Boolean
enum ModelType <<enumeration>> {
PROBLEM,
TAG,
PLAN,
TASK
}

Package Gui {
Class GuiState
Class TabData
Class TabManager
enum TabType <<enumeration>> {
DISPLAY,
DETAILS
}
}

Package Plan {
Class NameContainsKeywordsPredicate
Class Plan
Class PlanDescription
Class PlanList
Class PlanName
}

Package Problem {
Class Author
Class Description
Class Difficulty
Class Name
Class Problem
Class Remark
Class Source
Class UniqueProblemList
Class WebLink
}

Package Tag {
Class Tag
Class UniqueTagList
}

Package Task {
Class Task
}

Package Tag {
Class Tag
}
}

Class HiddenOutside #FFFFFF
HiddenOutside ..> Model

AddressBook .up.|> ReadOnlyAddressBook
AlgoBase .up.|> ReadOnlyAlgoBase

'Model & UserPrefs
ModelManager .up.|> Model
Model .right.> ObservableList
ModelManager o--> "1" AddressBook
ModelManager o--> "1" AlgoBase
ModelManager o-left-> "1" UserPrefs
ModelManager -->"1" Problem : filtered and sorted list
ModelManager -->"1" Tag: filtered list
ModelManager -->"1" Plan: filtered list
ModelManager -->"1" Task: filtered list
UserPrefs .up.|> ReadOnlyUserPrefs

AddressBook *--> "1" UniquePersonList
UniquePersonList o--> "*" Person
Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "*" Tag
'AlgoBase
AlgoBase *--> "1" UniqueProblemList
AlgoBase *--> "1" UniqueTagList
AlgoBase *--> "1" PlanList

'Problem
UniqueProblemList o--> "*" Problem
Problem *--> Author
Problem *--> Description
Problem *--> Difficulty
Problem *--> Name
Problem *--> Remark
Problem *--> Source
Problem *--> WebLink
Problem *--> "*" Tag

'Tag
UniqueTagList o--> "*" Tag

'Plan
Plan *--> "1" PlanName
Plan *--> "1" PlanDescription
Plan *--> "1" LocalDateTime : startDate
Plan *--> "1" LocalDateTime : endDate
PlanList o--> "*" Task

'Task
Task *--> "1" Problem
Task *--> "1" Boolean : isSolved
Task *--> "1" LocalDateTime : datetime

'Gui
GuiState *--> "1" TabManager
TabData *--> "1" ModelType
TabData *--> "1" Index : modelIndex
TabManager *--> "1" IntegerProperty : displayTabPaneIndex
TabManager *--> "1" IntegerProperty : detailsTabPaneIndex
TabManager *--> "*" TabData : tabs

Name -[hidden]right-> Phone
Phone -[hidden]right-> Address
Address -[hidden]right-> Email

ModelManager -->"1" Person : filtered list
@enduml
Binary file modified docs/images/ModelClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d453b7

Please sign in to comment.