why do lazy developers write beautiful code?

33
Why do lazy developers write beautiful code?

Upload: javier-arias-losada

Post on 28-Jan-2018

332 views

Category:

Technology


0 download

TRANSCRIPT

Why do lazy developers write beautiful code?

Why lazy developers write beautiful code?

Who is this guy?

@javier_arilos / Javier Arias Losada

Programming as building construction

CASE - Computer-Aided

Software Engineering

Software development is a wicked problem

"wicked": a problem

whose solution can be

defined only by

solving it*.

Engineering essence: elegant efficiencybest

engineering is born out of an imperative to

use the minimum amount

of materials

Is software development like science?

Art the expression or application of human creative skill and

imagination

producing works to be appreciated primarily for their beauty

Programming and painting

How Picasso paints a womanhttps://youtu.be/V1UmPiUlFis

Programming and painting

● sketching

● gradual refinement

Beauty

a combination of qualities, such as shape, colour, or form, that

pleases the aesthetic senses, especially the sight.

"The Magical Number Seven,

Plus or Minus Two: Some

Limits on Our Capacity for

Processing Information" -

George A. Miller, 1956

The Magic Number Seven, +/- Two

"beautiful code" is not an abstract virtue

beautiful code must help the

programmer be happy and

productive

beautiful code is easy to

understand

Yukihiro Matsumoto (Ruby Creator)

Brevity & no redundancy

Familiarity

Simplicity

Flexibility

Balance

>>> import this, The Zen of Python

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Although practicality beats purity.

If the implementation is hard to

explain, it's a bad idea.

If the implementation is easy to

explain, it may be a good idea.

Namespaces are one honking great idea --

let's do more of those!

Kent Beck (XP/agile)

Passes the tests

Reveals intention

No duplication

Fewest elements

Clean code - Uncle Bob

The only

valid

measurement

of code

quality:

WTFs/minute

Laziness

the quality of being unwilling to work or use energy; idleness.

Tips for lazy developers

Tip 1. Use the right tools

Optimise for development time, not execution time

Tip 2. Be pragmatic

Tip 3. automate all the things

Tip 4. Fast feedback is king

Law 5. Write beautiful code

Inspired by...

Lazy person

"I will always choose a lazy

person to do a difficult job

because a lazy person will

find an easy way to do it."

Bill Gates

Laziness

“The quality that makes you go to

great effort to reduce overall energy

expenditure. It makes you write

labor-saving programs that other

people will find useful, and document

what you wrote so you don't have to

answer so many questions about it.

Hence, the first great virtue of a

programmer.”

Larry Wall - Perl author

Done. Now I think I can use some rest.

@javier_arilos / Javier Arias Losada

references

Jeff Atwood - Development is Inherently Wicked https://blog.codinghorror.com/development-is-inherently-wicked/

Jeff Atwood - Good Programmers get off their butts https://blog.codinghorror.com/good-programmers-get-off-their-butts/

Yukihiro Matsumoto - Treating Code As an Essay https://www.safaribooksonline.com/library/view/beautiful-code/9780596510046/ch29.html

Code Complete: A Practical Handbook of Software Construction, Second Edition by Steve McConnell: http://a.co/exQvydH

Bartosz Milewski - Category: The Essence of Composition: https://bartoszmilewski.com/2014/11/04/category-the-essence-of-composition/

Joe Armstrong - Why programming is difficult http://joearms.github.io/2014/02/07/why-programming-is-difficult.html

Martin Fowler - Beck Design Rules https://martinfowler.com/bliki/BeckDesignRules.html

Rob C. Martin - Clean Code https://www.amazon.com/dp/0132350882/ref=cm_sw_r_tw_dp_x_g-JXzbJT5GS7X

Abstract

There has been a lot of discussion during the last 50 years about the nature of

programming: Is it an art like poetry? Is it craftsmanship like pottery? Is it an

exact science like physics? Or a non exact science like medicine? Is it engineering

like bridge building?

Whatever the nature of software development is: during this time, a lot of tools and

techniques have appeared to make your lazy-developer life more difficult: Coding

conventions, OOP, FP, SOLID, Design Patterns, Tests, TDD, UML, Use-cases, CASE tools,

Refactoring, RUP, Agile, SCRUM, Continuous Integration, Code Complexity Metrics,

Emergent Architecture, DevOps, SCM... and whatnot!

But, sometimes, being a lazy developer makes you do things that seemed

counterintuitive, in order to pursue your main objective: WORK LESS.