Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

High-quality Classes Homework

Task 1. Good Abstraction

  • Take the VS solution Abstraction and refactor its code to provide good abstraction.
    • Move the properties and methods from the class Figure to their correct place.
    • Move the common methods to the base class's interface.
    • Remove all duplicated code (properties / methods / other code).

Task 2. Good Encapsulation

  • Establish good encapsulation in the classes from the VS solution Abstraction.
    • Ensure that incorrect values cannot be assigned in the internal state of the classes.

Task 3. Cohesion and Coupling

  • Take the VS solution Cohesion-and-Coupling and refactor its code to follow the principles of good abstraction, loose coupling and strong cohesion.
    • Split the class Utils to other classes that have strong cohesion and are loosely coupled internally.

Task 4. Inheritance and Polymorphism

  • Redesign the classes and refactor the code from the solution Inheritance-and-Polymorphism to follow the best practices in high-quality classes.
    • Extract abstract base class and move all common properties in it.
    • Encapsulate the fields and make sure required fields are not left without a value.
    • Reuse the repeating code though base methods.
You can’t perform that action at this time.