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

[AY1920S1-CS2113-T13-1] ArchDuke #45

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

Conversation

Lucria
Copy link

@Lucria Lucria commented Sep 14, 2019

Copy link

@akshayeshenoi akshayeshenoi left a comment

Choose a reason for hiding this comment

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

Great effort!

Few things to keep in mind:

  1. Always try to separate concerns. The CLIView should not be aware of the project repository, for example.
  2. Enforce strict abstraction levels. Does ProjectInputController and ConsoleInputController sit at the same level?
  3. Lower tiers in a software system must not be aware of higher tiers. Try to establish clear data flow patterns in your code.

You have thorough test cases things look good on the UI front. Keep up the good work there!

DukeLogger.logInfo(ProjectInputController.class, "Managing:"
+ projectToManage.getDescription() + ",input:'"
+ projectCommand + "'");
if (projectCommand.length() == 4 && ("exit").equals(projectCommand.substring(0, 4))) {

Choose a reason for hiding this comment

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

Any particular reason why we're checking for command length?

Copy link
Author

Choose a reason for hiding this comment

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

Understooded

src/main/java/views/CLIView.java Outdated Show resolved Hide resolved
* Method called when users wishes to view all Projects that are currently created or stored.
* @param allProjects List of Projects returned to View model by the Controller from the Repository
*/
public void viewAllProjects(ArrayList<Project> allProjects) {

Choose a reason for hiding this comment

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

Do you think this class is overloaded with functionality here? Business logic (such as these functions) should be placed in a more appropriate package. Think of a way to separate these concerns.

This is class is not only dealing with I/O, but also core business logic.

case "bye":
consoleView.end();
break;
case "list":

Choose a reason for hiding this comment

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

Such back and forth calling is not the most elegant way approach this problem. Consider having dedicated controllers for business logic related calls.

public ConsoleInputController(CLIView view) {
this.consoleView = view;
loadProjectsData();
this.projectInputController = new ProjectInputController(this.consoleView, this.projectRepository);

Choose a reason for hiding this comment

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

Think of better ways to pass data up or down. ProjectInputController should not be aware of CLIView. They are separate concerns and should be clearly divided.

In fact, if ConsoleInputController and ProjectInputController are implementing the same interface, they should be at the same level of abstraction.

import java.util.Scanner;

public class ProjectInputController implements IController {
private Scanner manageProjectInput;

Choose a reason for hiding this comment

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

Consider handling all input at one layer (say CLIView), rather than delegating that responsibility to the controller. Think of a generic 'parser' that carries out high level parsing, and hands over the options/subcommand stuff over to the controller to deal with.

Copy link
Author

@Lucria Lucria Oct 22, 2019

Choose a reason for hiding this comment

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

Hmm, in that case, will this be a more elegant approach?
View -> Parser (Helper module) -> Controllers
With this flow, Parser will take in a Data model of String and return (perhaps) two things to the Controller: the command called and the subcommand/options

The controller relied on the very first word read in to detect the relevant command called by the user. We initially believed that the controller will do some input cleaning before calling the relevant classes for each command.
Moreover, when modifying things related to a Project, we thought of using a separate Controller to handle commands relevant at that 'instance' of program runtime. If we handled all inputs at one layer, it will result in a cluttered Controller so we decided to abstract it to two Controllers. Is this approach bad?

Sorry for the trouble! @akshayeshenoi

Choose a reason for hiding this comment

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

Hmm, in that case, will this be a more elegant approach?
View -> Parser (Helper module) -> Controllers
With this flow, Parser will take in a Data model of String and return (perhaps) two things to the Controller: the command called and the subcommand/options

Yes, this sounds much cleaner. It's okay to split up your controllers based on similar functionalities. The controllers can be free to do what they want with the 'parsed' object.

Copy link
Author

Choose a reason for hiding this comment

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

Understood! Thank you!

IMember newMember = memberFactory.create(memberDetails);
if (newMember.getName() != null) {
projectToManage.addMember((Member) newMember);
consoleView.addMember(projectToManage, newMember.getDetails());

Choose a reason for hiding this comment

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

The lower level tiers must not be aware of higher level tiers (remember n-tier architecture?). The view should 'ask' for data and get a 'response' in return.

Try to enforce that pattern.

src/main/java/controllers/ConsoleInputController.java Outdated Show resolved Hide resolved
sinteary and others added 29 commits November 11, 2019 21:37
[CS2113]-sinteary-UpdateUGDG
# Conflicts:
#	docs/DeveloperGuide.adoc
#	docs/images/sequenceDiagram/ViewReminders_Sequence.png
[CS2113-T13-1]-iamabhishek98-UpdatedHelpCommand
[CS2113-T13-1]-Lucria-UpdatedUserGuide
[CS2113-T13-1]-seanlimhx-UpdateDG
[CS2113-T13-1]-seanlimhx-UpdateDG
[CS2113-T13-1]-iamabhishek98-UpdatedUGScreenshots
[CS2113-T13-1]-iamabhishek98-UGFixTypo
nishanthelango pushed a commit to nishanthelango/Duchess that referenced this pull request Nov 23, 2021
* test

* test

* test

* test

* test

* test

* test

* image

* image

* image

* image

* update

* update

* update

* update

* update

* update

* refactor Schedule to TimeFrame

* Add implements Comparable<TimeFrame>

* 092919 ui fix (nusCS2113-AY1920S1#2)

* udate

* udate

* refactor Schedule to TimeFrame

* update

* update

* update change in schedule command

* fix merge conflict and bug

* minor code change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants