How To Write Unmaintainable Code by Roedy Green. The best way to write better code is to avoid writing it badly in the first place. But you need to know how to write bad code to write code better than it. Definitely a different way of learning how to write good code, also a good laugh for anyone in industry.
Ask HN: What books had the greatest effect on how you structure your code?
71–80 of 162 posts
Re: Ask HN: What books had the greatest effect on how you structure your code?
#72As a programmer in training who has both Clean Code and Code Complete in a queue on the edge of my desk, I'm following this thread to decide which goes first, or if they both get sold in mint condition.
Code complete is a classic. Clean code will teach you how writing 3 line functions is a best practice. It's an overhyped, overrated book which is more damaging than helpful and one of the very few I couldn't stand to read until the end due to the authors' dogmatic views.
I've read it and I thought it has some good ideas. It's the #3 most discussed book on StackOverflow. However, I've been downvoted on HN for recommending something the book talks about (comments are usually misused)
Maybe I'm missing something more experienced developers know.
Re: Ask HN: What books had the greatest effect on how you structure your code?
#73For C#, Framework Design Guidelines by Cwalina & Abrams. Very clear and concise pointers for well structured and easy to read code. It's a little out of date now though, wish they'd update it to a third edition.
Re: Ask HN: What books had the greatest effect on how you structure your code?
#74On LISP, by Paul Graham. LISP was the second language I learned in college, but only after 6 years programming Java and C# that I came back and really learned LISP. It was when I realized that I was doing everything wrong. For example design patterns exists because OO has serious problems that we don't find in a functional programming language and you only see this when you understand both paradigms.
Re: Ask HN: What books had the greatest effect on how you structure your code?
#75Hands-down, Practical Object-Oriented Design in Ruby ( http://www.poodr.com/ ) - some of it I don't agree with but it's all wonderfully put-together: clear and concise, with wonderful examples. Much more about OO design than Ruby, non-Rubyists will get 98% of the value out of it that Rubyists would.
Re: Ask HN: What books had the greatest effect on how you structure your code?
#76Re: Ask HN: What books had the greatest effect on how you structure your code?
#77Refactoring: Improving the Design of Existing Code After reading I began to think about programming as an algebraic transformation from one system to another, in doing so radically reduced the amount of errors I made.
Re: Ask HN: What books had the greatest effect on how you structure your code?
#78As a programmer in training who has both Clean Code and Code Complete in a queue on the edge of my desk, I'm following this thread to decide which goes first, or if they both get sold in mint condition.
Code complete is a classic. Clean code will teach you how writing 3 line functions is a best practice. It's an overhyped, overrated book which is more damaging than helpful and one of the very few I couldn't stand to read until the end due to the authors' dogmatic views.
I find it painful working with codebases that don't use most of the principles re:
- Write code like good stories: Code should read like a story, methodically descending the call graph method by method; each working at one level of abstraction.
For example, why is string manipulation littered all over this function that's supposed to be dealing with consolidating reports? Ugh. I like when one function stays at one level of abstraction
- Factor out conditions into descriptive methods: I shouldn't have to sit and read through 5 logical operators, some arithmetic, and method calls in 1 'if' conditional, to understand why we're doing all this.
Once again, this goes back to having your code read like a story. Factor it out into a descriptive function, so that I can understand at a glance and deep dive if necessary.
- Comments are a failure: This applies 99.99% of the time. It's almost comical when someone leaves behind a comment that could be eliminated by factoring something out into a descriptive method call instead.
There's a lot of other great stuff in Clean Code that I'm forgetting off the top of my head. (It's been awhile since I last looked over it.)
I've come across very few code bases that are a literal pleasure to read. https://github.com/jekyll/jekyll is one of the cleanest codebases that comes to mind immediately. And on the other side of the coin, https://github.com/kubernetes/kubernetes is one of the dirtiest.
If anyone wants more details/expansion, let me know and I'll reloop. (On my phone right now.)
Re: Ask HN: What books had the greatest effect on how you structure your code?
#79This helped me break my analysis paralysis when it came to figuring out how to organize my code.
Re: Ask HN: What books had the greatest effect on how you structure your code?
#80Are books still state of the art in 2017? I would assume all the best knowledge could be found online for free by now.