r/Python • u/Corvology • 12h ago
Discussion Python Architecture Design
Robert C. Martin's Abstractness (A), Instability (I), and Distance from the Main Sequence (D) metrics were designed for statically typed OO languages like Java and C#. In Python, applying them literally is misleading because Python has a fundamentally different notion of abstraction and coupling.
is this implementation valid?
https://0x416d6972.github.io/Istos/user-guide/architecture-health/
5
u/SecurityCritical379 12h ago
the metrics still useful if you adapt them, python's dynamism means you gotta think about coupling more in terms of import graphs than formal interfaces
3
u/Beginning-Fruit-1397 10h ago
I think that the comment about learning by doing mistakes is the most solid advice in itself.
However reading your link I found that the metrics and reasoning behind them make senses. As always with everything, adapt it to your specific context. E.g if you are writing a library, let's say a new polars, the file with your dataframe class will obviously be +1000 LOC long.
1
1
u/giovanni_gatto 1h ago
Read the book, and use your mind. Be critical, absorb the useful stuff, forget the rest. As with any book. He has a quite big hater-base that is now trying to undermine his legacy for political reasons. His practical examples are rather useless though, but that does not invalidate the concept. He is probably not coding much nowadays, which is normal for someone in his career stage. Architecture is a language and code independent thing, most of the other authors teach more or less same anyway.
36
u/j0holo 11h ago
Robert C. Martin is somebody that want to sell books. Please do not follow his advise, waste of time and money.
Architecture isn't something that you can apply and suddenly your project is magically good or has less coupling and all the right abstractions. You can't force architecture, you need to learn it.
And you learn by doing and making mistakes.