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

[Vanessa] iP #314

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

Conversation

vanessaxuuan
Copy link

@vanessaxuuan vanessaxuuan commented Feb 1, 2022

GARY

"Get busy living or get busy dying." - Stephen King source

Gary frees your mind of having to remember things you need to do. It's,

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

All you need to do is,

  1. download it from here.
  2. double-click it.
  3. add your tasks.
  4. let it manage your tasks for you 😉

And it is FREE!

Features:

  • Managing tasks
  • Managing deadlines (coming soon)
  • Reminders (coming soon)

If you Java programmer, you can use it to practice Java too. Here's the main method:

public class Main {
    public static void main(String[] args) {
        new Gary("./filepath).run();
    }
}

Copy link

@jaysmyname jaysmyname left a comment

Choose a reason for hiding this comment

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

Overall good coding standard practices!
Just remember to import classes explicitly instead of using *

@@ -0,0 +1,98 @@
import java.sql.Array;
import java.util.*;

Choose a reason for hiding this comment

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

Shouldn't imported classes be listed explicitly?

System.out.println("Bye, hope you stay productive!\n");
}

public static void printList(int type, ArrayList<Task> item) {

Choose a reason for hiding this comment

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

Perhaps the variable name should be in plural form for ArrayList?

@@ -0,0 +1,25 @@
import java.util.*;

Choose a reason for hiding this comment

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

Shouldn't imported classes be listed explicitly?

Comment on lines 17 to 26
} else if (nxt.equals("mark")) {
System.out.println("which tasks have you completed? e.g. 2 3");
String nums = sc.nextLine();
String[] first = nums.split(" ");
int i = 0;
for (String str : first) {
items.get(Integer.parseInt(first[i]) - 1).toMark();
i++;
}
Gary.printList(2, items);

Choose a reason for hiding this comment

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

I like that you enabled multi-step commands!

Copy link

@jetrz jetrz left a comment

Choose a reason for hiding this comment

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

Generally well written code! Minor nitpicks on documentation, but otherwise code implements OOP concepts effectively, and is clean and readable!

@@ -0,0 +1,13 @@
public class Deadlines extends Task {
String date;
Copy link

Choose a reason for hiding this comment

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

It would be good to have an access modifier for these fields. Same comment for Event.

Comment on lines 15 to 83
if (nxt.equals("list")) {
Gary.printList(1, items);
} else if (nxt.equals("mark")) {
System.out.println("which tasks have you completed? e.g. 2 3");
String nums = sc.nextLine();
String[] first = nums.split(" ");
int i = 0;
for (String str : first) {
items.get(Integer.parseInt(first[i]) - 1).toMark();
i++;
}
Gary.printList(2, items);

} else if (nxt.equals("unmark")) {
System.out.println("made some mistakes?");
String nums = sc.nextLine();
String[] first = nums.split(" ");
int k = 0;
for (String str : first) {
items.get(Integer.parseInt(first[k]) - 1).toUnmark();
k++;
}
} else if (nxt.equals("delete")) {
System.out.println("Please key in what you would like to remove in descending order!");
try {
String nums = sc.nextLine();
String[] first = nums.split(" ");
int k = 0;
for (String str : first) {
items.remove(Integer.parseInt(first[k]) - 1);
k++;
}
Gary.printList(2, items);
} catch (IndexOutOfBoundsException e) {
System.out.println("Ah please enter a valid number or sequence e.g. 5 3 1");
}

} else {
String[] type = nxt.split(" ");
String theTask = type[0];
try {
if (!theTask.equals("todo") && !theTask.equals("event") && !theTask.equals("deadline")) {
throw new GaryException(nxt); // invalid input
}
} catch (GaryException e) {
e.GaryError();
}

try {
switch (theTask) {
case "todo":
items.add(new ToDo(nxt.substring(5)));
break;
case "event":
String[] e = nxt.split("/", 5);
items.add(new Event(e[0].substring(6), e[1]));
break;
case "deadline":
String[] d = nxt.split("/", 5);
items.add(new Deadlines(d[0].substring(9), d[1]));
break;
}
} catch (StringIndexOutOfBoundsException e) {
System.out.println("Ah please enter a valid description e.g. task_type name / date");
}
}
nxt = sc.nextLine(); // continue getting inputs
}
System.out.println("Bye, hope you stay productive!\n");
Copy link

Choose a reason for hiding this comment

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

Parser is clean and easy to understand!

Comment on lines 21 to 24
public String toString() {
String done = this.isDone ? "X" : " ";
return "[" + done + "] " + this.task;
}
Copy link

Choose a reason for hiding this comment

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

toString is abstracted well for Task and its children classes!

Comment on lines 1 to 14
public class GaryException extends Exception {
// represent exceptions specific to Gary
// int err;
String msg;

public GaryException(String msg) {
// this.err = err;
this.msg = msg;
}

public void GaryError() {
System.out.printf("Sorry, what is %s ?\n", this.msg);
}
}
Copy link

Choose a reason for hiding this comment

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

Would be useful to add javadocs documentation for custom exceptions!

vanessaxuuan and others added 23 commits February 21, 2022 02:01
Group classes into packages base on their functionalities for easier management.

Let's move related classes into packages such as,
* gary.task
* gary.ui
* gary.gui
* gary.exception
Standardise code naming, layout, statements and comments

Add relative file path that works on both Unix and Windows
Add assert features to document important assumptions
* 'master' of https://github.com/vanessaxuuan/ip:
  Add assert features to document important assumptions
Let's,
* Change display images
* Add welcome message
* branch-better-GUI:
  Finalize GUI
fit-for-purpose
* 'master' of https://github.com/vanessaxuuan/ip:
  Update README.md
  Update README.md
  Update README.md
  Update README.md
  Update README.md
  Update User Guide
  Update README.md
  Add User Guide
  Add a representative screenshot of Gary
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.

3 participants