No Reuse Before Use
-
Upload
terry-yin -
Category
Technology
-
view
1.107 -
download
1
description
Transcript of No Reuse Before Use
![Page 2: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/4.jpg)
![Page 5: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/5.jpg)
Let’s Visit A City !On The Opposite Side of the Globe
![Page 6: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/6.jpg)
6
![Page 7: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/7.jpg)
7
![Page 9: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/9.jpg)
9
![Page 10: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/10.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/11.jpg)
"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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/12.jpg)
what if design from use …
12
![Page 13: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/14.jpg)
14
what our graphic designer thinks about reuse
![Page 15: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/15.jpg)
15
Why cannot the graphic designer think about something more
abstract?
Software developers are!trained in!
abstract thinking
![Page 16: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/16.jpg)
![Page 17: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/17.jpg)
17
what programmers think about reuse
![Page 18: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/18.jpg)
Duplication
18
Duplication may be the root of all evil in
software.
Clean Code, Robert C. Martin
![Page 19: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/19.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/20.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/21.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/22.jpg)
Emergent Design
22
Code, listen you shall.
Let the design be the way it wants to be!
![Page 23: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/23.jpg)
Why Upfront Design Fails?
23
![Page 24: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/24.jpg)
24
what architects think about reuse
![Page 25: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/25.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/26.jpg)
26
In theory, traditional design tries to make all design decision during speculation
In practice, we can’t
![Page 27: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/27.jpg)
27
1.Make it work
2.Make it right
3.Make it fast
— Kent Beck, inventor of XP
![Page 28: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/28.jpg)
28
what customers think about reuse
![Page 29: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/29.jpg)
29
Design from the perspective of use!rather than implementation
![Page 30: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/30.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/31.jpg)
31
what managers think about reuse
![Page 32: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/32.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/33.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/34.jpg)
34
what really happens when reuse before use
![Page 35: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/35.jpg)
Project Or Product• When you make a product like a project!• you get Brasilia
35
![Page 36: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/36.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/37.jpg)
37
there is no such thing as reusable software, only software that has been reused.
![Page 38: No Reuse Before Use](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/38.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022051612/54c56f8c4a795946468b457d/html5/thumbnails/39.jpg)
You’ve reached the end
39
Thanks!