Skip to content
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-T17-2] CafeCTRL #14

Open
wants to merge 1,231 commits into
base: master
Choose a base branch
from

Conversation

DextheChik3n
Copy link

@DextheChik3n DextheChik3n commented Oct 5, 2023

CaféCTRL aims to optimize managing of inventory and cash flow in a restaurant. Our CLI platform empowers users to streamline stock inventory, menu and orders. Users will also briefly be able to gain valuable insights through comprehensive sales reporting, enabling them to analyze sales trends and calculate revenue/profit margins, eliminating the need for cross-platform management.

Brian030601 pushed a commit to Brian030601/tp that referenced this pull request Oct 18, 2023
Copy link

@woowenjun99 woowenjun99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the team did a great job in their implementation.

In terms of software engineering practices, we can tell that most code quality and coding standards were abided to (e.g. naming convention, less than 80 characters per line). However, one suggestion that I would make is to remove unused / dead code or leave a comment there to tell the reader the purpose of not deleting it entirely.

In terms of Object Oriented Programming, I really enjoy seeing that there is a separation of concerns and that there are several domains created for different purposes. For instance, command is command, menu is menu and pantry is pantry. This is from personal experience but perhaps we can abstract the logic even more.

Note: This is for educational purposes. Do not attempt this unless you have ample time and find what I say make sense and no additional marks would be given

  1. Maybe we can read up on Domain Driven Development (DDD). We can declare the domains that is needed first (maybe in terms of interfaces) before we start working on it.
  2. For instance, let us consider the Chef object. Does a normal chef have a UI object with him? What if we shift into cookDish method instead and use it as a dependency rather than a member? The issue with this is it violates the Single Responsibility Principle, we try to combine the printing logic with the other logic.
  3. Perhaps we can consider implementing an interface called ChefInterface that has the necessary attributes that belong to a Chef and implement it, and maybe create an overarching service class (or use the command class) to make the classes interact with each other like how normal chefs would.

ui.printLine();
}
} while (!command.isExit());
//this.storage.saveAll(this.menu, this.orderList, this.pantry);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we remove this dead code since it is not being used here?

}

public static void main(String[] args) throws IOException {
CafeCtrl cafeCtrl = new CafeCtrl();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change is required here, I was just curious if there is a need for this line here. Why not create a method called initCafe() rather than creating a new instance of it?

* Adds a menu item to the user
*/
public class AddDishCommand extends Command {
public static final String COMMAND_WORD = "add";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to use capital for constants

public static final String COMMAND_WORD = "view_stock";
protected Ui ui;
protected Pantry pantry;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can review all the files and ensure consistency in the spacing between each line?

Comment on lines 19 to 44
//@@author DextheChik3n
public static ArrayList<String> encodeMenu(Menu menu) {
/*
ArrayList<Dish> dishArrayList = menu.getMenuItemsList();
String tasksFilePathString = this.fileManager.openTextFile();

if (dishArrayList.isEmpty()) {
this.fileManager.overwriteFile(tasksFilePathString, ""); //overwrite text file to store empty text
}
//todo: remove testing code
dishArrayList.add(new Dish("test", (float) 1.2));
dishArrayList.add(new Dish("test", (float) 1.2));

//input arraylist data into text file
for (int i = 0; i < dishArrayList.size(); i++) {
String taskDataRow = "chicken rice | 5.00 | rice 50g";

if (i == 0) {
this.fileManager.overwriteFile(tasksFilePathString, taskDataRow);
} else {
this.fileManager.appendToFile(tasksFilePathString, taskDataRow);
}
}
*/
return null;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can remove this dead code since it returns null and does not do anything

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are still in progress in implementing the storage to text file functionality so it was left commented out

Comment on lines 30 to 31
// ArrayList<String> encodedMenu = this.fileManager.readTextFile(FilePath.MENU_FILE_PATH);
// return Decoder.decodeMenuData(encodedMenu);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can return the dead code here too

@woowenjun99
Copy link

One thing to take note of: Since you are dealing with money, there is a possibility that other teams might break your product using big numbers (causing overflow), negative numbers, non-2 decimal places pricing. Extra caution had to be taken care of for this (A.K.A. consider unit testing + assertions before mock PE 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove arrow 6,7

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arrow 22 has a typo ? maybe you wanted to specify it as showMenuBottom(varname: String) ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe modify arrow to show showToUser(<static var name>, ..)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although its returning void, you may want to consider adding the dotted arrows here to standardize with/follow the other diagrams

Copy link

@Xuan127 Xuan127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diagrams look great! Although there might be too many details and are overwhelming. Remember to change the accessibilities and figure numbers.

@@ -4,10 +4,154 @@

{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove the default placeholder text


![Parser Class Diagram](images/class/Parser.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The accessibility of a variable or method should be + (public) or - (private) instead of colours by default in plantUML

### Storage
API: [Storage.java]({repoURL}src/main/java/seedu/cafectrl/storage/Storage.java)

![Storage Class Diagram](images/class/Storage.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue regarding accessibility as before


### Edit Price

![Edit Price Execution](images/sequence/EditPriceCommand_execute.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Activation bar for 6th step should start after the arrow


### Add Dish

![Add Dish Execution](images/sequence/AddDishCommand_execute.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No figure number


![List Menu Execution](images/sequence/ListMenuCommand_execute.png)

Figure 1: Execution of list_menu command
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this figure 1?


Note that `CafeCtrl` only have access to the interface `ParserUtil` although the run-time type object is `Parser`. With this, we are able to decrease coupling between `CafeCtrl` and `Parser`, allowing for easier maintenance. This also ensures the testability as we could provide mock or stub dependencies during testing, we could isolate the behavior of the class and focus on unit testing without external dependencies.

![Parser Parsing User Input Sequence Diagram](images/sequence/Parser.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alt should have multiple braches, if there's only one possible branch, should use opt instead

### Storage
API: [Storage.java]({repoURL}src/main/java/seedu/cafectrl/storage/Storage.java)

![Storage Class Diagram](images/class/Storage.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The storage class diagram does not follow CS2113 standard. You may want to look at the notes. For example, shouldn't have the C logo etc.

![List Menu Execution](images/class/ListMenuCommandClass.png)

![List Menu Execution](images/sequence/ListMenuCommand_execute.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the number for each step is not necessary

@vvhuiling
Copy link

image should these arrow be separated from each other?

@vvhuiling
Copy link

I really like the way you include both class diagram and sequence diagram to illustrate your components and features!

Copy link

@vvhuiling vvhuiling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me!


### Edit Price

![Edit Price Execution](images/sequence/EditPriceCommand_execute.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the method called in 6th step doesn't follow the sequence diagram format?


### Edit Price

![Edit Price Execution](images/sequence/EditPriceCommand_execute.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8th step arrow may need to point to the start of the activation bar

Copy link

@wendelinwemhoener wendelinwemhoener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good DG; I only added a few nitpicks

- `Parser` : Makes sense of user input to return the appropriate command
- `Command` : Executes the comman requested by the user.

How the architecture components interact with each other

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a heading?

Looking at it on the website, it seems like normal text; but I think it signifies a new segment. See this:
image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out! I think your suggestion makes sense and I will edit accordingly!


![Parser Class Diagram](images/class/Parser.png)

*Figure 4: Parser Class Diagram*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the diagram higher resolution?

It is hard to read on the website, see
image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out! Will edit it

- is composed of `FileManager` object as the text file needs to be located first before reading or writing.

### Data Component
API: []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this supposed to mean?

It confuses me and I think you should clarify this
image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We forgot to add hyperlink here! It is updated in the latest version

### Add Dish

![Add Dish Execution](images/sequence/AddDishCommand_execute.png)
*Figure 8: Execution of add_dish command*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Figure 8" text is in a weird location besides the diagram
image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops I forgot to add a newline thanks for pointing it out 👍

e.g. (1. Chicken Rice $2.50) is shown.

### Add Order
A add_order command can be used to add `order` to an `orderList` in `Sales`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should write "an add_order" instead of "a add_order"
image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, thanks!

## Product scope
### Target user profile

Café proprietors seeking for a software solution to optimize the management of their café's operations

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimize it how? Could you explain a bit more?

image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add more details here, thank you!


The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command `delete 1`.

![Architecture Encode Data](images/sequence/Architecture_Encode_Data.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
we should use the solid line.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I am not sure which part you are referring to, could you specific which statement is it?


API: [ListMenuCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/ListMenuCommand.java)

When the `execute()` method of ListMenuCommand is invoked in Main, it checks if the size of the menu by running `menu.getSize()`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice to check whether the list is empty or not before the execution.


* *glossary item* - Definition
### User stories
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user stories are clear and considerate enough to make sure all kinds of user can realize their needs.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!


### Edit Price

![Edit Price Execution](images/sequence/EditPriceCommand_execute.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 6th step should have an arrow before

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I dont quite get what you mean, could you specify where should the arrow be at?

Cazh1 and others added 6 commits November 12, 2023 17:14
…es-v2.1

Task 320, Error handling for decoding of sales.txt, list_ingredients and list_sale command
# Conflicts:
#	src/main/java/seedu/cafectrl/ui/ErrorMessages.java
#	src/main/java/seedu/cafectrl/ui/Messages.java
Include patter and mathcer in PPP
Brian030601 pushed a commit to Brian030601/tp that referenced this pull request Nov 12, 2023
NaychiMin and others added 30 commits November 14, 2023 04:46
Edit PPP to reduce page length
Edit PPP to reduce page length
# Conflicts:
#	docs/team/ziyi105.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.