-
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-T11-4] Inventra #23
base: master
Are you sure you want to change the base?
Changes from 160 commits
10018ba
e719aaa
5cf2124
3f685c2
6e9a2d1
155dcea
7900781
564faf4
240f94b
c57ea4b
8789199
98eeb7b
0c7a80b
4477341
e47f0a8
9c6d5bf
ed3a4bf
79bba43
836272d
1917b3b
fb4aa10
1d986f6
0856f1a
1f3b256
b39aba4
bee83c6
055c6b5
2886f85
29a2445
005dcf4
59a47e6
8dec487
43fda35
ce29ecd
ba91d57
8b2fb4a
91f852d
a11c030
451caea
e328e4d
62ab1b1
dd66c90
558fa31
dac4359
8bd4079
198a305
5cab9fc
a9c2b09
7308ddb
e5b253a
929119e
85fc0d4
2384f85
d190c6b
1e7da8e
4e2acc0
0c45ed4
577bcc3
1ff3b86
044ecf6
ade6a51
47b6621
8f39674
c197918
9e0b528
c1a24ac
97a44bd
ed2d76f
1b5e345
113493e
fa11a02
edb529b
a65b102
f7c6144
2bf4328
0110260
e1e7a07
6fa2632
56c38f7
e725807
02eb4f9
70dad2e
cfd01a3
e293591
c7d5426
507dabc
c5c2b38
cdb80ed
aedae83
0634b9b
bfb2f41
db21412
3525084
0bdecac
b5ac8b0
bc7f010
e441e97
5c3a212
075f529
41c739b
3019bfd
869ec8a
2229ad4
a7819d8
7c120fc
45188ef
ed791a1
2aace19
94211ce
4239a26
d1757c5
0fb3e2e
400a06f
d7dff10
b26203d
6139e12
7d02cd5
0641f74
fbb76c4
370d218
bd261cf
c39ac51
cfea880
942a7eb
174bf51
65c47d3
491a9c9
1578b8a
a854ecd
b8393bb
b059f20
50bf1f8
2d0a722
e96e9ad
ec49dec
b3af044
eca7f68
49cf683
981c23c
73d2de3
efa9c10
c15e863
5c39f14
10edb7f
f798de1
05e4927
4bac55e
f936fb5
08a035a
b0e07f3
a7e8938
9a96624
15c03b6
360190d
fa22e2e
479d902
e5e8f93
f47e250
00f82e9
46c6228
85f5382
f9b306f
bb6f235
901a514
1d85ad8
3295647
bc4eb60
a24111d
cd5b638
f52504f
2cfde00
2c46b4a
aa5ce7b
a6077d9
2d762d8
379f58a
15781ac
bec3723
1020c3c
4a960c6
17f2305
deb6983
d2f360d
36c71fc
41b4278
2528682
5fc8ca6
b69d024
fd48795
4416037
4c15360
9ff35ac
d2476b7
fae8dbf
567099c
f98c68f
65a1974
da1bb5d
b46575f
803bb1a
ae71fc1
924fdda
732d02d
fd263b5
2ed8f97
342e2e8
b85b95f
d9fd2ba
ffa44b6
883fefd
a4f6d81
bee4ae7
e5a2de2
73deaf2
a705b77
835aa51
9407c96
28ab4b3
e3b093d
4b9bd17
b69520f
42da59e
120fc26
32645b2
3a7a437
626b769
baa9303
ca92df9
493e027
7630921
edd8046
b6f962d
0217419
d2cd42a
568bbd8
f35984f
ddf2da2
cfd6c0c
2c87afd
cbfbfef
4468f51
4a1366a
fb0e610
f908beb
4bcf6fa
c380722
da5da5c
8508a00
bb42cdd
837ed42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,208 @@ | ||
# Developer Guide | ||
|
||
## Acknowledgements | ||
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
The following resources and libraries were referenced or adapted in this project: | ||
* Java Coding Standard (Basic): [Official Documentation](https://se-education.org/guides/conventions/java/basic.html) | ||
* Code Quality (Guide): (https://nus-cs2113-ay2425s1.github.io/website/se-book-adapted/chapters/codeQuality.html) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hyperlink not working (not clickable in the DG) |
||
|
||
## Design & implementation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can add a brief overview of the whole program to allow user view the whole sequence of the project |
||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
### Main Components of the architecture | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps include an architecture diagram here. |
||
|
||
The `Inventra` class manages the overall application flow, which includes application launch and shutdown. | ||
The core processes are managed by the following components: | ||
* **UI**: The user interface for handling user interaction and the display of output. | ||
* **Command**: The commands that user inputs. | ||
* **CommandParser**: A parser to handle said commands, as well as interpreting flags and arguments. | ||
* **Inventory**: The mode we are operating in. | ||
* **Storage**: Reads and writes data to a CSV file to maintain data persistence. | ||
|
||
### "Add" Command Feature | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent formatting styles: "Add" (line 11), '-h' (line 15), There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do note that the DG's primary purpose is to inform on the implementation details. This is prevalent in other "Command Features" as well. |
||
The "AddCommand" is responsible for adding fields and records to the inventory. | ||
Concurrently, "add" command is implemented with behaviour to update CSV file to persist changes made to inventory. | ||
|
||
This command supports the following options: | ||
* '-h': Add custom fields to the inventory. | ||
* '-d': Add records to the inventory corresponding to defined fields. | ||
|
||
#### Architecture Overview | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be better explained with class diagrams. |
||
The 'AddCommand' is part of the `command` package, and interacts with the following key components: | ||
* **Inventory**: Contains the current state of the inventory, including fields and records. | ||
* **Csv**: Handles reading from and writing to the CSV file for data storage persistence. | ||
* **Ui**: Handles user interactions component such as message to user during command execution. | ||
|
||
Command flow of 'AddCommand' can be visualized with the following architecture diagram: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A "command flow" seems to suggest a sequence diagram more so than an architecture diagram. |
||
![Architecture Diagram](docs/diagrams/AddCommandArchitectureDiagram.png) | ||
|
||
* **Description**: The `AddCommand` class modifies the `Inventory` by adding new fields or records based on user's inputs. | ||
It interacts with `Csv` to update the CSV file accordingly to maintain data persistence. | ||
The `Ui` components then displays feedback to the user. | ||
|
||
#### Component-Level Design | ||
"AddCommand" Class: | ||
* processes the input arguments and executes the logic based on flags (-h, -d) respectively. | ||
* fields and records are validated before updating inventory data into the CSV file. | ||
|
||
"AddCommand" Methods: | ||
* handleAddMultipleFields(): processes input fields, validate fields, and update the inventory accordingly. | ||
* handleAddRecord(): handles logic for adding records into the inventory. If successfully add records, data will be appended into the CSV file. | ||
* handleUpdateFields(): allow updating of existing fields and types in the inventory. | ||
![Class Diagram](docs/umldiagrams/AddCommandClassDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all diagrams, it would be better to show the diagram first before explaining the details within the diagram. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The navigability seems to suggest that there is a reference of Inventory, Csv, and Ui within the AddCommand class, but this is not the case within the code! The association label is not indicated with an arrow head. Please follow proper UML notation for class diagrams. |
||
* **Description**: The class diagram illustrates methods of the `AddCommand` class and the interaction with `Inventory`, `Csv`, and `Ui` respectively. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This bullet point is out of place. What is this description for? |
||
|
||
#### Sequence Diagram | ||
*Illustrates how "AddCommand" interacts with "Inventory" and "Csv" classes when adding a record: | ||
|
||
![Sequence Diagram](docs/diagrams/AddCommandSequenceDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sequence diagram totally do not match the implementation. Are you sure that User is the one who invokes the execute() method? Please fix all your sequence diagrams within the DG. |
||
|
||
#### Why Implement "AddCommand" in this way? | ||
Separating implementation of "AddCommand", "Inventory", and "Csv" classes ensures: | ||
* "AddCommand" focus only on processing input and delegating task to other specific components. | ||
* "Csv" class is responsible for updating data into CSV file for storage; ensuring persistence in data control. | ||
* With this breakdown of implementation, create room for future scalability (e.g. adding more fields types). | ||
|
||
#### Alternative Considered | ||
Only when requirements permits, database implementation has been considered for better handling of fields types for inventory storage. | ||
|
||
### "Delete" Command Feature | ||
The "DeleteCommand" is responsible for adding fields and records to the inventory. | ||
Concurrently, "delete" command is implemented with behaviour to update CSV file to persist changes made to inventory. | ||
This command supports the following formats: | ||
* '\<index>': Delete the record at the specified index (1-based indexing). | ||
* '-a': Delete all records in the inventory. | ||
* '-e': Delete all records and headers in the inventory. | ||
* '-h \<field_name>': Delete the mentioned field and its column from the inventory. | ||
* '-r \<start>-\<end>': Delete records from the start index to the end index (both inclusive and 1-based indexing). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should have example below every command for clarity instead of in the manual testing part at the bottom of the document |
||
|
||
#### Architecture Overview | ||
The 'DeleteCommand' is part of the `command` package, and interacts with the following key components: | ||
* **Inventory**: Contains the current state of the inventory, including fields and records. | ||
* **Csv**: Handles reading from and writing to the CSV file for data storage persistence. | ||
* **Ui**: Handles user interactions component such as message to user during command execution. | ||
|
||
Command flow of 'DeleteCommand' can be visualized with the following architecture diagram: | ||
![Architecture Diagram](docs/diagrams/DeleteCommandArchitectureDiagram.png) | ||
* **Description**: The `DeleteCommand` modifies `Inventory` by removing fields or records that are specified by the user. | ||
The `Csv` components updates the CSV file to reflect changes made during deletion, as well as `Ui` provide response to the user. | ||
|
||
#### Component-Level Design | ||
"DeleteCommand" Class: | ||
* processes the input arguments and executes the logic based on if the second argument is a number or flag. | ||
* fields and records are validated before updating inventory data into the CSV file. | ||
|
||
"Delete Command" key methods include: | ||
* `deleteSingleRecord()`: Deletes a specific record by defined index. | ||
* `deleteAllRecords()`: Deletes all records from the inventory. | ||
* `deleteHeaderAndColumn()`: Deletes a specific field. | ||
* `deleteRangeRecords()`: Deletes a range of records. | ||
|
||
![Class Diagram](docs/diagrams/DeleteCommandClassDiagram.png) | ||
* **Description**: The class diagram above shows the core methods of `DeleteCommand` and its interactions with `Inventory`, `Csv`, and `Ui`. | ||
|
||
#### Sequence Diagram | ||
*Illustrates how "DeleteCommand" interacts with "Inventory" and "Csv" classes when deleting a record: | ||
|
||
![Sequence Diagram](docs/diagrams/DeleteCommandSequenceDiagram.png) | ||
|
||
#### Why Implement "DeleteCommand" in this way? | ||
Separating implementation of "DeleteCommand", "Inventory", and "Csv" classes ensures: | ||
* "DeleteCommand" focus only on processing input and delegating task to other specific components. | ||
* "Csv" class is responsible for updating data into CSV file for storage; ensuring persistence in data control. | ||
* With this breakdown of implementation, create room for future scalability (e.g. adding more fields types). | ||
|
||
#### Alternative Considered | ||
As with `AddCommand`, database implementation has been considered for better handling of fields types for inventory storage. | ||
|
||
|
||
### "View" Command Feature | ||
The `ViewCommand` allows users to view records in the inventory, either displaying all records or specific ones based on user's defined filters. | ||
|
||
This command supports the following formats: | ||
* `-a`: View all records. | ||
* `<ID>`: View a specific record by defined ID. | ||
* `-f <keyword>`: View records containing a keyword. | ||
|
||
#### Architecture Overview | ||
|
||
The `ViewCommand` interacts with: | ||
* **Inventory**: Accessing data to retrieve and display records | ||
* **Ui**: Displays records to the user. | ||
|
||
![ViewCommand Architecture Diagram](docs/diagrams/ViewCommandArchitectureDiagram.png) | ||
* **Description**: The `ViewCommand` retrieve data from `Inventory` based on user's input and leverage on `Ui` to display records. | ||
|
||
#### Component-Level Design | ||
|
||
The `ViewCommand` class processes input arguments and execute respective logic based on flags or IDs provided. | ||
|
||
"View Command" key methods include: | ||
* `handleViewById()`: Displays a specific record by ID | ||
* `handleViewByKeyword()`: Filters and displays records based on defined keyword. | ||
|
||
![ViewCommand Class Diagram](docs/diagrams/ViewCommandClassDiagram.png) | ||
* **Description**: The class diagram above shows the main methods used by `ViewCommand` and its connection to `Inventory` and `Ui`. | ||
|
||
#### Sequence Diagram | ||
The following sequence diagram shows how `ViewCommand` interacts with `Inventory` and `Ui` when displaying a specific records: | ||
|
||
![ViewCommand Sequence Diagram](docs/diagrams/ViewCommandSequenceDiagram.png) | ||
|
||
#### Why Implement `ViewCommand` in this way: | ||
Approach was adopted to ensure efficient access to `Inventory` for data retrieval and provide overall user-friendliness for user viewing records through `Ui`. | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can add ur logging and exception to show how u catch errors |
||
## Product scope | ||
### Target user profile | ||
|
||
{Describe the target user profile} | ||
* Small to medium-sized business owners operating as retail stores, warehouses, or online shops. | ||
* Owners seeking a customizable, command-driven system to efficiently manage inventory and optimize workflows can leverage on Inventra. | ||
|
||
### Value proposition | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
Inventra provides a fast, command-line driven logistics and inventory management system, allowing a single user to do stock tracking, order management, and operational insights, ensuring quick and snappy access to critical business data. | ||
|
||
## User Stories | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that ... | | ||
|--------|----------------|---------------------------------------------------|----------------------------------------------------------------------------------| | ||
| v1.0 | business owner | add new products to the inventory | I can keep track of stock availability. | | ||
| v1.0 | business owner | delete discontinued products from inventory | the inventory can be up-to-date on the existing products. | | ||
| v1.0 | business owner | view current inventory list | I can efficiently access in-stock products and to handle restocking of products. | | ||
| v1.0 | business owner | import and export inventory data into spreadsheet | I can streamline inventory updates. | | ||
| v1.0 | business owner | customize information type related to products | I can have the flexibility to manage inventory better. | | ||
| v2.0 | business owner | search for products in the inventory | I can find specific items quickly. | | ||
| v2.0 | business owner | delete all products in inventory | I can handle incorrect creation of inventory data. | | ||
| v2.0 | business owner | update product details | I make adjustments to the inventory when required. | | ||
|
||
## Non-Functional Requirements | ||
|
||
{Give non-functional requirements} | ||
* The system should work across different operating systems (Windows, Linux, macOS). | ||
* Data must be persistent across sessions by saving and fetching from/to a CSV file. | ||
|
||
## Glossary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glossary is lacking, please double-check on the additional vocabulary that you have introduced, such as "Records". |
||
|
||
* *glossary item* - Definition | ||
* *CSV* - Comma-separated values, a format used to store data in a table that are separated by commas | ||
* *Inventory* - Collections of items defined based on their associated properties (fields) - for example: product name, quantity, ...). | ||
|
||
## Instructions for manual testing | ||
|
||
{Give instructions on how to do a manual product testing e.g., how to load sample data to be used for testing} | ||
1. Adding Fields | ||
* Run command: `add -h s/name, i/quantity, f/price` to add new fields to inventory | ||
* Verification: `view -a` | ||
|
||
2. Adding Records | ||
* Run command: `add -d Apple, 100, 1.5` | ||
* Verification: `view -a` | ||
|
||
3. View Records | ||
* To view all records in inventory, run command: `view -a` | ||
* To view specific records in inventory by ID, in this case ID = 1, run command: `view 1` | ||
* To view records by string, in this case find string "Apple", run command: `view -f Apple` | ||
|
||
4. Delete Records | ||
* To delete ID = 1, run command: `delete 1` | ||
* To delete all records, run command: `delete -a` | ||
* To delete entire table (inventory), run command `delete -e` | ||
* Verification: `view -a` | ||
|
||
5. CSV Persistence (data storage) | ||
* After add or delete fields/records, check CSV file (`inventory.csv`) for update | ||
|
||
6. Exit Program | ||
* Run command: `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.
[CRITICAL]
Diagrams are not shown on DG html page. Please fix this as soon as possible.