Monday, February 8, 2021

Clean Architecture in Math

What is software architecture?

Architecture is more like the decisions you wish you could get right early in a project.


What is a clean software architecture?

An architecture made by full of good decisions. As:

CA = cleanness of architecture

GD = number of good decisions

AD = number of all decisions


CA = GD / AD

 


What is a good decision?

A good decision allows future changes to become easier. As:

F = number of future changes

LE = low-effort changes

ME = middel-effort changes

HE = high-effort changes

EHE = extramely-high-effort chagnes


F = LE + ME + HE + EHE

CA = GD / AD = (10 * LE + 5 * ME + 2 * HE) / (10 * F)

 


How do we measure effort?

Effort depends on the complexity of the target systems and parties (teams, domains, verticals) involved. As:

C = Complexity of a system

T = number of teams involved

D = number of domains involved

V = number of verticals involved

E = total effort


E = (C1 + C2 + ... + Cn) + (T - 1) + 10 * (D - 1) + 100 * (V - 1)


LE = count(0 < E <= 10)

ME = count(10 < E <= 30)

HE = count(30 < E <= 100)

EHE = count(E > 100)

 


How do we measure complexity?

I use an extremely simplified version here for easy understanding.

Complexity is exponential to the number of requirements in a system. As:

C = complexity

R = number of requirement

P = complex constant (about 0.0004 depends on languages)


C = P * R * R

Assume all the systems adopt continuous deployment.


Conclusion:

CA = (10 * count(0 < E <= 10) + 5 * count(10 < E <= 30) + 2 * count(30 < E <= 100)) / (10 * F)

F is decided by the business which is decided by the market. It’s not changeable.

So clean architecture is trying to do the following things:

  1. Maintain a system in a proper size by limiting the number of requirements supported.
  2. Analise potential future changes to predict future changes
  3. Reduce the impact of future changes as much as possible
  4. Choose the options which support above


References:


No comments:

Post a Comment