+ All Categories
Home > Technology > Simple Code

Simple Code

Date post: 14-Jun-2015
Category:
Upload: rui-carvalho
View: 409 times
Download: 2 times
Share this document with a friend
Description:
Why Simple Code matters ? Simplicity is the key for delivering the right software that matter
Popular Tags:
49
Simple Code - e Simple Life in Soware Land - 1 Rui Carvalho @rhwy :: rui.fr
Transcript
Page 1: Simple Code

Simple Code- The Simple Life in Software Land -

1Rui Carvalho @rhwy :: rui.fr

Page 2: Simple Code

2

I’m Agile, Should I care?

Page 3: Simple Code

3

Agile Cats

Page 4: Simple Code

4

follow XP rules

Agile Cats

Page 5: Simple Code

5

Complexity is Everywhere

Page 6: Simple Code

6

Complexity is Everywhere

and making things simple is hard!

Page 7: Simple Code

7

The Domain Complexity

Page 8: Simple Code

Customer needs ‘Foo’

8

Page 9: Simple Code

…You think schema ‘Bar’

9

Page 10: Simple Code

Wrong models cause massive accidental complexity

Greg Young10

Page 11: Simple Code

11

Solving the wrong problem

Page 12: Simple Code

12

« It should go faster ! »

Page 13: Simple Code

13

Change the Engine, problem solved!

Page 14: Simple Code

14

Hidden Technical Complexity

Page 15: Simple Code

15

Frameworks?

Page 16: Simple Code

16

Page 17: Simple Code

17

Page 18: Simple Code

18

How big ?

Page 19: Simple Code

19

Config > Domain

Page 20: Simple Code

A framework …

= calls you20

Page 21: Simple Code

21

You

Call

the Library

Page 22: Simple Code

all that matters!

Bad Understanding Poor design No design

Technology locking

22

} Generates Complexity !

Page 23: Simple Code

23

Technical debt is watching you!

Page 24: Simple Code

24

Page 25: Simple Code

25

Start simplicity now before it blows you!

Page 26: Simple Code

26

How to start ?

Page 27: Simple Code

27

Remember Agile Principles?

Page 28: Simple Code

the 4 XP Simplicity Rules

• Runs all the tests.• Expresses every idea that we need to express.• Says everything Once And Only Once.• Has no superfluous parts.

28Kent Beck

Page 29: Simple Code

the 4 elements of Simple design

• Passes its tests• Minimizes duplication• Maximizes clarity• Has fewer elements

29

Page 30: Simple Code

2 final rules

Developing strong skills of detecting duplication, removing duplication,

identifying naming problems, and fixing naming problems equates to learning

everything ever written about object-oriented

30

JbRains

Page 31: Simple Code

31

Simple Design Dynamo

(c) jbrains 2013

Page 32: Simple Code

32

What else ?

Page 33: Simple Code

Better Naming

Iterate & refactor 33

Remove Duplication

Page 34: Simple Code

What problem are trying to solve?

Always!34

Page 35: Simple Code

Avoid coupling

everywhere, from classes to libraries

35

Page 36: Simple Code

Be Consistent

Readability, Rules, Conventions36

Page 37: Simple Code

Be functional!

Be declarative, Immutable, use lambdas

37

Page 38: Simple Code

Practice !

Practice, Practice, Practice ! …

38

Page 39: Simple Code

Get more Fun

39

Page 40: Simple Code

All you need…http://c2.com/cgi/wiki?

ExtremeProgrammingRoadmap

40

http://blog.thecodewhisperer.com/2013/12/07/putting-an-age-old-battle-to-rest/

Simple Design Dynamo

Page 41: Simple Code

Hand written sketches are by me and can be reused under Creative Commons licence, other images are owned by their authors and I really

would like to thank them if I found all credits …41

@rhwy

Page 42: Simple Code

42

Add-on:

lambda refactoring

Page 43: Simple Code

43The Silence of the Lambas

Page 44: Simple Code

44

interface IPriceCalculator {double GetPrice(string productReference)

}class Basket {

IPriceCalculator calculator;public Basket(IPriceCalculator calculator) {

this.calculator = calculator;}public Result AddProduct(

Product product, int quantity) {Price = calculator.GetPrice(product.Reference);//other magic here

}}

Page 45: Simple Code

45

class UserPriceCalculator : IPriceCalculator{

public double GetPrice(string productReference){ //do some magic stuff here

return price;}

}

var basket = new Basket(new UserPriceCalculator());basket.AddProduct(theProduct, 2);

Page 46: Simple Code

46

class Basket {public Result AddProduct(

Product product, int quantity,Func<string,double> calculator) {

Price = calculator(product.Reference);//other magic

}}

var basket = new Basket();basket.AddProduct(theProduct, 2, x=>x.rawPrice*0,85 );

Page 47: Simple Code

47

Add-on:

More quotes

Page 48: Simple Code

There is no good

but some of them are useful

48

{ Model | Architecture | persistance }

Page 49: Simple Code

49

“Templates, patterns, frameworks don’t solve anything”

they are just tools to start faster


Recommended