-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-W14-4] Pharmacy Inventory & Logistics Ledger (PILL) #28
base: master
Are you sure you want to change the base?
[CS2113-W14-4] Pharmacy Inventory & Logistics Ledger (PILL) #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do remember to ensure your code is more readable for others and to simplify expressions. Keep up the good work
logger.info("Showing specific help for command: " + command); | ||
|
||
switch (command.toLowerCase()) { | ||
case "help": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can refactor the magic string?
} else if (j == 0) { | ||
dp[i][j] = i; | ||
} else { | ||
dp[i][j] = min(dp[i - 1][j - 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can look to refactor this line to make it more readable?
String closestMatch = null; | ||
int minDistance = Integer.MAX_VALUE; | ||
|
||
for (String valid : validStrings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valid might be a bit ambiguous, maybe you can use validString
instead?
public Item loadLine(String line) throws PillException { | ||
Item item; | ||
String[] data = line.split(SEPARATOR); | ||
if (data.length == 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can refactor the magic literal to make it more readable
String[] data = line.split(SEPARATOR); | ||
if (data.length == 3) { | ||
try { | ||
item = new Item(data[0], Integer.parseInt(data[1]), LocalDate.parse(data[2])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could refactor data[0]
and so on such that it is more understandable what each variable means before the if statement
List<Item> filteredItems = items.values().stream() | ||
.flatMap(TreeSet::stream) | ||
.filter(item -> item.getQuantity() <= threshold) | ||
.toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can look into refactoring this to make it more readable and less complicated?
String arguments = String.join(" ", Arrays.copyOfRange(splitInput, 1, splitInput.length)); | ||
|
||
switch (commandString) { | ||
case "exit": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can look into refactoring these magic strings?
|
||
@Override | ||
public void execute(ItemMap itemMap, Storage storage) throws PillException { | ||
// Looks stupid, but this way I don't handle Optionals in this class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can rephrase this to write comments targeting other programmers reading the code
} else { | ||
suggestSimilarCommand(command); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can be changed to a guard clause instead to make the happy path more prominent
private final String commandName; | ||
private final boolean verbose; | ||
|
||
public HelpCommand(String commandInput, boolean verbose) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can change the boolean variable name to make it more obvious it is a boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks neat
|
||
<!-- @@author yakultbottle --> | ||
|
||
### Storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these classes can have UML diagrams
Example: | ||
|
||
``` | ||
AddItemCommand command = new AddItemCommand(itemName, quantity, expiryDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be put in the implementation section, following the example they give us.
|
||
**API**: PillLogger.java | ||
|
||
<img src = "diagrams/PillLogger.png" alt="Component Diagram for PillLogger"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diagram looks like it doesnt follow the standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i think missing some tag and some place should use dotted lines
docs/DeveloperGuide.md
Outdated
The ItemMap class contains a key-value pair, implemented as a Map, from the | ||
item name(String) to the item(TreeSet\<Item>) | ||
|
||
![](diagrams/ItemMap-ClassDiagram.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this follows the standard also, I am not sure what the dotted box "item" mean on comparable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should do comparable:item
docs/DeveloperGuide.md
Outdated
|
||
The Item class has three private variables, a name, a quantity, and an | ||
expiry date. An Item may or may not have an expiry date, so we store it | ||
as an Optional, which handles empty values for us without using null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could briefly explain why Optional was chosen over null
|
||
**API**: PillLogger.java | ||
|
||
<img src = "diagrams/PillLogger.png" alt="Component Diagram for PillLogger"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i think missing some tag and some place should use dotted lines
docs/DeveloperGuide.md
Outdated
* Technical Requirements: Any mainstream OS, i.e. Windows, macOS or Linux, with Java 11 installed. Instructions for downloading Java 11 can be found [here](https://www.oracle.com/sg/java/technologies/javase/jdk11-archive-downloads.html). | ||
* Project Scope Constraints: The application should only be used for tracking. It is not meant to be involved in any form of monetary transaction. | ||
* Project Scope Constraints: Data storage is only to be performed locally. | ||
* Quality Requirements: The application should be able to be used effectively by a novice with little experience with CLIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be more detailed and concrete
docs/DeveloperGuide.md
Outdated
|
||
#### AddItemCommand | ||
|
||
<img src = "diagrams/AddItemCommand-SequenceDiagram.png"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some part like print and log can be simplified
docs/DeveloperGuide.md
Outdated
|
||
#### AddItemCommand | ||
|
||
<img src = "diagrams/AddItemCommand-SequenceDiagram.png"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to add some activation bars to show if the objects are working?
|
||
The high-level overview of the project structure is as follows: | ||
|
||
<img src = "diagrams/High-Level-Overview.png" alt="High Level Overview of PILL"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may try to consider the direction of arrows. Since it's is MVC model, the arrow from View to Controller might be a two way arrow (e.g. View send request to Controller and Controller response with data?), the same for Controller to Model components
|
||
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
The project is designed using the Model-View-Controller (MVC) architecture, with the following components: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Model - Controller - View is at a higher level comparing to other classes (e.g. Model contains Item and ItemClass) and they are not really a class as well, you may try to create a hierarchy, just to distinguish between the architecture and the actual implementation. For example:
3. Controller:
3.1. Item
3.2. ItemMap
|
||
The UI consists of the following components: | ||
|
||
1. **Parser**: The Parser class is responsible for interpreting user input and returning the corresponding command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I think UI is the 'View' part in your architecture, should it be better to make this parser a part of the Controller instead of View? As the Controller in MVC is responsible for handling user input, processing it, and coordinating between the Model and the View, I think the parser is nearer to a Controller component than a View component
|
||
<!-- @@author cxc0418 --> | ||
|
||
### UI and I/O |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be good to put these implementation into a hierarchy corresponding to your architecture? To make a clearer view of how each component related to the high-level architecture!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diagram should not have class symbols (green C) and the arrows should be orthogonal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diagram is missing activation boxes
docs/diagrams/PillLogger.puml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arrows should be orthogonal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting for the "else" condition in the second section is not formatted properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks neat, but notations used may not follow requirements, some broken links and maybe more diagrams would be better
docs/DeveloperGuide.md
Outdated
expiry date. An Item may or may not have an expiry date, so we store it | ||
as an Optional, which handles empty values for us without using null. | ||
|
||
![](diagrams/Item-ClassDiagram.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are your notations used correctly? Should it be "function(): 'return type'"?
docs/DeveloperGuide.md
Outdated
|
||
#### AddItemCommand | ||
|
||
<img src = "diagrams/AddItemCommand-SequenceDiagram.png"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these notations correct? Should it include activation bars?
|
||
<!-- @@author cxc0418 --> | ||
|
||
### UI and I/O |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be more visuals and diagrams to make this clearer?
docs/DeveloperGuide.md
Outdated
- [DateTime](#datetime) | ||
- [Exceptions and Logging](#exceptions-and-logging) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these links supposed to be here? Should they be broken?
Implement Use command with priority removal
Update on the cost & price etc
Notes: - Added in-line comments for clarity.
Notes: - Added TimestampIO.java
Notes: - Added new test cases for coverage in HelpCommandTest.java
Notes: - Added TimestampIOTest.java
Timestamps, JUnit Tests, Comments // Implemented
Fix PPP formatting
Update high level architecture diagram
Fix DG and UG
UG and DG small fixes
minor change to PPP
Update PPP formatting
Add acknowledgement for XChart
Pharmacy Inventory & Logistics Ledger (PILL) is a Command Line Interface (CLI) tool designed to assist in
managing and tracking medicinal inventory.