Ask HN: How to Learn Software Architecture?
I have worked as an architect to the CTO of a 1200 person tech company for many years, and later as an architect over four teams at another tech company.<p>It is possible to learn good architecture, but I think when it&#x27;s the most important is when it&#x27;s the least sexy. For example, one of the most important things I learned at my last project was that one of the teams wasn&#x27;t using database transactions for extremely important records. I learned this by noticing an oddity in the logs, then reading that area to prove it. Finally, I had to teach them how to use database transactions and what the different types meant.<p>While getting them to use transactions, I noticed they were POSTing a record to another team, then saving it in the database. What happened if the database INSERT failed? Extremely important data was now sent to another reporting system but not in the system of record. I helped them add a listener that would pull records from the database after it was inserted.<p>Now, what about the data in the other system, sure we fixed the source, but are there records there that were POSTed successfully, but not INSERTed? Time to find out by learning that system and checking. Sure enough there were 10ks of records that were orphaned, but showing up in reports to customers. These are financial records, it&#x27;s extremely important that we not report on bad data. Cleaning this up was a six month project involving 25 people and three teams.<p>This was the kind of stuff that kills financial companies. The bad architecture would eventually have caused lawsuits and likely company collapse. However, most people weren&#x27;t really that interested in it, the devs and product just wanted to get features out. I&#x27;d have to not only find the issues, but then be savvy enough to PowerPoint the issue to the right people to get the bandwidth to have these things fixed. It was thankless work, mostly tedious reading of code and logs and databases. Everyone helped but begrudgingly.<p>I will say the fastest way to learn to see these things is by learning to read code and document it in a way to help you think about it. I found the original issue about the POST and INSERT simply by reading the whole codebase two times top to bottom my first couple months on the job, documenting it all, and reviewing my documentation and thinking about it. Things like that just start to stand out as you ask &quot;what happens if X fails&quot; and follow it along to a logical conclusion. When I&#x27;d see something surprising, like weird logs, if seemed important I&#x27;d drill down until I found the cause.<p>Almost never in my experience as an architect have I been needed to design something up front. I actually think the job title should be changed to something like &quot;cross team bug finder and fixer&quot;. So many times a team internally will be consistent enough, but once data crosses to another team the weird issues happen.<p>Another issue I found was that data was being stored in two databases. A check of a few lookup tables showed that someone had put the wrong status codes in one of the databases, so when a record was status 1 (OK) in one database, that meant something else in the other. Why were there two databases with the same data? Oh, a conversion that never finished, well let&#x27;s finish it. Oh, no one still works here who remembers it, well I&#x27;ll learn enough to figure out what is missing and finish the project, deprecating the old database.<p>I found another issue when I realized the devs on a team didn&#x27;t realize splitting relational data between two databases was an issue. They couldn&#x27;t have foreign keys, so they couldn&#x27;t use joins in most cases. Because of this, the would fetch all records and join in memory. This was extremely inefficient, and they were certain that they needed a document database (and a two year rewrite) to deal with their performance issues. In reality, they only had a few 100ks of records, and I showed them that merging the two databases and using JOIN could fetch their reports and screens almost instantly.<p>Almost every dollar of value I&#x27;ve earned as an architect was like this. Nothing sexy, most of the time telling younger devs &quot;no we don&#x27;t need this new thing, it can be done with existing tools you already have in 1&#x2F;10th the effort&quot;. Many times they want to rewrite everything, when in reality if they aren&#x27;t good enough to see and fix these issues, they&#x27;ll just recreate new ones.<p>This post makes me look like a database architect, and I think that&#x27;s simply because many devs can do a decent job keeping code clean, but very few think about messaging, ACID, databases, scaling, and data. They can write unit tests and organize code into modules that are fine, but don&#x27;t realize what should be cached and what shouldn&#x27;t. They&#x27;ll reach for solutions they just read about like microservices or horizontal scaling with messaging, but not even know how to get 1% of the benefit from their existing tech stack.<p>I really like the book Designing Data Intensive Applications for filling in the missing gap about data, transactions, and performance.<p>Here is my recommended reading list: <a href="http:&#x2F;&#x2F;deliberate-software.com&#x2F;page&#x2F;books&#x2F;" rel="nofollow">http:&#x2F;&#x2F;deliberate-software.com&#x2F;page&#x2F;books&#x2F;</a><p>I would encourage you to approach architecture like recommended here <a href="http:&#x2F;&#x2F;www.norvig.com&#x2F;21-days.html" rel="nofollow">http:&#x2F;&#x2F;www.norvig.com&#x2F;21-days.html</a>. It will take a long time for the benefits to start, it&#x27;s not something you can cram in a couple years. Learn to read code, document it, and read as much about code, data, and performance as you can.<p>Lastly, there&#x27;s a lot of snake oil salesman out there who will teach you the &quot;secrets&quot; of architecture for a low fee of 10k at a one week conference they run alone. Udi Dahan, iDesign, etc. These guys will teach you one architecture, and will try to convince you a simple rewrite to this messaging first architecture will save everything. I&#x27;ve never seen any of those successfully applied, but I&#x27;ve seen devs go and become totally brainwashed until they can&#x27;t even find obvious things in an existing system to improve, because they are so focused on trying to convince everyone to rewrite everything. I&#x27;ve seen great people be on a team, but never notice huge issues with the project, because all they can see is &quot;it&#x27;s not what Udi said it&#x27;s good architecture&quot;.<p>Good architecture is 100% dependent on what the goal is, what the existing system is, who&#x27;s working on it, and what the desired business outcomes are. A slow website isn&#x27;t a big deal, if it&#x27;s not hurting the business. Inconsistent data isn&#x27;t a big deal in many different types of systems. It&#x27;s all relative, so there&#x27;s no One Perfect Design, and the only people saying otherwise are trying to sell you something.