Metaprogramovanie / Architektúra

Sergej Chodarev

Metaprogramovanie 4

Architektúra

Sergej Chodarev

Architektúra softvéru

The important decisions that a Software Architect makes are the ones that allow you to NOT make the decisions about the database, and the webserver, and the frameworks.

Uncle Bob

SOLID

Single Responsibility Principle

A module should have one, and only one, reason to change.

A module should be responsible to one, and only one, actor.

Single Responsibility Principle

A module should be responsible to one, and only one, actor.

Open-Closed Principle

A software artifact should be open for extension but closed for modification.

Liskov Substitution Principle

Subtype Requirement: Let $\phi (x)$ be a property provable about objects $x$ of type $T$. Then $\phi (y)$ should be true for objects $y$ of type $S$ where $S$ is a subtype of $T$.

– Barbara Liskov

Interface Segregation Principle

Dependency Inversion Principle

  1. High-level modules should not import anything from low-level modules. Both should depend on abstractions (e.g., interfaces).
  2. Abstractions should not depend on details. Details (concrete implementations) should depend on abstractions.
The clean architecture diagram

Dependency Injection

Spring

Spring Framework

Príklad

Dependency Injection

Príklad závislosti

Kód

https://git.kpi.fei.tuke.sk/meta/examples/spring-di

Spring Data

Spring Data

Príklad

Kód

https://git.kpi.fei.tuke.sk/meta/examples/spring-data

Je reflexia pomalá?

Vyskúšajme!

Kód

https://git.kpi.fei.tuke.sk/meta/examples/reflection-performance