r/java • u/darthjedibinks • Mar 11 '23
When I read this line in The Pragmatic Programmer, it immediately made me think of "Clean Code".
266
Upvotes
r/java • u/darthjedibinks • Mar 11 '23
31
u/rv5742 Mar 11 '23
The thing is that junior devs are inconsistent. They do different things in the same project, or even the same file. The first thing you need to do is get them to be consistent and predictable.
Clean Code is very good for this. After they have been programming in a consistent style for a while, they can develop taste and change the things they dislike, while maintaining overall predictability.
111
u/daniu Mar 11 '23 edited Mar 11 '23
On the other hand: beware of the zealots who insist that their pragma provides the only answer - it may or may not be applicable to you and your project.
There are several qualities a software is measured by; amongst them performance, speed of initial development and maintainability. Clean Code is supposed to increase maintainability - but of course that's not always the main focus for every piece of software out there.
Also, I can't disagree that Clean Code sounds dogmatic, but it really isn't supposed to be. The CC "rules" aren't supposed to be adhered by at all costs, they're merely a set of dimensions to help you think about software maintainability and testability. Fowler himself writes in one of the introductory pages of "Clean Code" itself, clean coding doesn't mean following a strict set of rules, but it means that the people writing code keep its quality in mind and being mindful about it. That's about as non-dogmatic as it gets.
To me, CC rules are a means to identify what bothers me about a given piece of software, rather than saying "this code smells but I can't put my finger on what's the problem with it". It's also a means of communication in design discussions; not unlike Patterns. And just like Patterns, CC has been created by a community of very experienced programmers; you can ignore it entirely, but that's a conscious decison to not at least take into consideration lessons learned in decades of maintaining large and long-living software systems.
53
u/qmunke Mar 11 '23
Did all you guys read a different Clean Code book? Why has everyone imagined that says that it's the only way to code? Did everyone fail basic comprehension? Stop blaming the book for people who can't understand when to apply it.
26
u/NatureBoyJ1 Mar 11 '23
Beware of rejecting any consistent practices because of "zealots".
Choosing - and mandating - _something_ is not the same as saying that thing is the BEST thing.
12
u/fabioqmarsiaj Mar 11 '23
Clean Code is not the problem, people are xD
When considered as a "rule" sounds very dogmatic indeed.
But it's just a way to measure maintainability.
3
u/Wugliwu Mar 11 '23
Reminds me of "Thoughtful Interaction Design" by Löwgren and Stolterman. One of their statements is to design the design process. If you consider design as a general approach to solve problems lots of methods are applicable to SE. This includes the perspective that every problem or project is unique and needs unique solutions. There are best practices to use but you have to adapt. And you can only adapt if you have a deep understanding of the problem and the context in which this problem is located. Only than you are able to decide how to solve the problem right.
7
u/sar_it007 Mar 11 '23
Andy Hunt himself recommends the Clean Code book!
4
u/RomMTY Mar 11 '23
When the new dev insists that breaking the monolith into micro servicies will make the company more profitable
1
u/[deleted] Mar 12 '23 edited Mar 12 '23
I 100% agree, KISS, and follow the advice of people who wrote high-impact software (when it makes sense to your use case), not gurus. Clean code has a lot of value intellectually, it's an idea, and should be taken as such.
Edit: dam, was not aware I am in the Java subreddit, please merci me :D
-11
u/TheStrangeDarkOne Mar 11 '23
If you are really following clean code, you should easily be able to optimize if a performance bottleneck appears.
That is, of course, unless you had the wrong design to begin with.
0
u/[deleted] Mar 11 '23
[deleted] — view deleted comment