Skip to content

Commit

Permalink
Merge pull request #75 from Lin-Shuang-Shuang/branch-UpdateDG
Browse files Browse the repository at this point in the history
Update DG with implementation of add project
  • Loading branch information
Lin-Shuang-Shuang authored Mar 28, 2024
2 parents c65455e + c5852a1 commit 3ff68ea
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ shadowJar {
archiveFileName = 'tp_new.jar'
}

run {
enableAssertions = true
}

defaultTasks 'clean', 'test'
36 changes: 36 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,42 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa

This section describes some noteworthy details on how certain features are implemented.

### Adding a project
#### Implementation
1. The AddressBookParser parses the command string given by the user, and looks for the command word "add project". Then AddProjectCommandParser parse function is called.
2. If the PROJECT_NAME is an empty string, an exception is thrown, else the addProjectCommand execution function is called.
3. The `AddProjectCommand` class is responsible for adding a project to the project list.
- The constructor of the class takes in a project of type Project.
- If the same project already exists within the project list, then an exception is thrown to alert users that the project already exists.
- Else the project is successfully added.

![Interactions Inside the Logic Component for the `add project Duke` Command](images/AddProjectSequenceDiagram.png)

#### Design considerations:

**Aspect of including team members**

- **Alternative 1 (current choice):** Split add project and add team into 2 different commands.
- Pros: Ensure that command stays short and rather intuitive for users to use, as well as allows users the flexibility to add team members to the project whenever.
- Cons: Users have to remember more command words, and type more commands.

- **Alternative 2:** Use prefix to indicate the team members that will be added to the project.
- Example: `add project PROJECT_NAME /t Rachel, Daniel, John`.
- Pros: Users have 1 less command to remember.
- Cons: The command syntax is inconsistent with all the other commands as none of them uses prefixes.

**Aspect of command word**

- **Alternative 1:** Command word is `add` and the same command word is used for add tasks, add team, add deadline etc.
- The different commands are differentiated by the prefix (eg: '/t' for add team, '/p' for add project).
- Pros: Users have fewer commands to remember, and fewer words to type.
- Cons: Users have to remember the prefixes for each command and can be confusing.

- **Alternative 2 (current choice):** Command word is `add project` (2 words).
- There will be different command words for add tasks `add task`, add team `add team` etc.
- Pros: This is more intuitive for users to use as there will be no need for prefixes.
- Cons: More words to type for users.

### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down
70 changes: 70 additions & 0 deletions docs/diagrams/AddProjectSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":AddProjectCommandParser" as AddProjectCommandParser LOGIC_COLOR
participant "d:AddProjectCommand" as AddProjectCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant "m:Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("add project Duke")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("add project Duke")
activate AddressBookParser

create AddProjectCommandParser
AddressBookParser -> AddProjectCommandParser
activate AddProjectCommandParser

AddProjectCommandParser --> AddressBookParser
deactivate AddProjectCommandParser

AddressBookParser -> AddProjectCommandParser : parse("Duke")
activate AddProjectCommandParser

create AddProjectCommand
AddProjectCommandParser -> AddProjectCommand
activate AddProjectCommand

AddProjectCommand --> AddProjectCommandParser :
deactivate AddProjectCommand

AddProjectCommandParser --> AddressBookParser : d
deactivate AddProjectCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
AddProjectCommandParser -[hidden]-> AddressBookParser
destroy AddProjectCommandParser

AddressBookParser --> LogicManager : d
deactivate AddressBookParser

LogicManager -> AddProjectCommand : execute(m)
activate AddProjectCommand

AddProjectCommand -> Model : addProject(Duke)
activate Model

Model --> AddProjectCommand
deactivate Model

create CommandResult
AddProjectCommand -> CommandResult
activate CommandResult

CommandResult --> AddProjectCommand
deactivate CommandResult

AddProjectCommand --> LogicManager : r
deactivate AddProjectCommand

[<--LogicManager
deactivate LogicManager
@enduml
File renamed without changes.
Binary file added docs/images/AddProjectSequenceDiagram.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 3ff68ea

Please sign in to comment.