Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Cover of The Art of Readable Code

    The Art of Readable Code

    Dustin Boswell · 2011

    As programmers, we've all seen source code that's so ugly and buggy it makes our brain ache. Over the past five years, authors Dustin Boswell and Trevor Foucher have analyzed hundreds of examples of "bad code" (much of it their own) to determine why they're bad and how they could be improved. Their conclusion? You need to write code that minimizes the time it would take someone else to understand it -- even if that someone else is you. This book focuses on basic principles and practical techniques you can apply every time you write code. Using easy-to-digest code examples from different languages, each chapter dives into a different aspect of coding, and demonstrates how you can make your code easy to understand. Simplify naming, commenting, and formatting with tips that apply to every line of code; Refine your program's loops, logic, and variables to reduce complexity and confusion; Attack problems at the function level, such as reorganizing blocks of code to do one task at a time; Write effective test code that is thorough and concise, as well as readable. - Publisher.

    Programming
    Open LibraryAmazon
    Stats for nerds
    11recommend
    17mentions
    14people
    2011–2026years
    82% recommend12% neutral6% critical

    Mentions per year

    201120132015201720192021202320252026

    What Hacker News says

    1. bipsonJun 2021
      I can relate to where the author is coming from.

      What these comments do is give the code structure, and giving an outsider a better/faster view into the code, when he has no internal model for the library/framework/API/language which helps him recognize the statements (this outsider might be the author himself, or "future me").

      Not knowing what these lines do, I can at first glance (i.e. skimming through the code) understand the author's intentions, what each line is responsible for. This is simply reduction of mental load and I even do this just for myself when trying to wrap my head around a new library or language.

      On the other hand, if you are writing for a (large) internal codebase, where you need to find a tradeoff between reduction of mental load and bloat, such comments can quickly become a nuisance...

      Then again, the cost of useless comment is usually much smaller than the cost of mental load (everyone knows how to ignore comments, unless they fill pages...)

      All this being said, I can only recommend "The Art of Readable Code" - Boswell [1].

      [1] https://www.oreilly.com/library/view/the-art-of/978144931848...

      thread
    2. neuroclineJun 2020
      I went through my recent-books shelves and found a few shorter books that are well worth reading. Short books for developers are rare these days.

      Algorithms Unlocked, Thomas Cormen, 212 pages

      The Art of Readable Code, Dustin Boswell & Trevor Foucher, 180 pages

      How To Take Smart Notes, Sonke Ahrens, 151 pages

      How to Write a Thesis, Umberto Eco, 223 pages

      How Charts Lie, Alberto Cairo, 193 pages

      thread
    3. AlexCoventrySep 2018
      > the judgment / taste required to make maintainable changes to a million LOC repository

      Try The Art of Readable Code (a pair of google authors, IIRC), and Ousterhout's A Philosophy of Software Design.

      thread
    4. fdsvnsmvasSep 2018
      Thanks everyone, the comments are much appreciated. Here's a list of books and other media resources recommended so far in the thread:

      Robert C. Martin, Clean code: https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma...

      Vaughn Vernon, various: https://vaughnvernon.co/?page_id=168

      Steve McConnell, Code Complete: https://www.amazon.com/Code-Complete-Practical-Handbook-Cons... 2

      Clean coder: https://cleancoders.com/ videos

      Hunt and Thomas, The Pragmatic Programmer: https://www.amazon.com/Pragmatic-Programmer-Journeyman-Maste...

      Hitchhiker's Guide to Python: https://docs.python-guide.org/

      Dustin Boswell The Art of Readable Code: https://www.amazon.com/Art-Readable-Code-Practical-Technique...

      John Ousterhout, A Philosophy of Software Design: https://www.amazon.com/Philosophy-Software-Design-John-Ouste... This one looks particularly interesting, thanks AlexCoventry!

      Kent Beck, Test Driven Development: https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/...

      Dan Bader, Python Tricks: The Book: https://dbader.org/

      Ian Sommerville, Software Engineering: https://www.amazon.com/Software-Engineering-10th-Ian-Sommerv...

      Svilen Dobrev, various: http://www.svilendobrev.com/rabota/

      thread
    5. hikarudoSep 2018
      I highly recommend "The Art of Readable Code: Simple and Practical Techniques for Writing Better Code", by Dustin Boswell and Trevor Foucher. It's an easy read, and well explained with good examples.
      thread
    6. morbidhawkNov 2017
      I only program my side projects on the weekends, when I come back to the code I realize how poorly it's been written, especially if I've skipped a weekend. I'm really striving to make my code readable. A great book I read is "The Art of Readable Code", and while it focuses on code readability from a micro-level (making a small code sample readable), I find more knowledge is needed to make a program readable when reading it from start to finish.

      The code I find most readable is imperative code that can be read line-by-line. I find abstractions hide away important knowledge of understanding completely how things work. Additionally I prefer reading algorithmic code than reading a bunch of helper functions that are at a level of indirection away from understanding the code at hand. For this reason I try to write in more imperative style instead of OOP or functional. But I find that programs I write that can be followed line by line end up having a lot of variables that make it hard to keep track of everything.

      I've tried to look for other projects that can be read line by line easily but I haven't found one yet. I'll end up spending way to much time trying to figure out what helper objects, functions, or structs are doing and they require jumping to a bunch of other files while trying to keep in my head what I read previously.

      It seems these 2 things are at odds with each other: readable code vs code that can be read and understood completely. I don't want algorithms hidden away but when they are right there in place with the other code it becomes too much.

      Is completely readable code even possible? I've heard "abstract just barely as much as you need" or "just use right level of abstraction" but that doesn't give me anything concrete I can do. Is there a project that you know about that was large but very easy for a new person to read and understand completely? Do you know how to write code like that?

      Any ideas are appreciated. Thanks!

      thread

    Related

    Cover of Code Simplicity
    2013–2021

    Code Simplicity

    Max Kanat-Alexander
    3 recommend · 3
    Cover of Code Complete
    2007–2026

    Code Complete

    Steve McConnell
    393 recommend · 894
    Cover of Beautiful Code
    2007–2025

    Beautiful Code

    Andy Oram
    48 recommend · 109
    Cover of The Pragmatic Programmer
    2007–2026

    The Pragmatic Programmer

    Andy Hunt
    353 recommend · 700
    Cover of Clean Code
    2008–2026

    Clean Code

    Robert C. Martin
    298 recommend · 951
    Cover of The art of computer programming
    2007–2026

    The art of computer programming

    Donald Knuth
    336 recommend · 1,799
    Cover of The Practice of Programming
    2007–2026

    The Practice of Programming

    Brian W. Kernighan
    90 recommend · 184
    Cover of Code Reading
    2009–2026

    Code Reading

    Diomidis Spinellis
    11 recommend · 21