Widdershin / programmers-oath

An oath for programmers, comparable to the Hippocratic Oath
Creative Commons Zero v1.0 Universal
723 stars 137 forks source link

Simplicity matters #4

Open veggiemonk opened 7 years ago

veggiemonk commented 7 years ago

Could we add something about the fact that a programmer should thrive towards simplicity?

It is implied when we say that we code for people, not machine. It would be nice to make it explicit.

To emphasizes simplicity’s virtues over easiness’, showing that while many choose easiness they may end up with complexity, and the better way is to choose easiness along the simplicity path.

Source: youtube 30 min: https://www.youtube.com/watch?v=rI8tNMsozo0 InfoQ 1h: https://www.infoq.com/presentations/Simple-Made-Easy Slides (PDF): https://github.com/richhickey/slides/blob/master/simplicitymatters.pdf

I don't want to build a statue of Rich Hickey but what he says rings so true!

What do you think?

Widdershin commented 7 years ago

I still need to watch that talk, it's been on my list for a while. I'll watch it and then get back to you so that we're on the same page. 😄

mo-g commented 6 years ago

I would argue that simplicity is secondary to elegance.

The first often implies the second, but they are not mutually inclusive and the second takes precedence.

veggiemonk commented 6 years ago

@mo-g Definition of elegance:

n.   Refinement, grace, and beauty in movement, appearance, or manners.
n.   Tasteful opulence in form, decoration, or presentation.
n.   Restraint and grace of style.

Definition of simplicity:

n.    The property, condition, or quality of being simple or uncombined.
n.    Absence of luxury or showiness; plainness.
n.    Absence of affectation or pretense.

I don't understand how elegance takes precedence over simplicity. Could elaborate a bit more please ?

mo-g commented 6 years ago

@veggiemonk And simple:

adj. easily understood or done; presenting no difficulty.

adj. plain, basic, or uncomplicated in form, nature, or design; without much decoration or ornamentation.

A piece of code can be simple, in that it is easy to understand and done, but be ugly and inefficient.

The first meaning of elegance in your definition is the most apt of the three - and code should express this in movement. A better definition is Wikipedia's definition of mathematical elegance:

The proof of a mathematical theorem exhibits mathematical elegance if it is surprisingly simple yet effective and constructive; similarly, a computer program or algorithm is elegant if it uses a small amount of code to great effect.

Note that simplicity is implied by elegance, but also requires effectiveness and constructiveness; so efficiency and productiveness. To reference 2., code is both art and mathematics (not to sound pretentious, but I see code as the application of poetry to mathematics) - the best code is a joy to read, displaying movement and rhythm.

veggiemonk commented 6 years ago

Hi @mo-g,

Thank you very much for clarifying that the pursuit is not about elegance alone but mathematical (or algorithmic ?) elegance which seems less subjective.

mathematical (or algorithmic ?) elegance = surprisingly simple yet effective and constructive

It seems to reach the same idea from the talk that something is simple if it is not braided

Good luck on promoting this project. It's a good start 👍

vassudanagunta commented 6 years ago

I totally believe in KISS, but this Oath is about ethics, responsibility and humanity, not about how to code or code quality, except indirectly as ethics, responsibility and humanity demand.

mo-g commented 6 years ago

That's a fair point, @vassudanagunta. I still would not be opposed to an element of this being incorporated as part of 8. which is the only tenet that is more about standards of coding than standards of moral conduct. One could argue that striving for simplicity and/or elegance in code is a responsibility, as code that does not meet these goals is often harder to debug, more resource demanding (and consequently environmentally harmful) and likelier to lead to negative outcomes - but at the same time, much of this is generally implied by 2., 3., 4., 6., 7., 8. already and does not need explicit mention.

vassudanagunta commented 6 years ago

@mo-g But simplicity is not always better. This Oath is not the place for that debate. The Oath should respect people's judgment, and not become overly prescriptive.

#8 is in my opinion the weakest one, and it may make sense to remove it altogether. See #59.

If we keep it, "take ownership of my work's flaws" is the kind of thing that belongs in the Oath, not specific technical advice.