2014 javaland - cargo culting and memes in javaland

58
CARGO CULTING AND MEMES IN FORGET EVERYTHING YOU THOUGHT YOU KNEW

Upload: nicolas-frankel

Post on 06-May-2015

415 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: 2014 JavaLand - Cargo culting and memes in JavaLand

CARGO CULTING AND MEMES IN

FORGET EVERYTHING YOU THOUGHT YOU KNEW

Page 2: 2014 JavaLand - Cargo culting and memes in JavaLand

2

ME, MYSELF AND I13 years consultingWide range of

businesses & customers

blog.frankel.ch & morevaadin.com

@nicolas_frankel

Page 4: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 4

MY JOBhybris:oE-commerce product

Page 5: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 5

CARGO CULTING VS MEMES

http://www.freedigitalphotos.net/images/athletes-at-starting-line-on-race-track-photo-p215478

Page 6: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 6

CARGO CULTING• Reproducing outer form

in order to get some benefits regardless of contexts

http://en.wikipedia.org/wiki/File:JohnFrumCrossTanna1967.jpg

Page 7: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 7

MEMES• Widespread ideas

• With no (or shallow) scientific proof behind

Page 8: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 8

DISCLAIMER“All characters

appearing in this work are fictitious. Any resemblance to real persons, living or dead, is purely coincidental.”

http://en.wikipedia.org/wiki/File:Morgan_County_-_Mann_road_-_horse_mannequin_-_P1080692.jpg

Page 9: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 9

DO NOT BELIEVE ME!You are not getting

sleepy!I do not want to

spread more cargo culting & memesoTry…

http://en.wikipedia.org/wiki/File:Caf%C3%A9_wall.svg

Page 10: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 10

CARGO CULTINGImagine living on a

paradise islandFree from daily world

contingencies

Page 11: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 11

Then come some white people in birds of steel

They build some stuff, and bigger birds of steel come, with bunches of people inside

Page 12: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 12

And the birds of steel have plenty of good food inside

With no need to go fishing…

http://en.wikipedia.org/wiki/File:FishingVillage_HaLongBay_Vietnam_%28pixinn.net%29.jpg

Page 13: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 13

When they all go away, what’s the smart thing to do:oGo fishing again?oOr build the same stuff and hope to attract more birds of steel?

Very crude summary of Cargo Culting during WWII (in the Pacific)

http://en.wikipedia.org/wiki/File:JohnFrumCrossTanna1967.jpg

Page 14: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 14

THE DEVIL IS IN THE DETAILOnce upon a time,

there was a young developer

He started using Java 1.3

And was taught that local variable declaration was heavy on performance

http://bit.ly/NOv2cq

Page 15: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 15

Some years later, he became an « expert »

And wrote some good practices guidelines

Including declaring local variables outside loops

int nb = 0;for (int i = 0; i<n; i++) { ...

}

Page 16: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 16

He was very happyAnd all developers

happily followed his rules

Page 17: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 17

Until… a new developer came in town

And threw the gauntlet by claiming:« You shall declare your variables in the narrowest scope possible »

This meant inside the loop

Page 18: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 18

The « expert » accepted the challenge

And coded a small snippet to assert his claims

It failed miserably… JDK 1.4 was smart

enough to produce the exact same bytecode regardless where the variable was declared

Page 19: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 19

The « expert » was sorely disappointed

But realized a very important fact

« There’s no universal truth, it all depends on the context »

Page 20: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 20

Also applies to:oFoodoReligionoSportsoYou name it

http://en.wikipedia.org/wiki/File:Shunsuke1_20080622.jpg

Page 21: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 21

FACTSAt this time, I don’t

know if that was ever trueoI suppose it was

I found nothing supporting this (or the opposite) on the InternetoDownloading and installing Java 1.3 sucks

Page 22: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 22

DATA TRANSFER OBJECTOnce upon a time,

there was platform called J2EE

Which provided a bunch of API

Page 23: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 23

EJB Entity - a real heavyweight object, was bound to the container

So Sun crafted a magical artifact, the DTO

To allow for data to go outside the container

Page 24: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 24

The birth of EJB 3 brought a new Golden Age

And freed people of the tyranny of the EJB Container

Sadly, many developers still flock to the banner of the DTO

Page 25: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 25

ALTERNATIVES1. When no association

requiredoUse the entity directly

2. Use eager associations

3. Use the OpenSessionInView filter

o…

4. Call getters to force load

5. Use JOIN FETCH

http://en.wikipedia.org/wiki/File:The_A34,_Donnington.jpg

Page 26: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 26

XML IS BAD10 years ago, it was

all XMLoCan be validated against a schema

XML became evil with the coming of annotations in Java 5

http://en.wikipedia.org/wiki/File:XML.svg

Page 27: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 27

CRITICS AGAINST XMLVerboseAre not compiledoErrors (beyond grammar) are discovered at runtime

Page 28: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 28

SELF-ANNOTATED CLASSES

@Service

@Scope("prototype")

public class MyBean {

@Autowired

private MyRepository myRepo;

...

}

Page 29: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 29

Pros Cons

Everything in the same place Couples code to Spring

Compiled Prevents reusability

Allows bad design

Page 30: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 30

ALTERNATIVESXMLJavaConfigoCompiledoWith no con of self-annotated classes

Page 31: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 31

JAVACONFIG EXAMPLE@Configuration

public class JavaConfig {

@Bean(scope=PROTOTYPE)

public class myBean() {

return new MyBean(myRepo());

}

@Bean

public class myRepo() {

return new MyRepository();

}

}

Page 32: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 32

RELATED TO CARGO CULTINGCopy-Paste Driven

ProgrammingReverse Cargo

Culting:oForget the form because the context is different

http://en.wikipedia.org/wiki/File:Da_Vinci_Vitruve_Luc_Viatour.jpg

Page 33: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 33

SPOTTING CARGO CULTING“We’ve always done

like that”“It’s always been

working”

Page 34: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 34

HOW NOT TO CARGO CULTQuestion reasons

behind decisionsYou cannot always be

up-to-dateoListen to others and their argumentsoAdmit you’re wrong (when you are)

Yes, it’s hard and time-consuming!

Page 35: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 35

MEMESCargo Culting can be

remedied if the cultist is rational and willing to listen

Memes are way more pervasive

Based on faithAnd you never can

convince a faithful to renounce his faithoOnly if he’s not a true faithful

Page 36: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 36

MY ILLUMINATIONThe Leprechauns of

Software Engineering

https://leanpub.com/leprechauns

Page 37: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 37

THE 10X PRODUCTIVITY RULE“A good programmer

can be as 10X times more productive than a mediocre one”

Page 38: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 38

SACKMAN & AL. 1968

“exploratory experiments (...) to compare debugging performances of programmers working under conditions of online and offline access to a computer”

Ratio of 28:1oSubject 7 required 170 hours to program the

algebra program in a batch environment in machine language

oSubject 3 required 6 hours to program the same problem in ALGOL in a time-shared environment

Page 39: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 39

Ref. Direct? Tasktype

Samplesize

Pop. Measure Variation

Curtis 1981 N Debug 27 Pros Time-to-compile

22:18:1

Mills 1983 Y ? ? ? ? 10:1

DeMarco & Lister 1985

Y Programto spec

166 Pros Time-to-complete

5,6:1

Curtis & al. 1986

N N/A N/A N/A N/A Various

Card 1987 N Project ? Pros LOC per staff hour

Notclaimed

Boehm & Pappacio 1988

N N/A N/A N/A N/A Various

Valet & McGarry 1989

N Project 150 Pros LOC per staff hour

Notclaimed

Boehm 2000

Y Project 161projects

Pros Manager’s evaluation

Notclaimed

Page 40: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 40

PRODUCTIVITY IN SOFTWAREWhich metrics?oLOC?oAny is trivial to game...

Which task?oMust be the same in order to compare

Which population?oPros have other things to do

Page 41: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 41

MY EXPERIENCEThere’s a difference in

productivityoBut I never could quantify

I can only say if one developer is more productive than another in a specific area

Software is a team effort!

Page 42: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 42

BUT REJOICE!Other domains are

not free of memes eitheroProject ManagementoGraphical Design

Page 43: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 43

Source: http://www.peterbormer.com/

Page 44: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 44

THE SOURCE OF “TRUTH”

Software Engineering Economics – Boehm, 1981

Made famous in Rapid Development – McConnell, 1996

Page 45: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 45

It makes sense that uncertainty decreases with time passing...

Does it make sense that:oIt is symmetric?oIt follows f(x) = -a/x?

Page 46: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 46

MY EXPERIENCE

Page 47: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 47

IMAGES ARE READ LTR

When I was younger (a long time ago), I was told that images should be designed to be read left-to-rightoAnd right-to-left for native Arab / Hebrew speakers

Page 48: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 48

Then came a device to follow eyes movements

And they made an experience on the TV

Page 49: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 49

Page 50: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 50

RELATED TO MEMES“No True Scotsman”

Logical fallacyIdeology

http://en.wikipedia.org/wiki/File:Bagpiper_in_Edinburgh_001.jpg

Page 51: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 51

NO TRUE SCOTSMAN“Scotsmen do not put sugar on their porridge

- I’m a Scotsman and I put sugar on my porridge

- No true Scotsman sugars his porridge”

https://yourlogicalfallacyis.com/

Page 52: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 52

CODE IS SELF-DOCUMENTING“Yet I cannot make this code clear without comments.

- Then it’s bad code!”

Page 53: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 53

AGILE DELIVERS“Yet my last Agile project went wrong.

- Then it must not have been truly Agile”

http://en.wikipedia.org/wiki/File:Pair_programming_1.jpg

Page 54: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 54

IDEOLOGYMemes and

ideologies are based on faithoMemes are largely sharedoIdeologies are more restricted

• Counter-ideologies

Page 55: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 55

THIS IS CRAPIt’s not proper:oObject-Oriented ProgrammingoFunctional ProgrammingoYou name yours

http://en.wikipedia.org/wiki/File:Pet_Waste_Station.jpg

Page 56: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 56

THOSE ARE WAYS!My goal is to achieve

those properties:oReadabilityoTestabilityoMaintainability

So long as I get them, I don’t careoBetter to have a unique paradigm in an application

Page 57: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 57

SPOTTING MEMES

http://en.wikipedia.org/wiki/File:Foam_-_big.jpg

Page 58: 2014 JavaLand - Cargo culting and memes in JavaLand

@nicolas_frankel 58

THANKS FOR YOUR INTEREST