Giter VIP home page Giter VIP logo

ip's Introduction

Duke project template

This is a project template for a greenfield Java project. It's named after the Java mascot Duke. Given below are instructions on how to use it.

Setting up in Intellij

Prerequisites: JDK 11, update Intellij to the most recent version.

  1. Open Intellij (if you are not in the welcome screen, click File > Close Project to close the existing project first)
  2. Open the project into Intellij as follows:
    1. Click Open.
    2. Select the project directory, and click OK.
    3. If there are any further prompts, accept the defaults.
  3. Configure the project to use JDK 11 (not other versions) as explained in here.
    In the same dialog, set the Project language level field to the SDK default option.
  4. After that, locate the src/main/java/Duke.java file, right-click it, and choose Run Duke.main() (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
    Hello from
     ____        _        
    |  _ \ _   _| | _____ 
    | | | | | | | |/ / _ \
    | |_| | |_| |   <  __/
    |____/ \__,_|_|\_\___|
    

ip's People

Contributors

polygonalr avatar j-lum avatar damithc avatar jiachen247 avatar

ip's Issues

Sharing iP code quality feedback [for @Polygonalr]

@Polygonalr We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, to help you improve the iP code further.

IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most three example are given i.e., there can be other areas/places to improve.

Aspect: Tab Usage

No easy-to-detect issues ๐Ÿ‘

Aspect: Naming boolean variables/methods

No easy-to-detect issues ๐Ÿ‘

Aspect: Brace Style

No easy-to-detect issues ๐Ÿ‘

Aspect: Package Name Style

No easy-to-detect issues ๐Ÿ‘

Aspect: Class Name Style

No easy-to-detect issues ๐Ÿ‘

Aspect: Dead Code

No easy-to-detect issues ๐Ÿ‘

Aspect: Method Length

Example from src/main/java/duke/Parser.java lines 30-113:

    public static Command parse(String input) throws DukeException {
        String[] inputSplit = input.split(" ");
        switch (inputSplit[0]) {
        case "bye":
            return new ByeCommand();
        case "list":
            return new ListCommand();
        case "mark":
        case "unmark":
            // Error handling
            if (inputSplit.length < 2) {
                throw new DukeException(
                        "You did not specify what task number to mark as done. Unable to mark task.");
            } else if (!isNumeric(inputSplit[1])) {
                throw new DukeException(
                        String.format("Invalid task number provided: %s. Unable to mark task.",
                                inputSplit[1]));
            }
            // Return the command
            return new MarkCommand(Integer.parseInt(inputSplit[1]) - 1,
                    inputSplit[0].equals("mark") ? true : false);
        case "note":
            // Error handling
            if (inputSplit.length < 2) {
                throw new DukeException("Please provide a description for your new note.");
            }
            // Return the command
            return new NoteCommand(input.substring(5));
        case "todo":
            // Error handling
            if (inputSplit.length < 2) {
                throw new DukeException("Please provide a description for your todo.");
            }
            // Return the command
            return new TodoCommand(input.substring(5));
        case "deadline":
        case "event":
            String[] inputSlashSplit = input.split("/");
            // Error handling
            if (inputSlashSplit.length < 2 || inputSlashSplit[1].split(" ").length < 2) {
                throw new DukeException(String.format(
                        "Please specify a time for your %s.", inputSplit[0]));
            }
            if (inputSlashSplit[0].split(" ").length < 2) {
                throw new DukeException(String.format(
                        "Please provide a description for your %s.", inputSplit[0]));
            }
            // Return the commands
            String date = input.split("/")[1];
            String[] description = inputSlashSplit[0].split(" ");
            if (inputSplit[0].equals("deadline")) {
                return new DeadlineCommand(String.join(
                        " ", Arrays.copyOfRange(description, 1, description.length)), date);
            } else {
                return new EventCommand(String.join(
                        " ", Arrays.copyOfRange(description, 1, description.length)), date);
            }
        case "delete":
            ListObject type = ListObject.TASK;
            // Error handling
            if (inputSplit.length < 2) {
                throw new DukeException("You did not specify what number to delete.");
            }
            if (inputSplit[1].startsWith("N")) {
                type = ListObject.NOTE;
                inputSplit[1] = inputSplit[1].substring(1);
            }
            if (!isNumeric(inputSplit[1])) {
                throw new DukeException(String.format(
                        "Invalid %s number provided: %s. Unable to delete %s.", type.label, inputSplit[1], type.label));
            }
            // Return the command
            return new DeleteCommand(type, Integer.parseInt(inputSplit[1]) - 1);
        case "find":
            // Error handling
            if (inputSplit.length < 2) {
                throw new DukeException("Please provide a search term.");
            }
            // Return the command
            return new FindCommand(input.substring(5));
        default:
            throw new DukeException("I'm sorry, but I don't know what that means :-(");
        }
    }

Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods e.g., extract some code blocks into separate methods. You may ignore this suggestion if you think a longer method is justified in a particular case.

Aspect: Class size

No easy-to-detect issues ๐Ÿ‘

Aspect: Header Comments

Example from src/main/java/duke/Duke.java lines 22-26:

    /**
     * Create a new Duke application.
     *
     * @param filePath path to the save file
     */

Example from src/main/java/duke/Duke.java lines 39-41:

    /**
     * Create a new Duke application with the default save file path.
     */

Example from src/main/java/duke/Duke.java lines 46-48:

    /**
     * Run the Duke application in CLI mode.
     */

Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.

Aspect: Recent Git Commit Message (Subject Only)

No easy-to-detect issues ๐Ÿ‘

Aspect: Binary files in repo

No easy-to-detect issues ๐Ÿ‘

โ„น๏ธ The bot account used to post this issue is un-manned. Do not reply to this post (as those replies will not be read). Instead, contact [email protected] if you want to follow up on this post.

Sharing iP code quality feedback [for @Polygonalr] - Round 2

@Polygonalr We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, so that you can avoid similar problems in your tP code (which will be graded more strictly for code quality).

IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most three example are given i.e., there can be other areas/places to improve.

Aspect: Tab Usage

No easy-to-detect issues ๐Ÿ‘

Aspect: Naming boolean variables/methods

No easy-to-detect issues ๐Ÿ‘

Aspect: Brace Style

No easy-to-detect issues ๐Ÿ‘

Aspect: Package Name Style

No easy-to-detect issues ๐Ÿ‘

Aspect: Class Name Style

No easy-to-detect issues ๐Ÿ‘

Aspect: Dead Code

No easy-to-detect issues ๐Ÿ‘

Aspect: Method Length

No easy-to-detect issues ๐Ÿ‘

Aspect: Class size

No easy-to-detect issues ๐Ÿ‘

Aspect: Header Comments

Example from src/main/java/duke/Storage.java lines 22-27:

    /**
     * Create a new Storage object to handle saving and loading of list objects.
     *
     * @param tasksFilePath path to the save file for tasks
     * @param notesFilePath path to the save file for notes
     */

Example from src/main/java/duke/Task.java lines 72-74:

    /**
     * Mark a Task as done.
     */

Example from src/main/java/duke/Task.java lines 79-81:

    /**
     * Mark a Task as undone.
     */

Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.

Aspect: Recent Git Commit Message (Subject Only)

No easy-to-detect issues ๐Ÿ‘

Aspect: Binary files in repo

No easy-to-detect issues ๐Ÿ‘

โ— You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality issues.

โ„น๏ธ The bot account used to post this issue is un-manned. Do not reply to this post (as those replies will not be read). Instead, contact [email protected] if you want to follow up on this post.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.