DEV Community

[Comment from a deleted post]
Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that.

That's how you get modern day spaghetti code.

Functions should do one thing. They should do it well. They should do it only.

This rule is essentially meaningless. You can define "one thing" all the way from single operations (Addition, multiplication, etc.) up to the entire functionality of a simple program. Grep really only does "one thing", yet you'll all agree that writing a grep program in a single function is bad style.

Comments do not make up for bad code.

If you haven't ever written code that needed comments, you've never worked on a complex problem.

Clean code is pleasing to read, should make you smile.

Subjective; some people may find assembly code pleasing to read, the more gotos the better.

Clean code should read like well-written prose.

Programming languages will never be as readable as human languages, so a more realistic goal would be to get as close to it as possible.

Overall it's not a bad article. I'd say it's clear it focuses more on the object-oriented side of things. One thing I would add though, is that the formatting of the code is also very important.