Skip to content

Commit 7dec5fc

Browse files
authored
Merge pull request #84 from gosongying/DG
Update DG
2 parents 60c9fe3 + ea794f9 commit 7dec5fc

File tree

5 files changed

+82
-3
lines changed

5 files changed

+82
-3
lines changed

docs/DeveloperGuide.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,64 @@ handle one attribute at the same time as each FindCommand can only use one predi
293293
multiple attributes at the same time using chain test on multiple predicate. However, it is ineffective as it needs to
294294
check multiple situation (use 1 attribute, 2 attributes, or 3 attributes).
295295

296+
### \[Completed\] Separate client and housekeeper list
297+
In the previous iteration, both clients and housekeepers were consolidated into a single list, presenting them together.
298+
However, this amalgamation didn't offer enhanced visualization or convenience for our intended users. Hence, we opted to
299+
segregate the client and housekeeper lists. This adjustment aims to streamline efficiency for our target users,
300+
specifically housekeeping company administrators, enabling easier access to clients and assignment of housekeepers.
301+
302+
#### How the feature is implemented
303+
The `UniquePersonList` class has been transformed into a generic class. Within the `AddressBook` class, two distinct
304+
lists have been instantiated: one for clients and another for housekeepers. These lists store the respective entities,
305+
ensuring separation of concerns. Both the saving and loading functionalities now operate independently on these
306+
segregated lists.
307+
308+
#### Why is it implemented this way
309+
This approach offers improvements in both efficiency and performance. By separating clients and housekeepers into
310+
distinct lists, interactions between these entities are minimized. This segregation enhances organization and simplifies
311+
maintenance of the system, as each list can be managed independently without impacting the other.
312+
313+
#### Alternatives considered
314+
315+
##### Alternative 1
316+
Store clients and housekeepers together in a single list on the hard disk, they are separated upon application startup.
317+
Although this method is functional, it introduces overhead by requiring filtering of the single list to achieve
318+
eparation, potentially impacting performance negatively. Furthermore, the code complexity increases as it must handle
319+
the filtering process, making maintenance more challenging.
320+
321+
### \[Completed\] Delete feature with Type
322+
323+
In the previous iteration, both clients and housekeepers were contained within a singular list, limiting the delete
324+
functionality to operate solely within this unified list. In the current iteration, we've segregated these entities into
325+
distinct lists—one for clients and another for housekeepers. Consequently, we've introduced an updated Delete feature
326+
capable of removing entries from either of these individual lists.
327+
328+
#### How the feature is implemented
329+
330+
Two subclasses, namely `DeleteClientCommand` and `DeleteHousekeeperCommand`, have been developed as subclasses of the
331+
abstract class `DeleteCommand`. Each subclass is designed to operate on its respective list. During parsing, the system
332+
now evaluates the type specified within the Delete command entered by the user. If the type is identified as "client",
333+
the parser returns a `DeleteClientCommand`, enabling deletion of the client identified by the index within the client
334+
list. Conversely, if the type is recognized as "housekeeper", a `DeleteHousekeeperCommand` is utilized to remove the
335+
housekeeper at the specified index within the housekeeper list.
336+
337+
Here is how the activity diagram looks like: <br>
338+
![DeleteActivityDiagram](images/DeleteActivityDiagram.png)
339+
340+
#### Why is it implemented this way
341+
The existing implementation now employs two distinct subclasses: `DeleteClientCommand` and `DeleteHousekeeperCommand`,
342+
each tailored for deleting entries from their respective lists. By segregating these functionalities into separate
343+
classes, the code adheres more closely to object-oriented programming (OOP) principles, enhancing clarity and
344+
maintainability. This approach ensures that each command operates distinctly on its designated list, promoting a more
345+
organized and modular codebase.
346+
347+
#### Alternatives considered
348+
349+
##### Alternative 1
350+
Introducing a new attribute, "Type", within the `DeleteCommand` class may effectively accomplish the task at hand;
351+
however, it also brings the drawback of potentially increasing the number of conditional statements, which could degrade
352+
readability and maintainability. Moreover, the internal nature of the "Type" attribute might obscure its purpose to
353+
developers, leading to confusion.
296354
--------------------------------------------------------------------------------------------------------------------
297355

298356
## **Documentation, logging, testing, configuration, dev-ops**
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@startuml
2+
skin rose
3+
skinparam ActivityFontSize 15
4+
skinparam ArrowFontSize 12
5+
start
6+
:User executes delete command (eg. delete client 1);
7+
8+
'Since the beta syntax does not support placing the condition outside the
9+
'diamond we place it as the true branch instead.
10+
11+
fork
12+
:Check Type specified;
13+
if () then ([client])
14+
:Return DeleteClientCommand;
15+
else ([housekeeper])
16+
:Return DeleteHousekeeperCommand;
17+
endif
18+
end fork
19+
:Delete person from the corresponding list;
20+
stop
21+
@enduml

docs/diagrams/DeleteSequenceDiagram.puml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ box Model MODEL_COLOR_T1
1414
participant "m:Model" as Model MODEL_COLOR
1515
end box
1616

17-
[-> LogicManager : execute("delete 1")
17+
[-> LogicManager : execute("delete client 1")
1818
activate LogicManager
1919

20-
LogicManager -> AddressBookParser : parseCommand("delete 1")
20+
LogicManager -> AddressBookParser : parseCommand("delete client 1")
2121
activate AddressBookParser
2222

2323
create DeleteCommandParser
@@ -27,7 +27,7 @@ activate DeleteCommandParser
2727
DeleteCommandParser --> AddressBookParser
2828
deactivate DeleteCommandParser
2929

30-
AddressBookParser -> DeleteCommandParser : parse("1")
30+
AddressBookParser -> DeleteCommandParser : parse("client"), parse("1")
3131
activate DeleteCommandParser
3232

3333
create DeleteCommand

docs/images/DeleteActivityDiagram.png

25 KB
Loading

docs/images/DeleteSequenceDiagram.png

6.36 KB
Loading

0 commit comments

Comments
 (0)