Jump to ratings and reviews
Rate this book

Robert C. Martin Series

Code That Fits in Your Head : Heuristics for Software Engineering

Rate this book
The latest title in Addison Wesley's world-renowned Robert C. Martin Series on better software development, Code That Fits in Your Head offers indispensable practical advice for writing code at a sustainable pace, and controlling the complexity that causes too many software projects to spin out of control.

Reflecting decades of experience consulting on software projects and helping development teams succeed, Mark Seemann shares proven practices and heuristics, supported by realistic advice. His guidance ranges from checklists to teamwork, encapsulation to decomposition, API design to unit testing and troubleshooting.

Throughout, Seemann illuminates his insights with up-to-date code examples drawn from a start to finish sample project. Seemann's examples are written in C#, and designed to be clear and useful to every object-oriented enterprise developer, whether they use C#, Java, or another language. Code That Fits in Your Head is accompanied by the complete code base for this sample application, organized in a Git repository to facilitate further exploration of details that don't fit in the text.

406 pages, Paperback

Published November 15, 2021

168 people are currently reading
1196 people want to read

About the author

Mark Seemann

3 books483 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
110 (38%)
4 stars
111 (38%)
3 stars
53 (18%)
2 stars
10 (3%)
1 star
2 (<1%)
Displaying 1 - 30 of 34 reviews
24 reviews
September 8, 2022
First, note that I've read the "rough-cuts" version in the epub format. Any critique (or praise, for that matter) could have been adressed before the actual release.

The formatting bugged my e-reader quite a bit, but (as usual) this can be resolved by deleting most of the CSS file's content, especially the margins and paddings.

I'll start off by saying that I found the title to be a bit confusing. It does make sense after a few chapters, but I don't find it to be fitting for the book as a whole. I vaguely remember Mark saying in a podcast that the title wasn't his first choice, so I assume he had a better idea in mind.

I found the writing to be in line with the typical "Clean Code" style. The topics have an intended reading order but are also useful on their own, and are accompanied by various handy principles/patterns, stories, and a sample codebase.

Overall, I unfortunately must say that this book won't have a large impact on my work. This isn't because it doesn't include useful advice, but rather because I've already heard and adopted most of it in either exactly the same or a very similar way.

I e.g. write small "code" and run complexity analyzers anyway, thinking of it as a flower hierarchy won't have a large impact going forward. The fact that only small code fits in your head and you can explain that with psychology (2 minds of thinking by Kahnemann) is at best just another reason to write neat code, needless to say, that there are many more benefits.

I must applaud that Mark tried not to create new principles but to reason with existing material instead. Still, the book contains quite an amount of references to Robert C. Martin, as if everything you say must be true if you can link it to one of his statements (Not sure what I expected though, given that it was released in his series. So that's my bad, I guess).

I found the most value in the small things: E.g. to not assert the messages of exceptions, to write methods that intentionally fail tests to test the quality of the tests (devil's advocate), et cetera.

What the book definitely achieved is that I'm going to research some topics. E.g. until now it never came to my mind to do Code-Analysis based on git's history.

I also feel like this book gives me gunpowder to introduce new ideas to my team. While I already knew about property-based testing, just like most functional topics I have difficulties convincing comfy OO developers to give it a real try. If this is for the lack of coverage in "accepted" literature, I now can point to a Clean-Code series book for some techniques.

Conclusion: The book convinced me that it earns a place on my bookshelf, so I'm going to buy the paperback version soon. Unfortunately, I didn't quite feel like part of the target audience, so my review might not match others.

If you're reading this Mark: I would absolutely love to read a book in which you cover any functional topic to any target audience. Sure, the functional core / imperative shell and property-based testing chapters hinted at your interest in FP, but your blog makes it clear that you not only have a broad knowledge in this area but that you're able to translate it into practical scenarios too.
18 reviews
December 11, 2021
I likes this book a lot. It does not contain any new information and does not claim to do so either. It is however, a very structured approach to the subject at hand, writing sustainable software.

Personally I work in an environment with very strict coding guidelines. This book, in contrast to the guidelines dictated at work, manages to give concrete advice without removing creativity and innovation from software development.

If you are a beginner, read this book. The writing is awesome, down to earth and covers topics not learned in school. All 28 advices in the book is solid.

Thanks Mark for this book.
Profile Image for Aleksandar.
13 reviews
March 4, 2022
This is a good book with a lot of excellent programming practices.

Most of the things written here are already known good practices. Still, the author tries to be original and not repeat the big ideas other writers already published in the programming world, but to tackle details that can fine-tune the practice to the next level.

I recommend this book to developers at the beginning of their careers.
Profile Image for Felipe Martins.
16 reviews2 followers
November 1, 2021
O livro é bastante prolixo e não se aprofunda em nenhum dos temas apresentados - o que, verdade seja dita, não era o objetivo dele.

Não vejo valor na leitura para pessoas desenvolvedoras mais experientes, mas consigo ver algum valor para “iniciantes avançados” que estejam procurando uma obra que consolide em um só lugar várias das práticas que costumam ser recomendadas nessa indústria, principalmente porque o livro é bastante generoso no uso de citações e referências.
Profile Image for Andrei Tarutin.
41 reviews2 followers
May 1, 2023
"Code That Fits in Your Head" by Mark Seemann is the definitive resource I've been seeking for decades. As a software developer, I have encountered countless books, articles, and courses on writing clean, maintainable code, but this book stands head and shoulders above the rest.

The author's writing style is concise, engaging, and easy to understand, making the book accessible to developers at all levels of experience. Mark Seemann has a unique ability to explain complex concepts in a way that truly resonates with the reader. His passion for software craftsmanship shines through on every page.

One of the most valuable aspects of this book is the practical advice it provides. Seemann introduces proven techniques and best practices that can be immediately applied to real-world projects. By following these guidelines, I have noticed a marked improvement in the quality of my code and the ease with which I can maintain and extend it.

The book covers a wide range of topics, including:
- Understanding and managing complexity in software
- Crafting code with SOLID principles in mind
- Designing modular, extensible systems
- Efficiently refactoring and improving legacy code
- Writing effective unit tests and practicing Test-Driven Development (TDD)

"Code That Fits in Your Head" is not just another book on programming best practices; it is a treasure trove of insights and guidance that has fundamentally changed the way I approach my work. I can recommend this book highly enough to anyone who wishes to elevate their coding skills and write software that is efficient, maintainable, and a pleasure to work with.

In conclusion, "Code That Fits in Your Head" by Mark Seemann is a must-read for software developers of all skill levels. It has transformed the way I write code, and I am confident it will do the same for you. Don't miss the opportunity to learn from one of the best in the industry. Happy coding!
Profile Image for Marcin.
24 reviews2 followers
March 17, 2022
This book is not revolutionary at all. Working for a couple of years in IT, you are supposed to know and use most of them. Even though, it is still valuable as structures good practices. None of book I read before puts most of them in one place. That's a brilliant idea. Apart from soft techniques, the author shows how to introduce every habit using code listings. The codebase is available on GitHub.

In my opinion, the coding-related part is pure gold. The second one, which is rather about soft skills, could be skipped. I couldn't agree with a few subchapters.
Nevertheless, I would recommend the book for every folk who has just started and want to boost their career. In my opinion, the content of the book should be lectured at universities. I wish I had such classes.
174 reviews4 followers
June 6, 2022
Lots of good specific ideas (I agree with some details, not with others), lots of good concepts about pragmatism and how rules-of-thumb can factor into practice.

Full of great references and reading list material.

Like so many books, I think a lot of the details, even as an example to be extrapolated from, are more specific to modern C# and to compiled OO languages than the author quite believes.
Profile Image for Jonathan.
36 reviews1 follower
July 16, 2023
There’s nothing new or revelatory in this book, but it’s one of those I’m very glad I’ve read, that I’ll be referring back to regularly and that I’d really recommend to anyone that wants to become a better developer.
Profile Image for Steven Jøris.
8 reviews
October 1, 2022
This was a wonderful read!

As a senior software engineer who seems to have a very similar approach to software development as Mark does (though less focus on TDD), I didn't learn too many new techniques/heuristics.

But, the way Mark presents and expresses them, I feel I still walked away with a deeper understanding and appreciation of why these techniques work, and how to communicate them to other developers. Furthermore, there are numerous excellent citations which lead to more in-depth reading that delves into more advanced topics in case you want to challenge yourself further.

This makes this book both accessible to junior developers and interesting to senior developers alike! I would classify it as "intermediate" level; relevant to read after completing higher education in computer science or software development while getting your hands dirty on your first codebase in industry.

Compared to other similar literature, such as "Clean Code", Mark does a much better job of introducing these heuristics as guidelines with clear motivations behind them, so that individuals can choose for themselves when/if/how to apply them in their own practice. This is important, since I've seen the damage a well-intended book such as "Clean Code" can do when interpreted as a fixed set of rules without a thorough understanding of why they were presented in the first place.
Profile Image for Nuno .
14 reviews
May 9, 2022
This book was probably one of the easiest technical books I've ever read. Mark delivers a lot of good advice using a very easy to read and to follow writing style.

I wouldn't say it's a book for developers that have just started their career. Quite the contrary, I believe you will benefit more if you already have a couple of years programming on your back, so that you will instantly recognize the benefits of the advice given.

Don't expect this one to deep dive into topics such as TDD, unit testing, SOLID principles, clean coding, etc. Instead, the book references a lot of literature about those topics and more, and just exposes the lessons that Mark has learnt over the years while developing software.

From my part, I've enjoyed reading this one so much that it will have a direct entry on my top list of software development related literature and will for certain deserve another read in the future.
5 reviews
June 10, 2023
This book was such a pleasure to read. Mark Seemann pulls from all the good ideas on how to write software and adds a bit of his own to give you a great manual on how to write Code that Fits in Your Head. I specially enjoyed and found insightful the chapters on Encapsulation, API Design and Separation of concerns. Sometimes you find books that are good at explaining high level concepts but are weak on details and specific examples. Mark definitely delivers in this area.

And honestly if you jsut read the book you are just getting 50% of the value, the other half is in the codebase! I really recommend every one follow the implementation commit by commit, maybe you can skip things here and there but there is so much value hidden in almost every commit. The TDD approach, each small refactorings, the attention to detail... Everything has a WHY. I believe I'm a better software engineer after reading this and I'll try to put in practice many of the learnings.
Profile Image for Rene Stein.
228 reviews36 followers
September 22, 2022
Další kniha, u které nevím, pro koho je určena. Rady pro začátečníky, které jim ale v této formě podle mě nic nedají, mizerný příklad, na kterém jsou mj. ukázány triviality z unit / integračního testování, u příkladu se zcela zbytečně vysvětluje kód v infrastrukturní (ASP. NET) třídě Startup, nikde se nejde moc do hloubky. Rady, jak držet komplexitu kódu na uzdě, aby se "kód vešel do hlavy," známe už odjinud a v kontextu triviálních příkladů, které "hlavu" ani nevyplní, působí směšně. A asi jako povinný tribut za zařazení knihy do série Roberta C. Martina, autor několikrát na různých místech cituje stejnou Martinovu definici abstrakce.
Dependency injection in .NET od stejného autora je skvělá. Markův blog a články o funkcionálním programování patří k tomu nejlepšímu, co jsem o FP četl. Této knize se ale klidně vyhněte.
Profile Image for Joshua Park.
1 review
Read
December 6, 2022
Practical

The book takes a very practical approach and walks you through the main steps of building the sample application.

I don't think it is as disorganized as some people reviewed, but it's not one of those books where the writer posits a set of principles that all programmers should live by at the beginning and uses the test of the book to expound on them.

It feels more like a fast-forward view of how one's code would evolve as that person adopts good programming habits one by one.

It's not as packed as Clean Architecture, partly due to the tone and manner of the author, and I do wish the book were a little longer; his previous book on D.I. was a little more laden with content.

Nonetheless a great read. It would be especially nice to read it as a group and share opinions on what was suggested.
Profile Image for Liudas.
33 reviews2 followers
April 3, 2024
Book about the books...

Started strong, but faded quite quickly. Overall the book didn't met the expectations - I'd say it's very rudimentary book about software development. Although information is OK, but I'd say it's a common sense to anyone 5+ years in the field. That begs a question: "what's the point of the book?".

Author believes that: "there's value in collecting disparate information and presenting it in consistent way". I'd argue that it depends on the auditory...

Having red many of the referenced books, I find this to be book about everything and about nothing. I guess it will be valuable to some, but I suggest rather reading the original sources.
3 reviews
August 15, 2022
If you like these kind of books that give advice to get a better programmer, how to improve the craft of programming. Then this is a good read.
Things the book talks about which are new to me and I have to look up are Cyclomatic Complexity which gives information about how many paths and objects a function has. Maybe there are tools to integrate into the build process. If too complex then it "doesn't fit into your head" and is harder to reason on.
Also something I haven't heard is Fractal Architecture.
Profile Image for Paul Duplys.
17 reviews
August 30, 2024
If you’re looking for a pragmatic yet comprehensive approach to software engineering, this book is definitely worth a try. Mark Seemann ventures into different areas of software engineering, including architecture, clean code, test-driven development, psychology of programming, team structure, and personal organisation as developer, referring to many classical works in these areas. At the same time, he remains pragmatic and presents many time-proven techniques and heuristics. Taken together, these two aspects perfectly reflect the book’s motto: quality code that fits in your head.
Profile Image for Torben Koch.
27 reviews5 followers
August 4, 2022
This is not a great book. It does contain some gems and take-aways here and there but it is way too long for the goodies it does contain. The target audience is not crystal clear; at some times the book seems to be for rookies, at other times it contains more advanced stuff, but really doesn't go into much depth about it.

Seeman is without doubt an adept writer but my view is that the book should have been much shorter. Seeman could have written a book that fits in your head.
Profile Image for Denis Nuțiu.
62 reviews5 followers
November 17, 2023
Code that fits in your head is the title of this book chapters however feel overly complicated just for the sake of adding more words to the book.

Unlike the other book Dependency Injection Principles, Practices, and Patterns (which is amazing) this one is plain boring, I can barely read the chapters and I do not feel like I'm getting any value from them. The Pragmatic Programmer is probably a better alternative to this.
3 reviews
June 7, 2024
I liked it!

A guidebook for how to write bug resistant human understandable code. All samples in c#. Plenty of references to other resources. The author does not claim to have invented what he states but instead compiles what he considers the best of his study and experience in writing understandable, correct code. Knowledge contained in the book is applicable whether you write in c# or another object-oriented or functional language. I recommend it.
600 reviews11 followers
December 11, 2022
This is a book I can highly recommend to software developers. It does not matter much in which programming language you work; it offers many tricks that work independently of the language. The magic number 7 is the theoretical backing behind the reasoning to make things simpler. From there on Mark explains and shows numerous ways to achieve that in your code base. Read it!
Profile Image for Jeff Patterson.
106 reviews6 followers
August 29, 2023
Excellent. Every Chapter, every sentence is pure gold. There were a few areas that I didn't completely agree with, file structure sticks out since it is fresh, but I enjoyed the perspective, the arguments were sound, and upon some contemplation might even adapt a version recommended. However, these areas were few, and the insight and enlightenment taught me much about software engineering.
Profile Image for Piotr Pabis.
103 reviews4 followers
June 11, 2025
I read several good programming books: The Go Programming Language, Unit Testing Principles Practices Patterns, Clean Architecture. But this book is like all of these and more combined, and attached bibliography lets you get even deeper into best practices. If I were to recommend someone a programming book, this would no doubt be the first one - it will serve as an overview and index.
Profile Image for Jrabelo.
12 reviews2 followers
April 6, 2022
This is certainly one of the very few books on software engineering that makes you think a lot of times "out of the box"

When reading some of Mark's ideas, you get that amazing feeling that you are not reading a book only about software, but something much deeper than that...
Profile Image for Alex Railean.
267 reviews41 followers
May 27, 2022
I found it very useful, as it comes with lots of practical examples and discussions about best practices.

I didn't necessarily agree with all the given advice, but overall, it does a good job at making you think about designs that take cognitive limits into account.
4 reviews
July 2, 2022
I don’t know who this book is for. It is too simplistic for even beginning developers, but it doesn’t even build up

He intended for it to be language agnostic, but failed dramatically. The C# and dotnet is very in the foreground. He did little to generalize things.
Profile Image for Ryan Atwood.
Author 2 books4 followers
October 27, 2023
Really enjoyed Mark's book! I'm a big fan of his sessions on Pluralsight teaching about encapsulation and SOLID principles.

It was a mish-mash of really helpful ideas loosely centered around code being readable. Would absolutely recommend! Thank you, Mark!
Profile Image for Dana Goosen.
138 reviews2 followers
September 29, 2024
Would absolutely recommend to anyone with at least a couple years of experience. Love the emphasis on common sense, ownership, responsibility in dev job.
Displaying 1 - 30 of 34 reviews

Can't find what you're looking for?

Get help and learn more about the design.