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

[Izdiyad] iP #184

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Conversation

izdiyadfrhn
Copy link

No description provided.

Copy link

@daknam2001 daknam2001 left a comment

Choose a reason for hiding this comment

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

good job with following coding standards overall!

public class Deadline extends Task {
protected String by;

public Deadline(String description, String by) {

Choose a reason for hiding this comment

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

Well done with naming classes in PascalCase

private static int taskCount;

// prints a string within two horizontal lines, @param is string to be printed
public static void printWithLines(String text) {

Choose a reason for hiding this comment

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

Good job with writing method names in camelCase

String inputCommand = input.trim().split(" ")[0];
String inputData = input.replaceFirst(inputCommand, "").trim();

switch (inputCommand){

Choose a reason for hiding this comment

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

good job with the indentation of switch cases

taskCount++;
}

public static void listTasks() {

Choose a reason for hiding this comment

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

egyptian style brackets used, well done!


public static void addTask(String task) {

if (task.startsWith("todo")) {

Choose a reason for hiding this comment

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

curly braces used for all if-else statements, well done

public class Duke {
public static void main(String[] args) {
private static Task[] tasks;
private static int taskCount;

Choose a reason for hiding this comment

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

variable names are in camelCase, nice job

printWithLines(byeMessage);
}

public static void addTask(String task) {
Copy link

Choose a reason for hiding this comment

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

Add comments on how the method works and explain the parameters


public static void addTask(String task) {

if (task.startsWith("todo")) {
Copy link

Choose a reason for hiding this comment

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

I think can work on the readability of the code by creating a method for each else if statement.

}

public static void selectCommand(String input) {
Copy link

Choose a reason for hiding this comment

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

Recommend to refractor code to include a task manager to handle all the task events instead of all in duke.java

protected String description;
protected boolean isDone;

public Task(String description) {
Copy link

Choose a reason for hiding this comment

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

Good to include comments to explain what Task is

Copy link

@Samuel787 Samuel787 left a comment

Choose a reason for hiding this comment

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

Your code follows good OOP structure. Good code style and quality is mostly observed. LGTM! Good job!

ui.printWithLines(e.getMessage());
}

// Gets the next command entered

Choose a reason for hiding this comment

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

The code is well structured and easy to understand what the code is doing here. Hence, this comment seems redundant. You may want to consider removing it :)

public Command addTask(String input) throws DukeException {

if (input.startsWith(TODO)) {
if (input.substring(4).isEmpty()) {

Choose a reason for hiding this comment

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

4 seems to be a Magic Number

trimInput(input);

} else if (input.startsWith(DEADLINE)) {
if (!input.contains("/by")) {

Choose a reason for hiding this comment

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

You can also consider making "/by" a constant just like DEADLINE

Command commandFromInput = null;

switch (trimmedInput){
case TODO: case DEADLINE: case EVENT:

Choose a reason for hiding this comment

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

When you have multiple cases and you want the control to cascade down, you can still follow the same recommended code style to have each case in a new line.


protected Ui ui;
protected TaskList tasks;
private int targetIndex = -1;

Choose a reason for hiding this comment

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

This private variable is declared in this abstract class but not used. Do you need this variable?

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.

4 participants