39
No Reuse Before Use [email protected]

No Reuse Before Use

Embed Size (px)

DESCRIPTION

The software industry has an overloaded expectation for reuse. And different people have different expectation from software reuse. When reuse happens before actual use, the reality is often quite different than everybody's expectation. This talk promotes working software that has customer value, once-and-only-once over reusability, simplicity before generality, use before reuse.

Citation preview

Page 2: No Reuse Before Use

Who Am I

2

• I am Terry Yin!• Work for Odd-e!• Experienced in software development!• Focus on technical coaching!• Love programming!• A father

Me

Page 3: No Reuse Before Use

This talk is about

ReuseUse

Working Software That Has Customer Value

Software

Design Patterns

Common Platform Library

Framework

Object Oriented DesignGeneric Programming

Meta Pr

ogram

mingMiddleware

Domain ModellingOpen Source

3rd Party

Java

Page 4: No Reuse Before Use
Page 5: No Reuse Before Use

Let’s Visit A City !On The Opposite Side of the Globe

Page 6: No Reuse Before Use

6

Page 7: No Reuse Before Use

7

Page 8: No Reuse Before Use

Planned City

Oscar Niemeyer

Page 9: No Reuse Before Use

9

Page 10: No Reuse Before Use

10

10,000 pedestrian lives are lost on Brazilian road in

2012, whom in theory do not existing in Brasilia.!

(270, 000 around the world)

Page 11: No Reuse Before Use

"Organic planning does not begin with a preconceived goal; it moves from need to need, from opportunity to opportunity, in a series of adaptations that themselves become increasingly coherent and purposeful, so that they generate a complex final design, hardly less unified than a pre-formed geometric pattern.” !— Lewis Mumford explained further what he admired in medieval cities

Page 12: No Reuse Before Use

what if design from use …

12

Page 13: No Reuse Before Use

13

Software Reuse

what our graphic designer thinks it is

what programmers think it is what architects think it is

what customers think it is what managers think it is what really happens

Page 14: No Reuse Before Use

14

what our graphic designer thinks about reuse

Page 15: No Reuse Before Use

15

Why cannot the graphic designer think about something more

abstract?

Software developers are!trained in!

abstract thinking

Page 16: No Reuse Before Use
Page 17: No Reuse Before Use

17

what programmers think about reuse

Page 18: No Reuse Before Use

Duplication

18

Duplication may be the root of all evil in

software.

Clean Code, Robert C. Martin

Page 19: No Reuse Before Use

If Copy-Paste Is Bad• What about designing a library?!• What about inheritance?!• What about composition?!• What about using a framework?

19

Maybe Yes, Maybe No. Stop Speculating, and make something that works first!

Page 20: No Reuse Before Use

Refactoring• Small steps!• Look for code smells!• Following design principles!

- SOLID!- High cohesion, low coupling!- Once And Only Once!

• Design emerges from working code

20

"Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure."

Refactoring: Improving the Design of Existing Code by Martin Fowler

Page 21: No Reuse Before Use

Pattern Or Anti-Pattern

21

If you’d like to become a better software designer, studying the evolution of great software designs will be more valuable than studying the great designs themselves. For it is in the evolution that the real wisdom lies.

Refactoring to Patterns, Joshua Kerievsky

Page 22: No Reuse Before Use

Emergent Design

22

Code, listen you shall.

Let the design be the way it wants to be!

Page 23: No Reuse Before Use

Why Upfront Design Fails?

23

Page 24: No Reuse Before Use

24

what architects think about reuse

Page 25: No Reuse Before Use

The Second-System Effect

25

when an architect designs a second system, it is the most dangerous system he will ever design, because he will tend to incorporate all of the additions he

originated but did not add to the first system due to inherent time constraints. Thus, when embarking

upon a second system, an engineer should be mindful that he is susceptible to over-engineering it.

Mythical Man Month (1974), Fred Brooks

Page 26: No Reuse Before Use

26

In theory, traditional design tries to make all design decision during speculation

In practice, we can’t

Page 27: No Reuse Before Use

27

1.Make it work

2.Make it right

3.Make it fast

— Kent Beck, inventor of XP

Page 28: No Reuse Before Use

28

what customers think about reuse

Page 29: No Reuse Before Use

29

Design from the perspective of use!rather than implementation

Page 30: No Reuse Before Use

Customer Value

30

People do not on the whole pay for (or need) generality: They tend to have a specific situation, and it is a solution to that specific situation that has value.

Simplicity before generality, use before reuse,!by Kevlin Henney

Page 31: No Reuse Before Use

31

what managers think about reuse

Page 32: No Reuse Before Use

Reusability Is Not Free

32

… I see that expense (of making reusable code) as exactly the effort of productising the component, discussed

in Chapter 1. So my estimate of the effort ratio would be threefold.

Mythical Man Month (1974), Fred Brooks

Page 33: No Reuse Before Use

Reuse Is Not Free, Either

33

What’s worse than ‘copy-paste programming’ is ‘google then copy-

paste without understanding it.

All non-trivial abstractions, to some degree, are leaky.The Law of Leaky Abstractions by Joel Spolsky

Page 34: No Reuse Before Use

34

what really happens when reuse before use

Page 35: No Reuse Before Use

Project Or Product• When you make a product like a project!• you get Brasilia

35

Page 36: No Reuse Before Use

What Should We Do?Only build software for

specific needs.!Build reusable parts, and

apply them in specific applications.!Start from building for

specific needs, then generalise from them gradually.

36

Page 37: No Reuse Before Use

37

there is no such thing as reusable software, only software that has been reused.

Page 38: No Reuse Before Use

Goals over means!Once-And-Only-Once over reusability!

Simplicity before generality!Use before reuse

38

That is, while there is value in the items on the right, we value the items on the left more.

Page 39: No Reuse Before Use

You’ve reached the end

39

Thanks!