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

[John Benedict] iP #14

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

Conversation

johnbenedictyan
Copy link

@johnbenedictyan johnbenedictyan commented Aug 19, 2022

Aladdin Services

“Your mind is for having ideas, not holding them.” – David Allen (source)

Aladdin frees your mind from 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) {
        Application.launch(MainApp.class, args);
    }
}

damithc and others added 30 commits July 31, 2022 17:20
Implement a skeletal version of Duke that starts by greeting the user, simply echos commands entered by the user, and exits when the user types bye.
Add the ability to store whatever text entered by the user and display them back to the user when requested.
Add the ability to mark tasks as done. Optionally, add the ability to change the status back to not done.
Add support for tracking three types of tasks:
1. ToDos: tasks without any date/time attached to it e.g., visit new theme park
2. Deadlines: tasks that need to be done before a specific date/time e.g., submit report by 11/10/2019 5pm
3. Events: tasks that start at a specific time and ends at a specific time e.g., team project meeting on 2/10/2019 2-4pm
Use the input/output redirection technique to semi-automate the testing of Duke
Teach Duke to deal with errors such as incorrect inputs entered by the user
Use Exceptions to handle errors
Add support for deleting tasks from the list
Use Enumerations
Save the tasks in the hard disk automatically whenever the task list changes. Load the data from the hard disk when Duke starts up.
Teach Duke how to understand dates and times
Automate project builds using Gradle
Divide classes into packages
Refactor the code to extract out closely related code as classes
Add JUnit tests to test the behaviour of the code
Add JUnit tests to test the behaviour of the code
Add JavaDoc comments to the code.
Tweak the code to comply with a coding standard
Give users a way to find a task by searching for a keyword.
Use checkStyle to detect coding style violations.
Add a GUI to Duke. Use the JavaFX technology to implement the GUI.
Use Java varargs feature.
Copy link

@eugenelmj eugenelmj 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 effort to abstract out the classes and obeying the OOP principles! Just take note that the overall readability could be further improved; some indentations are not very consistent and may impede the readability. Also, the JavaDocs tends to be a little verbose; maybe you can use simpler sentences to summarise what the method is achieving. Otherwise, good effort! 😄

* The function returns the result of executing that command.
*
* @param command
* Pass the command object to the run command method

Choose a reason for hiding this comment

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

This line of description should be in line with @param command, otherwise the indentation may look off. :)

Copy link
Author

Choose a reason for hiding this comment

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

Ah thank you, I will take note of this!

* The enum duke.Duke commands.
*/
public enum DukeCommands {
/**

Choose a reason for hiding this comment

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

Perhaps you could remove the individual JavaDocs for every type of commands to reduce the clutter here.

}

/**
* Of deadline.

Choose a reason for hiding this comment

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

Maybe you want to elaborate on what the description "Of deadline" here means? :)

* @throws InvalidTaskSpecificationException
* the invalid task specification exception
*/
public static Task of(

Choose a reason for hiding this comment

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

Some of the indentations in the first part of this method; perhaps you might want to change some of it to improve the readability of the code? Otherwise, it may be mistaken as a form of "Deep Nesting".

Copy link
Author

Choose a reason for hiding this comment

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

I see I will see what I can do

return Objects.hash(super.hashCode(), dateTime);
}

@Override

Choose a reason for hiding this comment

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

Good that you're abiding to the Boolean naming standards here! :)

Copy link
Author

Choose a reason for hiding this comment

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

Thank you!

public List<Task> load(String filePath) {
try {
ensureDataFileExist(filePath);
List<Task> initTask = new ArrayList<>();

Choose a reason for hiding this comment

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

Since this is a list of Task objects, the variable name should be "initTasks" instead. :)

* Filter the tasks that are after a certain date
* @return A string containing the tasks that are after the datetime
*/
public String outputTasksAfterString(LocalDateTime dateTime) {

Choose a reason for hiding this comment

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

Nice use of streams here. Well done!

Copy link

@xhphoong xhphoong left a comment

Choose a reason for hiding this comment

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

Overall, your code is easy to read. Most of your method is short and concise but there are few part where the method is quite long and deeply nested. Perhaps can consider to shorten those method by separating some operation into different method?

*/
public class Duke {

private static final String defaultFilePath = "src/main/java/duke/data/tasks.txt";
Copy link

Choose a reason for hiding this comment

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

Perhaps the naming of this constants should be in all uppercase?

Copy link
Author

Choose a reason for hiding this comment

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

Hmm I see, thank you for pointing this out

Comment on lines 87 to 91
Boolean isEvent = Objects.equals(type, "E");
Boolean isDeadline = Objects.equals(type, "D");
Boolean isTodo = Objects.equals(type, "T");
if (isEvent || isDeadline || isTodo) {
if (isEvent || isDeadline) {
Copy link

Choose a reason for hiding this comment

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

I like you done it in steps, by evaluating the boolean value first then use the evaluated value in the if statement. Avoid complicated expression and easier to read.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you!

* @param userInput
* Get the user input
*/
public BaseCommand parse(String userInput)
Copy link

Choose a reason for hiding this comment

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

Maybe can find a way to shorten this method? eg : put some of the operation in separate method and call it in here?

Copy link
Author

Choose a reason for hiding this comment

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

This is definitely one area of my code that could use refactoring, I will take note of this in the future

Comment on lines 119 to 123
Task newDeadline = Task.of(
"D",
"0",
deadlineTitle,
deadline);
Copy link

Choose a reason for hiding this comment

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

Perhaps put it in the same line to reduce the level of indentation to make it easier to read?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I thought it was easier to read like this but I shall take note

Use assert feature (not JUnit assertions) to document important assumptions that should hold at various points in the code.
Improve code quality
Use Streams
GitHub Actions will run custom workflow every time certain project events are triggered (e.g., when a PR is updated, or the master branch is updated).

This workflow will help to automate mundane task like:
* checking the compilation of the gradle project
* checking the style of the project using checkstyle
Generate javadocs to fulfil checkstyle
Add the sorting feature
Add the ability for the user to ask for help and what commands are available
Updated the ui of the duke bot so that it is more visually pleasing to the users
Updated the command messages so that the duke bot appears more unique and friendly
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