Found in 25 comments on Hacker News
Are there any specific aspects you'd like to improve around your code?

A few classics that focus on improving "general code style" would be:

- "Clean Code" (https://www.oreilly.com/library/view/clean-code-a/9780136083...)

- "The Pragmatic Programmer" (https://pragprog.com/titles/tpp20/the-pragmatic-programmer-2...)

EDIT: Since you are talking about coding like at a top company, one book that has been sitting on my shelf for a while, but I haven't gotten around to reading yet is "Software Engineering at Google: Lessons Learned from Programming Over Time" (https://learning.oreilly.com/library/view/software-engineeri...)

Jerry2 · 2019-02-22 · Original thread
Does anyone have any opinions on "Uncle Bob's" Clean Code [0] book? I read bits and pieces of it but never sat down and gave it a thorough read.

[0] https://www.oreilly.com/library/view/clean-code/978013608323...

otras · 2018-11-04 · Original thread
I'd recommend the following:

Clean Code: A Handbook of Agile Software Craftsmanship [0] is a great book on writing and reading code.

Similarly, Clean Architecture: A Craftsman's Guide to Software Structure and Design [1] is, no surprise, a book on organizing and architecting software.

Designing Data-Intensive Applications [2] may be overkill for your situation, but it's a good read to get an idea about how large scale applications function.

The Architecture of Open Source Applications [3] is a fantastic free resource that walks through how many applications are built. As another comment mentioned, reading code and understanding how other programs are built are great ways to build your "how to do things" repertoire.

Finally, I'd also recommend taking some classes. I started as a self-taught developer, but I've since taken classes both in-person and online that have been a tremendous help. There are many available for free online, and if in-person classes work better for you (motivation, support, resources, etc), definitely go that route. They're a fantastic way to grow.

[0]: https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma...

[1]: https://www.amazon.com/Clean-Architecture-Craftsmans-Softwar...

[2]: https://www.amazon.com/Designing-Data-Intensive-Applications...

[3]: http://aosabook.org/en/index.html

fdsvnsmvas · 2018-09-10 · Original thread
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/

framebit · 2018-02-14 · Original thread
2340 (the mandatory group project course) also covered a lot of this stuff, though not in as much detail.

The suggested reading for that course is a book that blew my mind when I first saw it as an undergrad: Clean Code by Robert Cecil Martin. I believe the examples are all Java, but the lessons are applicable to any language. Stuff like naming your variables more carefully than you name your children.

https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma...

data_hope · 2016-12-13 · Original thread
- don't only worry about code or getting features shipped, but about the process, how to deliver quality.

- behind any given reason, there is a complex network of real reasons. You don't need to second-guess any decision/order/suggestion, but it helps understanding.

- most user stories / user requests are raw diamonds waiting to be polished. ("What do they really want me to solve")

Essential reading list:

- Clean Coder and Clean Code https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma... https://www.amazon.com/Clean-Coder-Conduct-Professional-Prog...

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

rjblackman · 2016-12-10 · Original thread
read clean code https://www.amazon.com/Clean-Code-Handbook-Software-Craftsma...

and clean coder https://www.amazon.com/exec/obidos/ASIN/0137081073/metafilte...

If you follow the (admittedly pretty extreme) advice in these books you will be in the top 10% at least.

petersellers · 2015-05-05 · Original thread
For writing clean code, I highly recommend Uncle Bob's "Clean Code":

http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

oblique63 · 2014-12-05 · Original thread
Check out the guys over at 8th light: http://blog.8thlight.com/

Uncle Bob in particular (the author of Clean Code[0], The Clean Coder[1], and the Clean Coders videos[2]) is a lot like Wozniak.

[0] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

[1] http://www.amazon.com/Clean-Coder-Conduct-Professional-Progr...

[2] http://cleancoders.com/

shreeshga · 2014-11-06 · Original thread
Give them a free copy of Clean Code[1], I started to care about my code more after I read that book.

You cannot sit and review each commit, the best you can do is to make them care about code.

[1] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

raju · 2014-04-22 · Original thread
Great post. If you want a even _further_ expanded version of this I highly recommend "Clean Code"[1] by Robert C. Martin, and I learned a few days ago that there is a follow up book, "The Clean Coder"[2] which I am yet to read

[1] - http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

[2] - http://www.amazon.com/Clean-Coder-Conduct-Professional-Progr...

ghh · 2014-02-13 · Original thread
Yes! Please refer to the image at [1]. It's also on the cover of the introduction of 'Clean Code' [2]. Everyone here has some code that they are not proud of. You should see it as a sign that you've learned from the experience of designing and developing it.

Want to steadily improve on non-production code? Try codewars.com: you're asked to solve 5-30min coding exercises and after can immediately browse the solutions of your peers. The short feedback loop helps you understand how you could've improved while the code is still fresh in your head.

[1] http://www.osnews.com/story/19266/WTFs_m

[2] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

datawander · 2014-01-30 · Original thread
My favorite rule is 4.1.1; always use braces even where optional. I think a small fraction of the economy may have been damaged by the bugs caused by the silliness of leaving out optional braces and then having another developer come along and, well, you know how that goes :)

As someone who once read the Sun Java Style Coding [1] (which at a quick glance, appears to be a super set of the Google style guidelines) standard years ago and found it exciting and very helpful material, I unfortunately did not get such a kick skimming through this. Perhaps it's because after having read Clean Code [2], I feel that there is much missing that can lend itself to better code.

[1] http://www.oracle.com/technetwork/java/javase/documentation/...

[2] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

facorreia · 2012-12-10 · Original thread
I got around this mindset along the years, by learning about the importance of lowering the maintenance costs, improving collaboration and not depending on any single person to understand any given module or system.

Books such as "Code Complete"[1] and "Clean Code"[2] should help you with that transition.

[1] http://www.amazon.com/Code-Complete-Practical-Handbook-Const...

[2] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

boos3y · 2012-07-13 · Original thread
As a recent college graduate, I can tell you that they still teach the comment everything everywhere method, and in fact for most of our programming projects, documentation was at least 20% of the grade. I professionally, do not comment, but instead, write "clean code" that can be understood simply by reading it. Anything complicated I comment, but usually that means I need to refactor and rethink my approach.

I highly recommend this book: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman... as it changed my life when it comes to software development. I have a real problem with commenting everywhere as most of the time you'll find a lot of public String getName() with like a comment of //Gets the name, uh, durr its name is get name! If you create concise methods with one general purpose you can create very readable code. Definitely check the book out, it is a very good read.

mweibel · 2012-07-06 · Original thread
Well done code has good variables, good method/function naming and small methods/functions. If you have those 3 parts, you won't need any comments because it's self explanatory.

Comments often tend to explain the same thing as the code exactly does and what you see w/o looking at the comment. Also, they tend to be forgotten - if someone changes the code, he/she often doesn't change the comment. As a result, you'll have an outdated comment which can confuse you.

I recommend "Clean Code"[1] for more info on this subject. Beside other chapters, there's a chapter about what's a good and what's a bad comment.

[1]: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

bguthrie · 2012-02-14 · Original thread
Robert C Martin (Uncle Bob)'s Clean Code is a great read and discusses good naming in exhaustive and occasionally alarming depth.

http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

swanson · 2011-12-30 · Original thread
The first step is to be aware that you aren't writing succinct, manageable code - so you are already making progress :)

I'd recommend these books, mixed with some searching around for best practices for whatever specific framework/language/toolkit you are writing code with.

Clean Code

http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

Refactoring to Patterns

http://www.amazon.com/Refactoring-Patterns-Joshua-Kerievsky/...

Clean Code seems quite a bit more relevant and in-depth than this.

http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...

eneveu · 2011-09-04 · Original thread
I am passionate about writing good code, and I'll try to offer some practical advice. As others said, the first step is understanding the importance of writing clean code and taking pride in your craft. By doing this, you are already ahead of most other programmers who don't really care. Now, how do you improve?

1) Read books.

With 4-5 years of experience, you already have a good intuition for "good" and "bad" code. Still, it doesn't hurt to learn more about it. There are a lot of good books on this subject.

The first is "Clean Code", by Robert C. Martin. It's the first book I read on this subject, and I learned a lot. Note that the book uses Java in the examples, but I think the ideas would apply to most other languages.

Its author, Uncle Bob ( http://en.wikipedia.org/wiki/Robert_Cecil_Martin ) has long been a proponent of writing clean, beautiful code. He recently did an interview for Xebia: http://blog.xebia.fr/2011/05/25/interview-avec-robert-martin... (French blog, but the interview is in English). In it, he advises:

"Well there are a number of books that talk about writing code well. Kent Beck wrote a book called “Implementation Patterns” very recently. It’s an excellent book all about software craftsmanship. The pragmatic programmers wrote a wonderful book in 2000 called “The pragmatic programmer”, again a wonderful book. Chad Fowler wrote a book call the “Passionate Programmer”. Again the book is about doing everything well. I wrote a book recently called “Clean Code” which is very specific about particular things you can do with your code to do it well. So there is a tremendous number of resources that are available for people who are interested in doing software craftsmanship well."

Out of those, disregard "The passionate Programmer". It's an okay book, but its focus is on building a good programmer career, not on code.

"Implementation Patterns" by Kent Beck is a great book with a lot of best practices when writing * Java * code. Less useful if you use another language.

"The pragmatic programmer" is a good book on software craftsmanship. I'm personally half-way through. There is a lot of good advice in it, but I often find myself thinking it's "common-sense". Maybe because I've already been exposed to most of the ideas by reading blogs? Still, it's a great book, with a lot of best practices. It's main focus is not code, though, so you might want to start with other books if your focus is on writing good code.

To these books, I'd add "Code Complete (2nd Edition)" (language-agnostic) and "Effective Java 2nd Edition" if you use Java.

Summary:

If you use Java, read:

  - Clean Code - http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882   - Effective Java 2nd Edition - http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683   - Implementation Patterns - http://www.amazon.com/Implementation-Patterns-Kent-Beck/dp/0321413091   - Code Complete / Pragmatic Programmer 
If you use another language, read:

  - Clean Code - http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882   - Code Complete - http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670   - Pragmatic Programmer - http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X 
Other people might chime in with suggestions for other languages?

2) Practice.

Implement what you learned in the books. Keep improving.

3) Read other people's code.

Read good open source code. Not all code is good code. Ask around for OSS projects with good code in your language.

If you use Java, start with:

  - Google Guava - http://code.google.com/p/guava-libraries/   - Google Guice - http://code.google.com/p/google-guice/   - Spring Framework - http://www.springsource.org/ 
4) Practice.

5) Practice.

roryokane · 2011-06-08 · Original thread
Other people have already said most of what I wanted to say – that self-explanatory code, and sometimes tests, is almost always better than comments. I just want to point out a good reference on this topic: the book Clean Code: A Handbook of Agile Software Craftsmanship [1], specifically Chapter 4, “Comments”. That chapter gives examples showing which comments should be turned into code and which are acceptable to leave as comments, and it explains the reasoning behind the choices. (And the rest of the book teaches you how to make your code self-explanatory and easy-to-read.)

[1] http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...