Architectural Design Styles and Inheritance
Architectural Design Styles and Inheritance
The software needs the architectural design to represents the design of software. IEEE defines
architectural design as “the process of defining a collection of hardware and software components and
their interfaces to establish the framework for the development of a computer system.” Each style will
describe a system category that consists of :
● A set of components(eg: a database, computational modules) that will perform a function required by
the system.
● The set of connectors will help in coordination, communication, and cooperation between the
components.
● Conditions that how components can be integrated to form the system.
● Semantic models that help the designer to understand the overall properties of the system.
The use of architectural styles is to establish a structure for all the components of the system.
Taxonomy of Architectural styles:
● This kind of architecture is used when input data is transformed into output data through a series of
computational manipulative components.
● Each filter will work independently and is designed to take data input of a certain form and produces
data output to the next filter of a specified form. The filters don’t require any knowledge of the
working of neighboring filters.
Data Flow architecture
3] Call and Return architectures: It is used to create a program that is easy to scale and modify.
Many sub-styles exist within this category. Two of them are explained below.
4] Object Oriented architecture: The components of a system encapsulate data and the operations
that must be applied to manipulate the data. The coordination and communication between the
components are established via the message passing.
5] Layered architecture:
Layered architecture:
Ensuring consistency in inheritance is important in software engineering to maintain a clear and reliable
class hierarchy. Consistent inheritance promotes code readability, maintainability, and reduces the
likelihood of errors. Here are some strategies to make inheritance more consistent:
Liskov Substitution Principle (LSP): Derived classes should be substitutable for their base classes
without affecting program correctness. Make sure derived classes adhere to the contracts established by
their base classes.
Single Responsibility Principle (SRP): Each class should have a single responsibility. This helps in
creating focused and cohesive classes in the inheritance hierarchy.
Clearly Define Class Responsibilities: Clearly define the responsibilities of each class in the inheritance
hierarchy. This ensures that each class has a well-defined purpose and scope.
Use Inheritance for "Is-A" Relationships: Inheritance should represent an "is-a" relationship. If a
derived class doesn't meet this criterion, consider alternative approaches like composition or interfaces.
Avoid Deep Inheritance Hierarchies: Limit the depth of the inheritance hierarchy to avoid unnecessary
complexity. Deep hierarchies can lead to maintenance challenges and hinder code readability.
Design for Extensibility: Design classes and interfaces with extensibility in mind. Use abstract classes,
interfaces, or other mechanisms to allow for easy extension without modifying existing code.
Document Inheritance Relationships: Clearly document the relationships between base and derived
classes. Explain the purpose of the inheritance and any specific behaviors that derived classes should
implement or override.
Avoid Code Duplication: Eliminate unnecessary code duplication by placing shared functionality in
appropriate base classes. This ensures that common behaviour is consistently applied across derived
classes.
Test Thoroughly: Conduct comprehensive testing, including unit tests and integration tests, to ensure
that the inheritance hierarchy behaves as expected. Pay attention to edge cases and scenarios involving
polymorphism.
Use Design Patterns Wisely: Employ design patterns, such as the Template Method Pattern or Strategy
Pattern, to enhance consistency and flexibility in the inheritance hierarchy. However, use them
judiciously and only when they make sense for your specific use case.
Refactor When Necessary:If inconsistencies are identified or if the requirements change, be prepared to
refactor the inheritance hierarchy. Refactoring helps maintain a clean and consistent codebase.