Okay - first things first... I am in no way anti-clean code, and I'm not saying it is necessarily a bad thing.
However... in recent years it seems to be becoming more like a religion - with overzealous 'experts' preaching it to the young faithful as the 'one true gospel', and condemning those who dare to speak against it as heretics. This is more like a cult and is profoundly unhealthy for our industry.
Yes, and no... depending on what you take it as meaning.
The word 'clean', in relation to code quality is obviously subjective and can mean wildly different things to different people - but I think we can all agree that the core of what is intended is:
Code whose purpose is clear to most who read it.
If we leave it there, that is a noble goal and will have many obvious benefits.
'Clean Code' starts to become a problem when its proponents treat it as a series of dogmatic commandments, rather than as a 'pirate code' that is more like 'guidelines'.
Well... and this is just my personal theory - it seems to have created a mentality where:
The code should be understandable by the most junior dev in the team
I've actually heard this said in some places I've worked, and I've seen similar sentiments echoed online by 'expert' tutors. But, just think it through... if we adhere to this mentality then everything becomes a race to the bottom.
We would actively seek to dumb down code to the point where it is more like an introductory reader for a five-year-old than an elegant, nuanced work by a master author.
Advanced concepts in languages are deemed 'too difficult' or 'esoteric' without explaining anything about them - they're just swept under the carpet, or filed under 'do not use'. The overall result is a shrinking knowledge of the languages, and of programming techniques and concepts in general.
If an indoctrinated new developer comes across any of the 'forbidden' items, they will often dismiss it as bad code and may even seek to replace it with something 'better' that adheres to the clean code commandments - sometimes unwittingly sacrificing objectively faster, more efficient, flexible code with something inferior.
The scary thing here is that the new developers do not know what they lack. They then become senior and start preaching the same 'correct way' to the next crop of inductees - perpetuating and compounding the problem.
I think the best way is to change the way people are learning to code.
We need to move away from 'you too can be a developer in 3 days - here's how' type tutorials that jump straight in there and show you how to do specific things in specific ways, and move back toward teaching people about the languages themselves, their features, and how to use them to convert your thought processes into functioning programs.
The next step would be encouraging people to build for themselves - based on what they've discovered and learned. After this, they will be well versed in how things work and at a great point to start understanding existing codebases in their own way, and evaluating for themselves (maybe with some guidance) which techniques are better suited to different situations.
Learning in this way will bring a much fuller understanding - resulting in much more competent, and - more importantly - creative developers.
To make an analogy, I believe modern teaching of software development has become too much like modern Lego. It used to be that you just had a huge tub of bricks, and you used your own ingenuity and imagination to firstly work out how all the pieces 'work' and fit together... then use your imagination and creativity to build the things you wanted to build. Nowadays, it's all single Lego sets with specific instructions, movie tie-ins, etc.
The instructions are followed unquestioningly, everyone builds the same 'cool' things. The joy and benefit of learning and creativity are lost - replaced with the instant gratification so desired in modern convenience culture.
Let's stop the rot, and bring back to software development what is being lost:
Cover illustration courtesy of Danny Sapio
Also Published here