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

[jeff] iP #256

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

[jeff] iP #256

wants to merge 37 commits into from

Conversation

jefrai
Copy link

@jefrai jefrai commented Jan 25, 2023

Project Miki 🎀✨

The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents.

-ef1500

Ogey rrat

P. Usada et al.

Miki frees your mind from its physical locus.
Miki is

  • text-based
  • here
  • transient
  • eternal

All you need to do is:

  1. download from here!
  2. java -jar miki.jar
  3. add your tasks!
  4. ???!
  5. profit!

With Project Miki, you can:

  • Plan your days with Miki!
  • Autorun arbitrary files with Miki! (coming soon (time is subjective))
  • Get berated by Miki! (for poor spelling)
  • Procrastinate on your deadlines with Miki!
  • save her
    @Override
    public void run(TaskList tasks, Ui ui, Storage storage) {
        tasks.add(new Deadline("", LocalDateTime.of(2021, 05, 21, 15, 56, 25)));
        tasks.get(tasks.size() - 1).mark();
    }

ashes to ashes, dust to dust

M. Ueda

@jefrai jefrai force-pushed the master branch 2 times, most recently from 0c30cb7 to a9bbc0c Compare January 26, 2023 14:45
Copy link

@ExtraShotLatte ExtraShotLatte left a comment

Choose a reason for hiding this comment

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

Great personality 👍

LGTM! Great job in following the coding conventions as well!

Comment on lines 1 to 7
import command.Command;
import shigure.Ui;
import storage.Storage;
import task.Parser;
import task.TaskList;

import java.io.IOException;

Choose a reason for hiding this comment

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

Great ordering of import statements!

try {
storage.load("autosave.txt", tasks);
} catch (IOException | Storage.MikiLoadException ex) {

Choose a reason for hiding this comment

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

Would it be better if the user can see that the loading has error?

Copy link
Author

Choose a reason for hiding this comment

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

True - no message is raised if there's no autosave file since that's 'normal' when we're running for the first time,
but now if the file exists but is corrupt there's a new message to alert the user.

Comment on lines 22 to 27
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--ascii-only")) {
hasAsciiOnly = true;
}
if (args[i].equals("--no-autoload")) {
hasNoAutoload = true;

Choose a reason for hiding this comment

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

I really like the feature of no autoloading of task!

Comment on lines 17 to 25
for (int i = 0; i < tasks.size(); i++) {
if (tasks.get(i).hasMatchingObjective(regex)) {
matches++;
}
}
ui.print("here's your " + matches + (matches == 1 ? " match:" : " matches:"));
for (int i = 0; i < tasks.size(); i++) {
if (tasks.get(i).hasMatchingObjective(regex)) {
ui.print(i + 1 + ". " + tasks.get(i));

Choose a reason for hiding this comment

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

Can we run the linear search only once?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, probably a good idea to keep the expensive regexes to a minimum - adjusted accordingly!

}
}
} catch (NumberFormatException | TaskParseException ex) {
throw new MikiLoadException("this file is corrupt...");

Choose a reason for hiding this comment

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

Corrupted instead of corrupt?

Copy link
Author

Choose a reason for hiding this comment

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

👀 Both are grammatical actually, but looks like corrupted is a lot more common when referring to files so switched to that

public static Deadline parseArgs(String[] args) throws TaskParseException {
String objective = "";
String by = "";
boolean isInTokenBy = false;

Choose a reason for hiding this comment

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

Perharps can explain what is the situation that this boolean is used for.

Copy link
Author

Choose a reason for hiding this comment

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

Added a little comment to that line & similar lines elsewhere 👍

Comment on lines +132 to +134
/**
* {@inheritDoc}
*/

Choose a reason for hiding this comment

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

Great use of inheritDoc in here and other parts of the code!

Copy link

@leonpoh leonpoh left a comment

Choose a reason for hiding this comment

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

Looks good a lot of abstraction following single responsibility principle

The previous commit caused non-functional Java Archive files to be
created as the main() method was placed in a class extending JavaFX's
Application.

JAR generation needs to be restored to allow for easier usage of the
project.

Let's rectify JAR generation by moving the main() method into a
different class.
There are portions of code which expect arguments to be non-null, or
call methods which are expected to have certain behaviours.

If these code elements encounter incorrect arguments or method
behaviour, they may throw difficult-to-diagnose Exceptions or fail
silently.

Let's add assertions to these portions of code to make it easier to
diagnose such situations, if they arise due to bugs elsewhere in this
project or in external Java modules.

Using assertions allows a visible and clear error to be thrown when an
unexpected situation arises, with the affected source line indicated and
a relevant message of choice included.
There are sections of code which deviate from code quality guidelines.

This makes the code harder to read and understand, and thus more
difficult to debug.

Let's,
* improve code formatting, spacing and variable naming
* add better comments to less-obvious code actions
* perform method extraction on segments with deep nesting
Refactor sources to code quality guidelines
Add natural language date support
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.

None yet

3 participants