In this project, we bring together everything you've learned in the previous two projects to independently design and implement a shape management system using Object-Oriented Programming (OOP). This initiative is aimed at deepening your understanding of OOP concepts such as inheritance, polymorphism, generalisation, and encapsulation. You will apply these principles to create a modular and scalable system that manages various geometric shapes. By handling this project more independently, you'll test your ability to design and develop complex software solutions, showcasing your proficiency in using OOP to structure and solve software challenges effectively.
For this task we will look at combining the "Requirements Definition" and "Determining Specifications" steps. Remember the former is "what" and the latter is "how", so we will create a table that represents this. Listen to Wade below, he has a program he wants you to build. If you're still not sure afterwards, you can chat with him using the chatbot below.
📖 Afterwards, write down at least five requirements into your workbook, in plain-English, that you think Wade wants you to include in the program. These should be ordered from highest priority (essential features) to lowest priority (nice to haves).
In the second column (specifications), write down how you think you will implement those requirements.
📖 In your workbook, create a base class Shape with attributes and methods common to all shapes you'll include.
📖 In your workbook, develop a few specific shape classes that inherit from Shape and add unique attributes or methods.
📖 In your workbook, design how these shapes will implement or override methods, such as calculating area or perimeter, differently.
Accept this Assignment: Project 11 - Shapes and Geometry
Write your code with attention to the OOP design principles you've learned in the past two projects:
Classes
Objects
Attributes
Methods
Generalisation
Inheritance
Polymorphism
Testing is an essential phase where you'll ensure that each part of your program works correctly and that the system as a whole meets the requirements. Here's how you can approach it:
Start by testing each class individually. For your shapes, this means ensuring that the area and perimeter calculations are accurate for every type. Create a set of test cases that cover normal values, boundary conditions, and incorrect inputs to check how the system behaves. For example:
For a Circle class, if you input a radius of 0, the area should also be 0.
For a Rectangle class, verify that the area calculation is correct by comparing the output of your method with the expected result of length * width.
Once your individual units are tested, you need to test how they integrate and function together. This is known as system testing. Here, you'll run scenarios that a user might perform, like creating multiple shapes, viewing their details, and comparing two shapes. This is essentially testing that your 'whole program' functions correctly - your menu system, a ShapeManager class if you made one etc...
Example Test Scenarios:
Creating a shape using the interface and verifying that all attributes are set correctly.
Updating the attributes of a shape and ensuring the changes are reflected in the calculations.
Comparing two shapes to determine which has the larger area and verifying that the system reports it accurately.
Maintenance is a critical part of software development that involves ensuring the software continues to operate correctly over time and is understandable to others or your future self. Here are three key practices that you should implement during this program:
Commit your changes to the repository after every significant update or at the end of each work session. Each commit should have a clear, concise message that describes what was changed and why
Use comments to explain the purpose of complex code blocks, the reasoning behind critical decisions, and the functionality of methods and classes. Comments should be concise and relevant
Use clear, descriptive names for all methods, classes, and attributes. Choose names that reflect the role and functionality of each element. Avoid generic names like data or info, and instead use names that describe what the data or method pertains to.
I encourage you to use this multiple times to get feedback on how you can improve the program.Â