Skip to content

Commit

Permalink
Merge pull request #121 from Tim-Siu/branch-dg-shuyao
Browse files Browse the repository at this point in the history
Update the DG to include enhancement of the `find` command
  • Loading branch information
Tim-Siu authored Oct 27, 2023
2 parents 37f2b16 + fe37f34 commit 5662644
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 4 deletions.
34 changes: 34 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,40 @@ builds a string representation of an object.

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

### \[V1.3\] Improved find feature for person and company

#### Implementation

The `FindPersonCommand` is implemented as follows:

* The `LogicManager`'s execute method is called with the command string.
* The `LogicManager` calls the `parseCommand()` method of the `AddressBookParser` class.
* The `AddressBookParser` creates a `FindCommandParser` which parses the user input and returns a `FindPersonCommand` object.
* The `FindPersonParser` is implemented as follows:
* It uses the `ArgumentMultimap` class to parse the user input into a `Map` of keywords and tags.
* It uses the `NameAndTagContainKeywordsPredicate` class to create a `Predicate` object that can be used to filter the list of persons.
* It returns a `FindPersonCommand` object containing the `Predicate` object.
* The `FindPersonCommand` object is executed by the `LogicManager`.
* The `LogicManager` uses the `Model` to filter the list of persons using the `Predicate` object.
* The `LogicManager` returns a `CommandResult` object containing the filtered list of persons.
* The `LogicManager` passes the `CommandResult` object to the `Ui` which displays the filtered list of persons.

The `FindCompanyCommand` is implemented similarly.

#### Sequence diagram
<img src="images/FindPersonSequenceDiagram.png" width="1200" />

#### Design considerations
* The implementation tries to follow the pattern of the existing commands as much as possible.
* The differentiation between the `FindPersonCommand` and `FindCompanyCommand` is done in the `FindCommandParser` class instead of `AddressBookParser` class as we want to keep the `AddressBookParser` class simple.
* The `FindPersonCommand` and `FindCompanyCommand` are implemented as separate classes instead of a single `FindCommand` class because the `FindPersonCommand` and `FindCompanyCommand` have different `Predicate` objects.

#### Alternatives considered
* An alternative is to implement the `FindPersonCommand` and `FindCompanyCommand` as a single `FindCommand` class. Such implementation will allow for better code reuse. However, such implementation may affect the readability of the code as the `FindCommand` class will have to handle both `Person` and `Company` objects.
* An alternative is to differentiate between the `FindPersonCommand` and `FindCompanyCommand` in the `AddressBookParser` class. However, such implementation will make the `AddressBookParser` class more complex. The `AddressBookParser` is already responsible for parsing many different commands. The alternative design will make the parsing logic more complex and harder to maintain.



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

#### Proposed Implementation
Expand Down
87 changes: 87 additions & 0 deletions docs/diagrams/FindPersonSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@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 ":FindCommandParser" as FindCommandParser LOGIC_COLOR
participant "f:FindPersonCommand" as FindPersonCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

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

box Utility UTIL_COLOR
participant ":ArgumentMultimap" as ArgumentMultimap UTIL_COLOR
participant ":NameAndTagContainKeywordsPredicate" as Predicate UTIL_COLOR
end box

[-> LogicManager : execute("find p n/bob t/friend")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("find p n/bob t/friend")
activate AddressBookParser

create FindCommandParser
AddressBookParser -> FindCommandParser
activate FindCommandParser

FindCommandParser --> AddressBookParser
deactivate FindCommandParser

AddressBookParser -> FindCommandParser : parse("p n/bob t/friend")
activate FindCommandParser

FindCommandParser -> ArgumentMultimap : tokenizeArguments("n/bob t/friend")
activate ArgumentMultimap

ArgumentMultimap --> FindCommandParser
deactivate ArgumentMultimap

FindCommandParser -> Predicate : createPredicateFromMultimap(nameKeywordsList, tagKeywordsList)
activate Predicate

Predicate --> FindCommandParser
deactivate Predicate

create FindPersonCommand
FindCommandParser -> FindPersonCommand : new(predicate)
activate FindPersonCommand

FindPersonCommand --> FindCommandParser : f
deactivate FindPersonCommand

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

AddressBookParser --> LogicManager : f
deactivate AddressBookParser

LogicManager -> FindPersonCommand : execute()
activate FindPersonCommand

FindPersonCommand -> Model : updateFilteredPersonList(predicate)
activate Model

Model --> FindPersonCommand
deactivate Model

create CommandResult
FindPersonCommand -> CommandResult : new(filteredPersons)
activate CommandResult

CommandResult --> FindPersonCommand
deactivate CommandResult

FindPersonCommand --> LogicManager : result
deactivate FindPersonCommand

[<-- LogicManager
deactivate LogicManager
@enduml
2 changes: 2 additions & 0 deletions docs/diagrams/style.puml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

!define USER_COLOR #000000

!define UTIL_COLOR #ffccff

skinparam Package {
BackgroundColor #FFFFFF
BorderThickness 1
Expand Down
Binary file added docs/images/FindPersonSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tim-siu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 51 additions & 4 deletions docs/team/tim-siu.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,54 @@
Hello! πŸ‘‹
---
layout: page
title: Tran Ha Thu's Project Portfolio Page
---

I'm Shuyao, currently navigating my second year as a Computer Science major at the renowned National University of Singapore (NUS). πŸŽ“
### Project: SOCareers

Thrilled to share my exciting journey through the CS2103/T module. It's been an enriching experience working on a collaborative team project alongside my incredible teammates who continually inspire me with their insight and dedication. 🌟
SOCareers is an all-in-one app that helps CS majors to keep track of jobs/internship-related content.
The app allows students to keep track of company application timelines, their networks of people, and interview timelines.

Here's to celebrating learning, collaboration, and the joy of coding! πŸŽ‰
**Summary of Contributions**:

Given below are my contributions to the project.

* **Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=tim-siu&breakdown=false&sort=groupTitle%20dsc&sortWithin=title&since=2023-09-22&timeframe=commit&mergegroup=&groupSelect=groupByRepos)

* **Enhancements implemented (Linked to relevant Pull Requests)**:
* Enhance the existing AB3 to support another entity: `companies`. My part included adding the model for companies.
* [Changing the field of the Person Model](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/78)
* [Introducing the company model](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/84)
* [Achieving full functionality of the model layer with holistic testing](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/86)
* Implemented the following commands:
* [Find Persons - `find p [n/NAME] [t/TAG]` command](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/107)
* [Find Companies - `find c [n/NAME] [t/TAG]` command](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/107)

* **Contribution to the UG**:
* Made the initial commits for the UG to reflect changes in v1.2. This is done in [this Pull Request](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/104).
* Added documentation for the `find p [n/NAME] [t/TAG}` and `find c [n/NAME] [t/TAG]` commands.

* **Contribution to the DG**:
* Made the initial commits for the DG, which included the following:
* Added user stories, glossary, NFRs, use cases of the adapted SOCareers. This is done in [this Pull Request](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/18).
* Formatted the DG to be consistent with the styling requirements. This is done in [this Pull Request](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/75).
* Added documentation for the following enhancements to the SOCareers:
* Added documentation for the `find p [n/NAME] [t/TAG}` command in the DG. This includes sequence diagrams, implementation details and design considerations.


* **Contribution to team-based tasks**:
To be updated soon.

* **Review/mentoring contributions**:
* Reviewed pull requests from teammates:
* [PR #19](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/19)
* [PR #30](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/30)
* [PR #76](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/76)
* [PR #81](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/81)
* [PR #83](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/83)
* [PR #94](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/94)
* [PR #107](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/107)
* [PR #108](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/108)
* [PR #112](https://github.com/AY2324S1-CS2103T-T10-4/tp/pull/112)

* **Contributions beyond the project team**:
To be updated soon.

0 comments on commit 5662644

Please sign in to comment.