While designing software architecture, the first question that comes is How to identify a class?
How will you know that a class needs to be created for this type?
A class is the representation of the type of object.
Software architecture has its own Object Oriented Design Principles that you must follow while designing a class. They are SOLID principles
SRP - The Single Responsibility Principle
A class should have only one reason to change.
OCP - The Open Closed Principle
A class needs to be open for extensions but closed for modifications
LSP - The Liskov Substitution Principle
Derived classes must be substitutable for their base classes.
DIP - The Dependency Inversion Principle
Always depend only on abstractions, not on concretions.
ISP - The Interface Segregation Principle
Make fine grained interfaces that are client specific
The following are Tips in Identifying and dealing with classes
1. “Divide and Conquer”
Use module by module approach. First identify the modules. Need to drill down / dig through each module deeply. Analyzing the full system at once and start designing will be problematic and not a good idea. Each module need to be analyzed thoroughly to identify classes
2. “Identify the leaf level operations”
Need to understand and analyze granular use case of the system.
3. “Group Same types in one class”
Group meaningful grouping of a set of operations in each function as class
An ideal class would be re-usable, extensible and maintainable.
4. “Use Oops concepts “
In order to manage classes in the system and reduce complexity involved in the classes (if you have too many classes), Software designer use OOPs techniques like Encapsulation, Abstraction, Inheritance, and Polymorphism to achieve reusability, maintainability and extensibility.
5.” Decide the pattern”
Based on the experience decide when to use what? Usage of proper pattern need to be decided correctly. First design a rough sketch with what is in your mind and think of different alternative ways. Extensibility and in future if another functionality is added it should not affect the existing system.
Think of all these things while deciding the pattern or design of the system. “Do Proper things in a Proper way at Proper time then everything will be Proper”