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

[Fahim Tajwar] iP #377

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

Conversation

fahim-tazz
Copy link

@fahim-tazz fahim-tazz commented Feb 1, 2023

DukePro

"Your mind is for having ideas, not storing them." - David Allen

DukePro frees your mind off remembering tasks. It's

  • Text-based
  • easy to learn
  • FAST SUPER FAST to use

And it's free!

All you need to do is:

  1. Download Duke from here.
  2. Go to Terminal and enter the following:
cd ~/Downloads/         #or wherever your .jar file is.
java -jar duke.java
# Enjoy!

Double-clicking the .jar file can corrupt it on MacOS, since MacOS flags it as unsafe.

  1. Add your tasks with commands : todo, deadline andevent.
  2. Mark tasks as done or undone with mark and unmark.
  3. Delete unwanted tasks with delete.
  4. Can't find the task you're looking for? Just use find!
  5. And let Duke handle the rest! :bowtie:

Features:

  • Managing todo-list
  • Managing deadlines
  • Tracking future events
  • Reminders (coming soon)

@fahim-tazz fahim-tazz changed the title Add Week 2 Features [Fahim Tajwar] iP Feb 1, 2023
Copy link

@ajjajjajjajj ajjajjajjajj left a comment

Choose a reason for hiding this comment

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

Good work here, some suggestions for your code:

  • Wildcard imports shouldn't be used, this might've resulted from the default settings in Intellij that auto converts imports into wildcard imports (try disabling it)
  • You might want to implement an symbol attribute to each type of task, rather than hardcoding it into the toString() method. This would also help for the storage requirement, if you want to use the task symbols in the storage format :)
  • A reply(String reply) method in your Duke class can solve the tediousness of having to print the divider line for each output by the chatbot
  • Each case for a switch statement should be on the same indent line as the switch(): statement itself, there's also a setting in Intellij that disables that

Nice job though, I found your code easy to read and understand :)

Copy link

@jedidiahC jedidiahC 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 code seems okay. However, you may want to consider some of Java's coding standards in regards to layout and comments.

ArrayList<Task> tasks = new ArrayList<>();
Scanner sc = new Scanner(System.in);

while(sc.hasNext()) {

Choose a reason for hiding this comment

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

I noticed several Java reserved words such as while in this case not being followed by a white space. e.g.

Suggested change
while(sc.hasNext()) {
while (sc.hasNext()) {

Perhaps you could consider using IntelliJ's code cleanup feature to add these white spaces automatically.

while(sc.hasNext()) {
String instr = sc.nextLine();
switch(instr) { //Single-word instructions
case "list": //List down

Choose a reason for hiding this comment

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

Should indentation for case clauses be removed?

Suggested change
case "list": //List down
case "list":

+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
public static void main(String[] args) {

Choose a reason for hiding this comment

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

Should basic indentation be changed from 2 spaces to 4 spaces to align with the Java coding standard?

Suggested change
public static void main(String[] args) {
public static void main(String[] args) {

Copy link

@arkarsg arkarsg left a comment

Choose a reason for hiding this comment

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

Good start so far. Consider abstracting away with more functions as the code expands with future levels.

ArrayList<Task> tasks = new ArrayList<>();
Scanner sc = new Scanner(System.in);

while(sc.hasNext()) {
Copy link

Choose a reason for hiding this comment

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

Be careful of using sc.hasNext() vs sc.hasNextLine()

System.out.println(divider + "OOPS!!! The description of a " + action + " cannot be empty.\n" + divider);
}

switch(action) { //For instructions with argument(s).
Copy link

Choose a reason for hiding this comment

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

Would recommend against nesting switch-case block for code quality

}
}
Copy link

Choose a reason for hiding this comment

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

A lot of nested blocks. Consider abstracting away with methods within the main class. For example you can have:

// in main
switch(...) {
    case "todo":
        addToDo(tokens);
}

// add implementation
public void addToDo(String[] tokens) {
// your implementation
}

Muhammad Fahim Tajwar and others added 30 commits February 18, 2023 22:51
P.S. Checkstyle violations fixed in previous commits.
Long lists are no longer cut short with "...".
Remove redundant exception class.
Remove dead code.
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