writing code that lasts - jab14

Post on 16-Apr-2017

19.446 Views

Category:

Engineering

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Writing code that lasts.

Rafael Dohms@rdohms

photo: djandyw.com

Writing code you won’t hate tomorrow.

Rafael Dohms@rdohms

photo: djandyw.com

Let me introduce you to someone…

No Tests.

Wrote his own framework.

500 line methods.

Used Singletons!

photo: Rob Allen (@akrabat)

REWRITEALL THE CODE!

Real Developers, SHIP STUFF.

photo: Glyn Lowe Photoworks

How do we find balance?

photo: Kalexanderson

Code has an expiration date

photo: CarbonNYC

Code is perishable, it rots.

photo by: massdistraction

Code Evolves

photo by: kevin dooley

Languages evolve.photo by: raneko

You evolve.

photo by: Kaptain Kobold

Complexity kills Comprehension

photo: osbornb

Bad Design

photo: miskan

Bad specs

NIH

source: Urban dictionary

photo by: John 'K'

NIH| nɒt ɪnˈventɪd hɪə |

Not Invented Here —The German art of humiliating any technology, agricultural product, or (medical) scientific work that has not been

invented or produced in Germany, Switzerland, or Austria.source: Urban dictionary

photo by: John 'K'

The Solution™photo: Ian Sane

Improve code

Improve codemake it easier to comprehend

Improve codemake it easier to comprehend

make it flexible

Improve codemake it easier to comprehend

make it flexible

make it tested

Improve codemake it easier to comprehend

make it flexible

make it tested

make it easier to replace, refactor

Improve codemake it easier to comprehend

make it flexible

make it tested

make it easier to replace, refactor

make it not exist

Good Design Concepts

SOLIDSingle ResponsibilityOpen/closeLiskov substitutionInterface segregationDependency inversion

STUPIDSingletonTight CouplingUntestabilityPremature OptimizationIndescriptive NamingDuplication

Composer

PIEProudly

InventedElsewhere

guzzle/guzzleHTTP client for RESTful API clients

morrisonlevi/ardentA library of collections for PHP

Readability

photo: Morgenland

paragraphs

photo: Trossachs Photography

whitespace

R&D Team for MIH/Naspers

São PauloCape Town

Object Calisthenics

photo by: boston_public_library

Calisthenics/ˌkaləsˈTHeniks/

Calisthenics are a form of dynamic exercise consisting of a variety of simple, often rhythmical, movements, generally using minimal

equipment or apparatus.

photo by: boston_public_library

Its about perception, not rules or standards

photo by: david_a_l

Sunday12:00

Voyager Room

#1 Only one indentation level per method.

photo by: justinliew

#2 Do not use else

photo by: justinliew

#3 Wrap primitive types, if they contain behavior

photo by: justinliew

#4 Only one -> per line

photo by: justinliew

#5 Do not abbreviate.

photo by: justinliew

#6 Keep your classes small.

photo by: justinliew

#7 Limit your instance variables to less then 5

photo by: justinliew

#8 Use first class collections

photo by: justinliew

#9 Use getters and setters.

photo by: justinliew

#10 Document your code.

photo by: justinliew

Your turn.

Improve yourself!

Read lots of code!

Write simple code.

Try Object Calisthenics for a month.

Use someone else’s code.

Share bite size libraries.

Thank you.

http://slides.doh.ms

http://doh.ms

@rdohms

top related