If it is too complex, you are probably doing it wrong
If there is one thing experience has taught me, it is that too much complexity
in some code usually means that design is wrong. That does not mean that
everything must and can be as simple as 2 + 2, but complexity should sound some
inner alarm and should make you reconsider your approach.
If basic concept, without all convenience features is hard to follow then it is
most certainly wrong. Adding convenience features can bring some additional
layers of complexity and certainly plenty of code, but they don't usually pose a
significant problem if basic concept is done right.
There are many practices, patterns and advices going around that should help
writing clean and maintainable code, but two stand before all else. Violate
them and you will be in trouble, sooner or later (usually sooner or in the
worst possible moment).
- KISS - Keep it simple stupid - https://en.wikipedia.org/wiki/KISS_principle
- YAGNI - You aren't gonna need it - https://en.wikipedia.org/wiki/You_aren't_gonna_need_it
Agreed ! I'd put one other principle even before those two - OnceAndOnlyOnce. On all levels.
ReplyDelete