I’m a junior developer, and I’m looking for a book that teaches code design concepts. Clean Code is the most recommended book I saw, but it is also extremely controversial.

Any alternatives to read? I’m not a complete beginner as I have a Bachelor’s degree in CS, but I’m fairly new to the concept of writing “clean code”.

  • @MarcellusDrumOP
    link
    33 years ago

    I understand that. But still, tips like “Name your variables correctly”, “One feature per function”, and “Properly comment your code” are universal advices that will benefit everyone. I’m looking for a book that discusses simple practices in details. How to use abstraction correctly for example.

    • @ttmrichter
      link
      53 years ago

      Even these seemingly non-controversial pieces of advice turn out to have controversy attached to them.

      “Name your variables correctly,” for example, is that every experienced programmer will agree upon. What constitutes “correctly” however, is fuel for raging knock-down, drag-outs in coding groups. Let’s presume OOP programming and you have a class for a bank account. Obviously it will have a balance. (Ignore the poor modeling for pedagogic purposes. Real bank accounts can have multiple balances…) What should that balance variable be named, assuming the containing class is called BankAccount?:

      • balance
      • m_balance
      • fpBalance — the fp means fixed point
      • m_fpBalance
      • _balance
      • account_balance
      • accountBalance
      • AccountBalance
      • m_AccountBalance
      • fpAccountBalance
      • _AccountBalance
      • _fpAccountBalance
      • accBalance
      • m_accBalance
      • … and a cast of hundreds more.

      I have seen some variant of each of the examples provided and dozens more used in real-world code. I have watched programmers red/purple-faced and shouting at each other over which is right. (Programmers seem to have a problem with comprehending “perspective”.)

      Now lather, rinse, repeat for each and every other nugget of advice out there.

      And keep in mind, again, that this is screaming matches over trivial differences in agreed-upon principles. When you mix in things where even the principle isn’t agreed upon (“what is the right level of abstraction?”, say) … let’s just say that things get really ugly unless you’ve got management ready to stomp, hard, on the resulting interactions.

      Any book you read on the topic, as a result, will be just as controversial as Uncle Bobs’s Clean Code or Joe-Bob’s Rifle Range and Really Good Code Structuring or whatever.

      So my advice is … don’t look for any particular book. Pick up a book—it sounds like you already have one—and read it and make notes of what you do and do not agree with. Then read code. Lots of it. See where it follows and doesn’t follow what your book said. See if you can figure out why. Then see if you agree with the other approach more than, say, Maisie-Sue’s Coding and Crocheting.

      • @MarcellusDrumOP
        link
        13 years ago

        Very well said. I started reading the Clean Code, and the author makes it clear in the introduction that while he stands behind his school of thought, he agrees that it isn’t the only good one.

        Also what I’m excited about in the book are the study cases, which are basically practical examples to solidify the principles.

        Thanks for the detailed answer, much appreciated.