Live data from Hacker News

Ask HN: What books had the greatest effect on how you structure your code?

news.ycombinator.com

71–80 of 162 posts

Re: Ask HN: What books had the greatest effect on how you structure your code?

#71

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.

I am almost tempted to bring it into work and frighten my manager with it :)

Re: Ask HN: What books had the greatest effect on how you structure your code?

#72
post #68
post #8

As 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.

Care to elaborate what bits of Clean Code are damaging?

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?

#73
post #64

For 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.

A lot of the design guidelines in that book carry forward many other technologies. A really great read.

Re: Ask HN: What books had the greatest effect on how you structure your code?

#74

On 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.

OO doesn't have serious problems. Crap implementation of OO bolted onto Algol derivatives has problems.

Re: Ask HN: What books had the greatest effect on how you structure your code?

#75

Hands-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.

I'm glad to see someone posted this book. I think it's far undervalued. Definitely a must read. The Ruby written could be completely replaced by pseudo code, and it wouldn't change the lessons taught.

Re: Ask HN: What books had the greatest effect on how you structure your code?

#77

Refactoring: 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.

I got this when it first came out, I was kind of doing it in a "gut feeling" kind of way, but this made me think of it more as a discipline, and solidified the idea of micro improvements and let me drop the idea of trying to get it exactly right the first time.

Re: Ask HN: What books had the greatest effect on how you structure your code?

#78
post #68
post #8

As 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.

That's interesting, I had the complete opposite reaction to clean code. As a person that recommends this book, with full heart, to every developer, I'd like to hear any details you could spare re: why you believe it's damaging? Maybe you can provide some examples of well-written codebases and why you believe they're such? And maybe you could comment on why you feel Clean Code's principles harm readability with some examples?

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.)

Post reply on HN