Learning Software Architecture

matklad.github.io

605 points by surprisetalk 5 days ago


CSMastermind - 4 days ago

I'll give you the cheat sheet:

- Good design is a single idea pervaded throughout.

- More generally, your goal should be to minimize surprise.

- If your system allows it, people will do it.

- Everyone will not just. If your solution starts with "if everyone will just..." then you don't have a solution.

- Isolate the parts of your system that transform data from the ones that use it. Data models outlive code.

- Coupling is the root of most evil.

- Versioning is inevitable.

- Make state explicit.

- Every piece of information should have a single source of truth.

- You should spend more time thinking about naming things correctly.

- If testing is difficult, the design is wrong.

- You will regret every undocumented decision.

- Communication is a tax that you should justify before paying it.

Remember that the job of an engineer at any level is to use rules of thumb to solve problems for which there is incomplete information.

mpweiher - 4 days ago

The recommendations are often very good, for example Ousterhouts A Philosophy of Software Design, but seem to be on software development in general, not actually software architecture in particular.

For that, I would recommend the classic texts, such as Software Architecture: Perspectives on an Emerging Discipline (Shaw/Garlan) and really anything you can find by Mary Shaw. Including more recent papers that explore why the field of software architecture did not go the way they foresaw, for example Myths and Mythconceptions: What Does It Mean to Be a Programming Language, Anyhow? or Revisiting Abstractions for Software Architecture and Tools to Support Them

More practically: look at why Unix pipes and filters and REST are successful, and where they fall down and why. Hexagonal architecture is also key.

And a plug for my own contribution, linking software architecture with metaobject protocols as a new foundation for programming languages and programming: Beyond Procedure Calls as Component Glue: Connectors Deserve Metaclass Status. An answer to Mary Shaw's Procedure Calls Are the Assembly Language of Software Interconnection: Connectors Deserve First-Class Status.

Answering the question: if procedure calls are the assembly language, what might a high level language look like? And also maybe that software architecture might have a brighter and more practical future ahead of itself.

deepsun - 4 days ago

The best way to learn architecture is to:

1. Maintain a large enough project. Not create, but support.

2. Do it for at least couple or few projects.

If project is too small, any architecture works fine. "Large" can be in terms of lines of code, but better in terms of people who ever worked on it, or even better -- teams.

At least two different projects is to have something to compare. I've seen people stuck for decades on one project and not knowing any modern ways to solve a problem.

But often the architects who get promoted because they created, not maintained a project. Especially visible in Google, as you don't get promoted for maintaining anything, only for shipping something new (and better jumping off as soon as possible afterwards).

Counterintuitively, people in the best position to be architects are actually side contractors from head shops, who get invited to maintain an existing project no one from a company is willing to (as they all jumped off where promotions go). First, they have to maintain an architecture, and second they did it on several projects, so can compare. The downside though, is if they bill by the hour, the tend to over-complicate architecture to bill more hours.

miki123211 - 4 days ago

In this vein, I really recommend "Architecture of Open Source Applications."[1] It's a book series where you learn architecture by example, with each chapter written by a maintainer of the project in question. This lets you learn not only what the architecture is, but what are the constraints that shaped it, usually history and changing project visions.

Not all chapters are equally good or equally interesting, that's the curse of a multi-author book, and all of them are dated, but I think the book is worth reading nonetheless.

[1] http://aosabook.org/

ah1508 - 4 days ago

I think that words like "clean code" or "beautiful code" does help juniors to learn best practices of software architecture.

  - Junior asks to senior: what did you we use an ORM ?
  - senior answers: because it's cleaner.
  - junior: ???
I prefer when people are able to define a clear list of objectives:

  - maintenable;
  - performant, scalable;
  - efficient;
  - resilient;
  - observable;
  - testable (and tested);
  - secured;
  - readable for new devs that come on board.
Each criteria balance the others, and the more we add criteria the more it helps to make good choice when we hesitate. It is also meaningful for people outside of the dev team, we can reach an agreement with the customer so he knows what he pays for.

"maintenable" can be also defined, since a project is mostly in maintenance mode during its lifetime (which means the project is successful, which is good !). The ability to incorporate new features without breaking architecture or even without breaking a single method signature is a good starting point.

Being super careful with abstractions. Here someone wrote something like that: "abstraction often hides how what you want is simple". True, ORM I am looking at you. In most case data should be threaten as first class citizen, it also fosters good collaboration with the DBA.

Thinking beyond "the happy path" without falling in premature optimization is also a challenge. A nice one, once again to it avoids to go head first in implementing a good idea without considering drawbacks.

I also tend to imagine that the one that will work on my code had a very bad day so it must be pleasant to read what I wrote. Comments here and there, locale variable here and there even if they can be avoided, variable naming, etc...

Being selective about frameworks. They are good servant but bad leaders. "Be an engineer, not a frameworker" says an article.

npl - 4 days ago

I think there is huge space for architecture case studies that help a non coder learn how to critique llm architecture decisions.

I’m a NP - lots of learning came in clinical rotations where you see real life situations and how they are addressed. I want something like this for software architecture.

The closest I’ve seen is the open source case study books referenced previously but these are older.

I’d like to be able to see explanations at various layers of abstraction about why certain decisions are made or not.

finnnk - 4 days ago

I'm surprised that it seems no-one has brought up Residuality (see https://www.architecture-weekly.com/p/residuality-theory-a-r...) which is a very interesting take on architecture (as opposed to design) which aligns with my own experiences.

As well as the book (https://leanpub.com/residuality) the author has one on the philosophy of architecture (https://leanpub.com/architectsparadox).

ramon156 - 4 days ago

I would like to spend my time more on gaining a mental model of the projects I work on, but I get very demotivated if I start disliking things like the programming language, certain arch. Choices or anything that gets too complex that doesn't seem like its worth my time

It's heavily dependent on the project, but I feel like working as a "fullstack dev" kind of removes the fun of programming. I'm already spending 40 hrs a week looking at the most dull project I can imagine

noelwelsh - 4 days ago

I think this really down plays the value of mental model or strategies for organizing code. Take a compiler: often described as a sequence of transformations on an AST, taken to the extreme in the nanopass framework. That's a really useful mental model, and you can extract that model and apply it in other contexts. For example, many business applications are a sequence of transformations on JSON. So they're basically compilers. That can be good architecture in the right situation.

You don't have to call a sequence of transformations a compiler. You can say your AST is an algebraic data type, and your transformations are folds (or structural recursions; same thing). Now you have an abstract model that isn't tied to a particular application, and you can more easily find uses for it.

If you know a bit of maths you might wonder about duals. You will find codata---objects---are the dual of algebraic data. Ok, now we're programming to interfaces. That's also useful in the right context. What's the dual of a fold? An unfold! So now we have another way of looking at transformations, from the point of view of what they produce instead of what they consume. At this point we've basically reinvented reactive programming. And on and on it goes.

You can find most of this in the literature, just not usually presented in a compact and easy to understand form.

(Note, the above description is very quick sketch and I'm not expecting anyone to understand all the details from it alone.)

Shameless self promotion: the book I'm writing is about all these concepts. You can find it here: https://functionalprogrammingstrategies.com/

abhik24 - 5 days ago

The Gary Bernhardt talk is truly special. Lots of concepts which will lead you to other interesting places

runningmike - 4 days ago

Nice read. “ Learning Software Architecture” means understanding that there is no single good answer. It is art and science.

Read tip: Simplify IT - The art and science towards simpler IT solution https://nocomplexity.com/documents/reports/SimplifyIT.pdf

0xbadcafebee - 4 days ago

As relates to Systems Engineering: Software architecture is like plumbing architecture. It's certainly very important, but you don't live in plumbing pipes, you live in a house with plumbing. If your plumbing doesn't take the rest of the house into account, it could be a very expensive fix.

luodaint - 4 days ago

The architecture assignment that I found most useful did not come from a book. It involved the attempt to articulate my system to an agent session starting with no background information at all.

If the agent cannot deduce the constraint, then you have to write it out. Conventions for migration. Invariant properties of the authentication protocol. Multi-tenant behavior. This act of articulation – making your implicit reasoning explicit – led to a kind of clarity that several months of construction alone did not bring. Three architectural errors emerged instantly.

It’s true that learning by doing is the way to go. I would add: learn by explaining it. The agent is an unusually picky audience.

- 4 days ago
[deleted]
zug_zug - 4 days ago

This guy knows exactly what he's talking about. However, it feels more like a "if you know, you know" rather than relaying the experience/data he's accumulated.

Let me just say: A lot of people think architecture is how do you build a very complex system with tons of moving components (databases, queues, scaling, reduandancy, failover, dozens of services). I think expert achitecture is being able to answer how do I correctly solve the problem using the fewest of those.

Genius-level engineering is inventing the zipper, usable anywhere, lightweight, cheap, sturdy, simple to make.

(I believe he's alluding to this by saying companies follow conways laws and essentially socially construct a lot of work to match up with the number of teams, hence creating a completely unnecessary nightmare of complexity just for the social incentives)

NeutralForest - 4 days ago

Software design/architecture is a strange beast. It feels that if you want to learn it, you should spend time in legacy systems and large codebases of rewrite a project 3 times to explore counterfactuals. A lot of books on the subjects are abstract and give such simple examples, they are useless.

amelius - 4 days ago

With AI we all have to make the switch from programmer to software architect, I suppose.

systems - 4 days ago

there is also The Architecture of Open Source Applications books

https://aosabook.org/en/

jdw64 - 4 days ago

Most codebases eventually take on similar shapes, depending on their size and on the IoC model imposed by the framework.

And when you try to prevent that IoC from leaking into the domain too much, the design often starts to look like hexagonal architecture.

Programming often feels like inventing a new form, but in the end we tend to converge on the shapes that previous programmers already discovered.

senderista - 4 days ago

Just a plug for the POCSD book/course:

https://github.com/wangjohn/mit-courses/blob/master/6.033/Pr...

getnormality - 4 days ago

A lot of people seem to lean too much on Conway's Law. It takes social organization as primary instead of itself shaped by the nature of a problem. Maybe the reason Sales and Engineering are different departments is because they are different things.

kevinwang - 4 days ago

Learn by doing? Certainly helpful. But I feel like the real secret is to work with others who are good at software architecture. You can learn very efficiently that way.

sailfast - 4 days ago

Immediately favorited as this article and the comments underneath are great reference points and reminders. (Even as someone that's been doing this for awhile)

vova_hn2 - 4 days ago

> the phenomenon of “scientific code”

I have some experience being a software engineer in a data science team or in a team adjacent to a DS team, a lot of problems that they think are "data science problems" are actually software engineering problems being solved in an extremely convoluted and weird way.

I think that if DS community wasn't so resistant to basic SE good practices, or involved engineers in making architectural decisions, total time and effort needed to solve some problems would be greatly reduced.

When I'm in a bad mood, I even entertain a silly conspiracy theory in my head: they do everything in the most ugly and weird way specifically to keep people like me out :)

- 4 days ago
[deleted]
woodydesign - 5 days ago

[flagged]

lacymorrow - 4 days ago

[flagged]

maxothex - 4 days ago

[flagged]

JoheyDev888 - 4 days ago

[dead]

SadErn - 5 days ago

[dead]

rahadbhuiya - 4 days ago

[dead]