3 ms·
There's an implied assumption in this post that handling edge cases or one-off, extreme cases necessarily is done by writing ugly/dirty code. I think the whole
by lyudmil 15y ago
There's an implied assumption in this post that handling edge cases or one-off, extreme cases necessarily is done by writing ugly/dirty code. I think the whole point about writing clean code is avoiding the hacky stuff even if the problem is messy. We're in the business of articulating solutions to messy problems clearly enough so that they can be executed by a machine. The best professionals in our field do that, and also make it so that other people can read and understand their work. That's what clean code is to me.
Admittedly, there's room for interpretation and a degree of subjectivity here. However, this doesn't prevent us from knowing about what dirty code is and I don't see a compelling reason why we ought to tolerate it (e.g. long functions with a lot of branching are difficult for everyone to read, so you shouldn't have any of those; same goes for badly named variables/functions/classes).