Starting from:
$35

$29

Assignment 2 Solution

Objectives

    • Practice procedural refactoring.

    • Practice implementing good/quality code.

    • Practice SOLID principles.

Preparation:

Clone the code on the repository https://git.cs.dal.ca/courses/2021-summer/csci-5308/assignment2/ronnie

Problem Statement

You have three main tasks in this assignment:

    • Refactor the code using what you learnt from lectures 6 and 7.

    • Increase code quality using the Java guidelines provided.

    • Refactor the code by applying SOLID principles.

    • Use exceptions wherever is necessary.

Task

    1. [30 marks] Identify three (3) procedural refactoring opportunities that can be done in the code using the guidelines. Provide:

            a) A brief description of each issue that require refactoring

            b) Fix the issue.

            c) Test your fix (when applied).

    2. [60 marks] Identify three (3) refactoring that can be done in the code by applying SOLID Principles. Give:

            a) a brief description of each issue.

            b) where the issue is.

            c) what SOLID principle is violated.

            d) how to fix the issue.

            e) Apply your fix.

            f) Test your fix.

        3. [10 marks] Identify three (3) methods requiring exceptions. Give:

            a) method where exception should be used.

            b) what the exception should be used.

            c) Add the exception to the code.



    4. Push back your work to YOUR remote repository, not to the one that you cloned. Everyone has their own repository to deliver this assignment, e.g., https://git.cs.dal.ca/courses/2021-summer/csci-5308/assignment2/yourscid.

    5. Remember to check that all your files have been submitted using the web interface to git.

Submission

    1. Edit this document with your written answers

    2. All the code (fixed) should be committed and pushed back to your remote Git repository.

Important! Use individual commits to each answer.

Answers

Add your written answers here.

More products