5 ms·
Very often so-called best practices are really quite bad and ended up considered best practices more for marketing reasons than because of merit. Let me list so
by cjfd 5y ago
Very often so-called best practices are really quite bad and ended up considered best practices more for marketing reasons than because of merit. Let me list some 'best practices' that are actually quite bad in many, if not most, circumstances: git flow, comments for every method parameter, microservices, feature branches, automated code formatting, scrum.
- worble 5y agoThe rest I could see arguments for, but could you explain how automated code formatting is a bad practice in most situations? Personally I find a consistent looking codebase makes it so much easier for team members to come in and reason about code they've potentially never seen before.
- cjfd 5y agoWell, you know, it sounds kind of nice to have your codebase auto-formatted so it looks nice without the programmer having to do this by hand. Problem is, current formatters never seem to exceed the borderline-passable level of formatting and I actually really like nicely formatted code. E.g., when the parameter list of a function no longer fits on the same line as the function name one can either split it over two lines or give every parameter a line by itself. I tend to make this depend on how complex the parameters are. If they are very simple, like just a short variable name I put them on one line and if they are some complicated expression I will put each of these expressions on a line by themselves. I think this really makes a difference in readability. Auto formatters generally have some fixed one-size-fits-all policy for this. And this is just one example. There are many more cases where a tasteful approach yields more readable code than a very uniform approach. Besides this, I have also seen situation where the formatting guide lines become a way for one developer to force his preferences on another developer. This is really not nice. I have been in a situation where I really had difficulty reading the code just because it was formatted in a strange way. 'We just have to pick something and picked this'. 'No we cannot have exceptions because we don't want to waste time on discussing trivial matters like code formatting'. 'Yes, my personal exceptions to the standard that we use were applied but yours cannot'.
- d3ckard 5y agoHistory rewriting might be a problem.
- imtringued 5y agoI think he went too far into the other extreme. The idea of worst practices and best practices is questionable in either direction.
- chromanoid 5y agoThis is always the case when somebody invents a word for something people should follow. If the vocabulary changes marketing will change with it. The problem is people are searching for silver bullets, not marketing that serves those desires.
- imtringued 5y agoThere is no way that you can give advice that is the best in every single situation. There will always be exceptions and tradeoffs.