←back to thread

Against Best Practices

(www.arp242.net)
279 points ingve | 1 comments | | HN request time: 0.369s | source
Show context
vbezhenar ◴[] No.42171296[source]
How other engineering industries deal with this phenomena? Why those approach do not work with programming? I feel silly sometimes because software development is huge industry and we don't have consensus on basics.

For example I think that strict formatting is a good thing. Since I tried to use Prettier I'm using it and similar tools everywhere and I like it. I can't do vertical alignment anymore, it eats empty lines sometimes, but that's a good compromise.

May be there should be a good compromise when it comes to "best practices"? Like "DRY" is not always best, but it's always good enough, so extract common stuff every time, even if you feel it's not worth it.

I often deal with this dilemma when writing Java with default Idea inspections. They highlight duplicated code and now I need to either disable this inspection in some way or extract the chunk of code that I don't really think should be extracted, but I just can do it and move on...

replies(12): >>42171363 #>>42171370 #>>42171393 #>>42171459 #>>42171531 #>>42171554 #>>42171817 #>>42171829 #>>42172784 #>>42173289 #>>42173799 #>>42174046 #
cjblomqvist ◴[] No.42171817[source]
A nit; DRY is probably not what you think it is. DRY is basically the same as SRP, framed differently. In SRP, it's totally valid to have the code twice if it has different meaning from a user pov.
replies(3): >>42171937 #>>42172010 #>>42180770 #
begueradj ◴[] No.42171937[source]
Quoted: "You can still not repeat yourself but violate single responsibility"

(https://softwareengineering.stackexchange.com/questions/2207...)

replies(1): >>42178144 #
1. safetytrick ◴[] No.42178144[source]
Quoted: "Likewise, you can repeat yourself but classes only have a single (duplicated, but subtly different) responsibility."