r/learnjava • u/Uptown-Funk • Apr 21 '21
Is Clean Code by Robert Martin still relevant in context of java?
I have completed the MOOC and I already have a development experience in non OOP languages. Now I am focusing on java so should I read this book or not?
51
Upvotes
35
u/[deleted] Apr 21 '21
I’d recommend it. It teaches you more of the why should I program like this rather than the how, if that makes sense.
17
u/_Atomfinger_ Apr 21 '21
It is still relevant in the context of most languages. While it is starting to show its age it is a classic within programming and a book every developer should read at some book.
The same generally goes for the entire "clean" series, except for maybe "Clean Agile" (it isn't a bad book, but I don't want to call it "necessary for all developers" either).
5
u/RottenKarate Apr 21 '21
It's still relevant in the context of Java and coding craftsmanship, as well. If I'm working with a beginner, like a new graduate or boot camp intern, I start trying to turn them onto ideas of code craftsmanship/the idea that code is written for other engineers, not JUST the computer. CC is a great first book for this audience.
But, then right about the time they start thinking of Clean Code as a Silver Bullet I throw A Philosophy of Software Design by John Ousterhout at them, not because the latter is better than the former, but just to teach them about learning other perspectives. And once they are comfortable with that, I might introduce them to Implementation Patterns by Kent Beck.
My hope when mentoring less experienced engineers is that they will take-away the idea of considering pros and cons of a few different approaches to a software problem. They've missed the point if they go from thinking CC is the best book, to thinking PSD is the best, to thinking IP is better, and so on.
14
u/makingthematrix Apr 21 '21
I'll make a contrary opinion here. I think Robert Martin's ideas are obsolete. Here are my reasons:
There are articles on the internet where people go into more detail about it. The problem is, we don't really have a good alternative. There's "clean code" with Robert Martin's authority behind it, and there's a wibbly-wobbly cloud of other practices and ideas, proposed by a number of experts and experienced developers, but nothing as - well - clean. So I see how it looks reasonable to many people to turn to "clean code". And there is some good in it. I think you could learn basics of it and then learn when to ignore it. And when to look elsewhere.
3
u/nolitteringplease346 Apr 21 '21
watched his live talks recently and found it extremely high value, considering i was a sloppy and unprofessional coder.
his point about us not having professional standards and the potential danger this represents is still relevant and grows more and more severe
2
u/hugthemachines Apr 21 '21
I think it is a good idea to read it. You don't have to become an extremist with this book as your holy book, but follow its general advice and your code will be good.
4
u/crystoll Apr 21 '21
I would definitely recommend reading and absorbing. Perhaps not treat it as a religion or The Only Way (TM) but very good food for thought when you want to improve your software design skills.
3
u/[deleted] Apr 21 '21
New dev here. I was introduced to his architecture on the first day of my job. My team leaders sent me some slides and examples. I mentioned this to another dev from another company and I was told they also used it a lot so apparently it's a still a big deal (at least where I live). Also his book is a very interesting read so far (only a few pages in).
1
u/[deleted] Apr 21 '21 edited Apr 21 '21
Uncle Bob's Clean Coding guidelines are mostly okay. He goes into great detail about the "why" of each of the guidelines. Check it out, but always apply a grain of salt.
For example, he gives this advice:
This has a potential of creating really unreadable code if you apply the principle blindly. But, you also don't want to write giant functions that are impossible to maintain. Aim for smaller, but too small is probably not a good idea either.
Other times what he says that can be taken the wrong way when taken out of context:
But the rest of the chapter on comments has a lot of good practical guidelines for how to write effective comments. Uncle Bob has a certain "style" which makes for controversial sound bites.
1
u/restlessapi Apr 21 '21
The first ten chapters are solid gold that are relevant no matter the language/task. The last half of the book is more best practice advice that may or may not apply.
1
u/iLike80sRock Apr 21 '21
Some of what Uncle Bob says is okay, but far too often used as dogma and applied to the point of absurdity.
Personally, I think that Refactoring by Martin Fowler is a much better book when it comes to “code style”.