A component is a coherent package of software that can be independently developed and delivered as a unit.
Main goal: improve cohesion and reduce coupling
Gerson Sunyé gerson.sunye@univ-nantes.fr
Preliminary Design is the first step of software design.
During this phase, a high-level design concept that meets the requirement specification is created.
The concept is expressed as a set of components (or subsystems) with clear interfaces.
An interface is a set of Operations that are provided (implemented) by a component.
It may represent different things:
An Interface in Java, Go, Swift, Python, etc.
A REST API
A GraphQL API
A (Web)Socket protocol
Establish the system boundaries
Define what the system will and will not do
Define system and component interfaces.
Define component scope and responsibilities.
Specify desired component operations (its functionalities).
validating movements?
keeping information about the game board?
rolling dices?
Component Diagram, representing the system divided in subsystems/components
Precise specification of interfaces:
Operations, their signatures, and their pre and post conditions.
Interaction diagrams:
Sequence or Collaboration diagrams used to validate and improve the interfaces
State Machine diagrams.
A component is a coherent package of software that can be independently developed and delivered as a unit.
Main goal: improve cohesion and reduce coupling

Provided services:
the functionalities it implements
Services expected from other components:
the functionalities it uses
Components use these interfaces and only these interfaces to communicate with each other.

Components can be combined with other components to provide and use services.
Components are substitutable: one component can replace another at design time or at runtime, if the successor component meets the requirements of the initial one.
A port represents an interaction point between a component and its environment.
The nature of the interactions is specified by interfaces.

Reusability and reliability.
Maintainability, modularity, testability, flexibility, extensibility.
Portability.
Adopt the domain model as the initial class model.
Define the boundaries:
consider the system as a single component
specify the system behavior that would meet the requirements.
Decompose components recursively:
approaches: structural and behavioral
Add technical components (database, user interface, middleware, etc.).
Use interactions to validate component interfaces.
Use state machines to specify classes.
1-1 correspondence often not possible *
A model that gives the best most adapted solution is often different from one that clearly explains what the object does.
The domain model is the most important part of the system
It contains the domain entities and rules
Typical components: Presentation, Persistence, Network, etc.
Component GUI implements a Web UI using the Angular framework and communicates using WebSockets.
Weaknesses: hard to test, technology dependent.
Applying the Humble Object Pattern[1]
Applying the Single Responsibility principle[1]
Applying the Single Responsibility principle (again)
Weaknesses: only one interface for different usages
Applying the Interface Segregation Principle[1]
Consequences: content coupling () between the clients and the Risk Server component.
Consequences: data coupling (), but worse performance
Consequences: trade-off between couping and performance. Stamp coupling ().
One attribute → One operation
Affected quality factors: performance, maintainability, evolutivity, testability.
One class → One operation
Affected quality factors: performance, maintainability, evolutivity, testability.
One class → One operation
Affected quality factors: performance, maintainability, evolutivity, testability.
Several classes → One operation
| The operations promote errors related to parameter inversion |
| The use of basic types allows value validation before calling the operation. However, the clients must know basic types. |
modifyPlayer(id:String, name:String, phone: String)
pre: name.size() > 0 and (...)
pre: name.notEmpty() and (...)
pre: self.players->exists(id = id) and (...)Using Interaction Diagrams
It’s hard to find the adequate partitioning at first time.
Design experience is required.
Interfaces should be designed to be stable.