Class Design
Following are the important concepts to know about class design:
- Operations, parameters, attributes etc use the programming language syntax that has been selected for implementation.
- Visibility of attributes and operations are specified using the keywords of the selected programming language (If it is Java; public, protected, private are used)
- The relationships between design classes have meaning when it is implemented. Egs: Generalization becomes inheritance in the programming language. Associations and aggregations often maps to variables of classes in the implementation phase. This provides references among objects.
- A design class can represent an interface if the programming language supports it.
A class interface is the list of operations that is provided by the class to its clients.
Note: This is different from interface that specifies a contract that must be implemented by a class when it extends (implements) the interface.
When we identify the operations the resulting set of operations may not be sufficient for other applications. This is due to our use case driven development process. Since our use cases are specific to the application under development. It may not require certain operations that might be required in other applications.
Use case driven approach results in minimal set of operations for a class. At the end of the project, there can be a separate phase allocated for looking for objects that can be reused. This topic is beyond the scope of the exam.
Before we discuss the various techniques to find operations, we must keep in mind that the discovery of operations is done during the design phase. Therefore, we must communicate with the stakeholders and ask them if they need this functionality. If they had overlooked or could not foresee the need this requirement then we need to update other artifacts such as use cases, design class diagram and anything else that might be affected. If it is not required then we can discard this operation. Of course no update would be needed in that case.
Design of operations depends on the trade-off priorities dictated by the requirements. Some of the factors involved during this trade-off are: memory usage, efficiency, re-usability, maintainability etc.