4 ms·
This is completely right. People read about design patterns or DRY, usually apply them wrong since they're still learning... and then act like it's the source m
by jackblemming 3y ago
This is completely right. People read about design patterns or DRY, usually apply them wrong since they're still learning... and then act like it's the source materials fault?
- hardware2win 3y agoWell, it kinda is? Teaching materials should show how to not refactor too. Also have u seen refactors in clean code? Guy refactors thread safe code by introducing static variables which make code not thread safe, but hey! At least it is a little bit shorter!
- ajuc 3y agoYup this is the worst part of Clean Code. I've seen real-life bugs caused by this kind of refactoring. The best part is that the same commit added unit tests so our coverage grew over the magic 80% bar, but of course unit tests don't usually test for race conditions.
- resonious 3y agoIf there is a source material that many people are "applying wrong", then I'd question the quality of that source material.
- sime2009 3y agoDesign patterns, for example, really should only be studied once you have quite a bit of experience with complex code bases under your belt. You need to have done battle with some nasty code problems in bigger code bases before you really understand the problems design patterns are trying to solve. Inexperienced developers can't be trusted to apply them because they don't have that judgement. It just looks like a shiny thing.
- farhanhubble 3y agoTrue for so much of compsci stuff. You won't understand regular languages, automata, grammars etc until you have done a fair bit of pattern grokking yourself.
- whstl 3y agoThe problem is that the source material (the Clean Code book in this case) has almost no caveats. And it rarely acknowledge other styles or points of views. For example, when the book discusses possible objections to having "lots of small functions", it simply doubles-down, suggesting also having tons of small classes, and rationalizes it. Experienced developers know that reality is a bit more nuanced than that. This is actually a big reason for the popularity of the book, showing a "one true way". And this carried on to followers of the style. Some linters even enforce the style without much regard for the practicality of it.
- ajuc 3y agoImagine if math books told you that you should ALWAYS solve for X and if somebody tells you to solve for Y they are a bad mathematician :) That's Clean Code.
- SonicScrub 3y agoI don't see how that's a fair characterization of a book that has this quote in the first chapter: > Many of the recommendations in this book are controversial. You will probably not agree with all of them. You might violently disagree with some of them. That’s fine. We can’t claim final authority. On the other hand, the recommendations in this book are things that we have thought long and hard about. We have learned them through decades of experience and repeated trial and error. So whether you agree or disagree, it would be a shame if you did not see, and respect, our point of view. It's been a while since I've read Clean Code, but I seem to recall it stated many times that blindly applying the rules of Clean Code without good justification would lead to bad code. The author even provides examples of this. People in this thread are criticising Clean Code principles as if they are meant to be a rigidly enforced dogma. They aren't, and the author never intended them to be so.
- nemetroid 3y agoI think that quote is a good example of why it is a fair characterization. It uses the authors’ seniority to argue from authority, even explicitly requesting respect. To a beginner, it reads like ”these are subjective matters so experience is king, and we have more experience than you do”.
- SonicScrub 3y ago"Respecting my experience" does not translate to me as "do everything exactly accordingly to these strict rules". To me it says "consider my opinions before doing something different". Consider. Not follow blindly. I can see how one may interpret it as the first if they read the quote in isolation, but certainly not in the context of the book. Which, as mentioned before, goes out of its way to state these rules are more like guidelines, and gives examples of where strict adherence causes worse code.