Konubinix' opinionated web of thoughts

Working Code, Then Elegant Code

Fleeting

I believe that making a code work consumes a lot of cognitive load. Making the code elegant does as well. I believe that trying to do both at once easily overload the brain and results in bad work. I also believe that learning design patterns helps having several elegant designs in the intuitive brain and then allow creating elegant code at once. But, it has the drawback that because the analytic brain cannot be involved, sometimes, design patterns are used for situation that look like they would be useful but are actually not. It results in over-engineered solutions.

I like a lot the idea of test-driven development, where you can strictly separate both steps and give them the focus they deserve.

In the companies I have worked, I saw that the indicators where all about working code. It makes sense as the notion of « elegant code » is quite vague. Tools like sonarqube help having measures but it is not a silver bullet. In the end, I often saw quite inelegant code make to production (see Goodhart’s law).

Notes linking here