Radical perfectionism in the code

The idea was taken from the posts of the telegram channel Cross Join







Imagine that some programmer comes to work wearing only his underpants. Or even naked. Work has stopped, everyone is discussing what is happening, laughing or making a face, nobody is working. The leader comes and tries to do something.



Bad decision : Introduce a dress code for the entire organization. Suit, tie, white top, black bottom, polished shoes, no piercings, that's all.

Brad, isn't it? Well, yes, too radical. In general, let people walk as they want and feel good. Exceptional situations need to be resolved privately (fire the bully?), Well, as a last resort, introduce a rule that in addition to linen, there must be something else.







Indeed, nonsense. Well, why then do we ourselves introduce mad fascism in the code?







The rules are too strict



Take a look at the code style rules. PSR-12 standard , for example.







Here are some points:







  1. There must be a line feed at the end of each file. And if not, then who will die?
  2. You cannot make multiple statements on one line. If I write $x = 1; $y = 1; $z = 1;



    , the readability will deteriorate by 0.00001% and can the technical department be closed?
  3. Declare statements MUST contain no spaces and MUST be exactly declare(strict_types=1). , . , MUST , . - , !


, -







declare(        strict_types                                              =1         )
      
      





, . . , .







, , - , , , , .







, , . , , .







, . : , .









, pet-, , , , , , . .







! .







. , . .







, , . , , , . . .







, Go goimports, , . , . , getJson getJSON getById getByID, N100500 . , , , .







. , . , . . , , — , - — .







" — " . — .







. ( DRY SOLID) , . switch case — . .







, , " ".







, . , , - ( ). , financial responsibility center. "FRC", , . , . financialResponsibilityCenter, , , -.







, , — . , ? , . , , - .









, :







, , .



, , . .

UPD. - , .







I really hope for a discussion in the comments. UPD I already regretted that I inserted the style into the example about the code. People were so angry at this that the main idea was completely lost. I'm against shitty code and sloppy design. But I am also against rules that can be dispensed with.








All Articles