Reducing complexity


(Alexander Makarov) #1

I think making code as simple and readable as possible is one of the most important goals every developer should try to achieve. Here’s an article that shows some improvements that could be made to virtually any code: https://www.ibuildings.nl/blog/2016/01/programming-guidelines-php-developers-part-1-reducing-complexity

What do you think? Do you have more tricks?


(Softark) #2

Thank you, the article was really enlightening.

There’s one thing missing from the article that I usually follow:

Don’t be afraid to be verbose.

Shorter code doesn’t always mean simpler one. :)


(Steward) #3

Good article, but many tips left without mention.

The book recommended at the bottom of the article (Code Complete, by Steve McConnell) is the bible, it includes them all. I cheerfully recommend it.

For most long-time experienced programmers there is nothing new, yet it remains an excellent read. "Good to be reminded".

The book is a must have for junior programmers.


(Softark) #4

One more thing.

Don’t try to optimize your code unless it’s really necessary.

We tend to write unnecessarily lengthy and/or complicated code that only leads to a negligible performance improvement.