Professional Documents
Culture Documents
8 - P2 - Design Principles - 24112022
8 - P2 - Design Principles - 24112022
Methodological
Technical Competence Process Competence
Competence
T1: Automotive Basics (Sensor,
SW, Mobility Solution) P1: Requirements Engineering
M1: SW Development Lifecycle
This slide is a part of BGSV Embedded Academy (BEA) program and only used for
BEA training purposes.
This slide is Bosch Global Software Technology Company Limited’s internal property.
All rights reserved, also regarding any disposal, exploitation, reproduction, editing,
distribution as well as in the event of applications for industrial property rights.
This slide has some copyright images and text, which belong to the respective
organizations.
P2
Design Principles
Trainer Profile
➢ Email: Luynh.PhanHoaiVu@vn.bosch.com
✓ Home Appliances.
Software Design Principles are not hard rules that are fulfilled or not fulfilled
Software Design Principles are not hard rules that are fulfilled or not fulfilled
The selected set of design principles form a mindset for architectural and detailed design work
Design Principles
What are Software Design Principles?
As any principle Software Design Principles are kind of universal
i.e. unlike patterns they do not provide a solution for a concrete task or problem
The selected set of design principles form a mindset for architectural and detailed design work
Design Principles
What are Software Design Principles good for?
Design principles lead to Conceptual integrity
This is essential to understand complex systems
"SOLID" is a set of principles commonly applied in (but not restricted to) OOP development
❑ Single responsibility –> Closely related to separation of concerns
❑ Open/closed principle –> next slides
❑ Liskov substitution principle –> Objects of a superclass shall be replaceable with objects of its subclasses without breaking
the application. That requires the objects of your subclasses to behave in the same way as the
objects of your superclass
❑ Interface Segregation –> Keep interfaces as small as possible; provide specific interfaces for different counterparts
❑ Dependency inversion –> next slides
Selected List of Design Principles
Separation of Concerns (SoC)
What it means
Different elements of the task shall be represented in different elements of the
solution
Each SW component has a single dedicated responsibility
Why
Why itit’s useful
is usef
No hidden functionality
Maintenance
‒ Parts that must be modified because of a change
✓
are only concerned with exactly the changed functionality
Less test effort
Example
Example
Layer concept of SW reference architecture
Selected List of Design Principles
Separation of Concerns
Example: Layered SW-Architecture (Strict Layering)
Characteristics:
‒ Each SW component is dedicated to a specific
layer
‒ Layer crossing SW components are not allowed
‒ Clear responsibilities of each layer
‒ Clear call restrictions between layers
Examples
Examples
Examples:
Helicopter can never replace a Car
Selected List of Design Principles
Liskov's Substitution Principle
Example: Liskov substitution principle
SaleEmployee
drive from 02
interfaces
Selected List of Design Principles
Interface Segregation Principle
What
What ititmeans:
means
Clients should not be forced to depend upon interfaces that they do not use
Examples
Examples:
ATM Heirarchy
Selected List of Design Principles
Dependency Inversion
What
What ititmeans:
means
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.
Whyisit’s
Why useful
it useful?
Upper layer module needs not be changed when lower level
module is changed as they both depend on the same abstraction
(implementation-independent interface definition) Interface
Inversion
Examples:of Control (IoC)
IoC is design pattern for implementation of Dependency inversion principle
Dependency
Injection
DI is the design pattern(DI)
for implementation of Dependency inversion principle. It is a subtype of
IoC
Selected List of Design Principles High level employeeManager class
completely depends on SalePerson class.
Dependency Inversion With dependency inversion these highly
Example: Inversion of control dependable class should be removed.
One interface is introduced for high
Selected List of Design Principles level class to communicate with low
Dependency Inversion level classes which have detailed
implementation
Example: Inversion of control
Now it is pretty easy
Selected List of Design Principles for the client to use
Dependency Inversion these classes
Example: Inversion of control
Communication interface
SalePerson instance is created in the
Selected List of Design Principles constructor and cannot be change at
Dependency Inversion runtime
Example: Dependency injection
40
High Level and Low Level Design
Low Level Design
Static Design
Dynamic Design
Tools
Enterprise Architect
Rhapsody
Microsoft Visio
Draw.io
PowerPoint
OBSERVANCE
Observance Of Design Principles
They motivate the strategic approach for the design of a software system
They can support business goals and identified quality goals (architectural drivers)
48