Software

Separation of Concerns

Separation of Concerns principle helps to create flexible, reusable and maintainable software systems. But it is an ongoing process throughout the design process.

Concern it is anything that matters in providing a solution to a problem. Some of the concerns in software may involve:

  • What information the implementation represents.
  • What it manipulates.
  • What gets presented at the end.

Example with SmartPhone, let’s say we have the next class:

Continue reading “Separation of Concerns”
Software

Coupling and Cohesion

Coupling and cohesion are metrics to evaluate design complexity.

These metrics helps to achieve a more manageable system.

Coupling

Coupling focuses on complexity between a module and other modules. If your module is highly reliant on other modules, then this module is tightly coupled to others (puzzle). If your module finds it easy to connect to other modules, this module is loosely coupled to others (Lego).

Coupling.png
Coupling

When evaluating the coupling of a module, you need to consider degree, ease and flexibility.

Continue reading “Coupling and Cohesion”
Software

UML Class Diagram of a car rental company

Car Rental Company UML class diagram.png

This example has the next 4 entities:

  1. Car Rental Company: company itself, which is the “whole“.
  2. Car: cars owned by the company.
  3. Rental: rental entity (like contract), which is the “whole” for Car and Renter entities.
  4. Renter: a person who rent car.

All of the connections are composition. The system has the next generalization connections:

  • Car Rental Company Car: the company can have 0 or many cars; a car can have only 1 company.
  • Car Rental Company – Rental: the company can have 0 or many rentals; a renal can have only 1 company.
  • Car Rental Company – Renter: the company can have 0 or many renters; a renter assigned only o 1 company.
  • Rental – Car: 1 rental can be assigned to 1 car and vise versa.
  • Rental – Renter: each rental can have only 1 renter but a renter can have 0 or many rental.