Your SlideShare is downloading. ×
Cloning Considered Harmful Considered Harmful
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Cloning Considered Harmful Considered Harmful

1,400
views

Published on

A presentation of Mike Godfrey's work I gave at a reengineering course.

A presentation of Mike Godfrey's work I gave at a reengineering course.

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,400
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Cloning Considered Harmful Considered Harmful? presented by Nicolas Bettenburg 1
  • 2. 10-15% cloned! 2
  • 3. Intentional e.g., Copy & Paste { Unintentional } e.g., Language Idioms 3
  • 4. Cloning = additional maintenance effort B B B B A A A A A 1.1 1.2 1.3 1.4.0 1.4.1 4
  • 5. Clones considered harmful! 5
  • 6. But Wait! Is that the right thing to do? 6
  • 7. Example: Cloning to experiment without risk experimental stable 7
  • 8. Understand Reason behind duplication before deciding! 8
  • 9. Catalogue of High-Level Cloning Patterns 9
  • 10. 8 general cloning patterns Forking Templating Customization 10
  • 11. Hardware Variations Clone existing driver + No risk of changing existing driver - Code growth ~ Dead code can creep into system 11
  • 12. Platform Variations Clone existing code and fix low level platform interaction + Avoid complexity of virtualization layer - Hard to propagate bug fixes ~ Ensure consistent behavior of all clones 12
  • 13. Experimental Variations Clone existing code and experiment + Maintain stable code - Merging later may be difficult ~ Consistent maintenance becomes difficult 13
  • 14. Boiler-plating Cloning due to language constraints + Make reuse of trusted code possible - Increased maintenance (close evolution) ~ Explicit and rigorous linking of all duplicates 14
  • 15. API/Library Protocols Clone reoccurring call sequences + Learn from code and reduce effort - Degradation of Code Quality ~ Changes to API require maintenance of all clones 15
  • 16. Language Idioms a = malloc(64); if (a == null) { out(“Error!”); } ... Idioms provide standardization + Selfdocumenting and improve comprehensibility - Faulty implementations are easily overlooked ~ no long term issues 16
  • 17. Bug Workarounds ... ... a = sqroot(81); a = sqroot(81); ... if (a != 9) { a = 9; } ... Clone to provide work arounds + Clone buggy code and fix - Source of the bug is not addressed ~ Remove clone when bug is fixed 17
  • 18. Replicate & Specialize Clone to reuse and adapt existing solutions + Less effort needed - Long-term cost outweighs short-term benefit ~ Cost of refactoring rises over time 18
  • 19. Conclusions •Templating requires synchronization •Variation requires monitoring of changes •Forking need outlining •Not all clones require refactoring •Some situations warrant the effort •Measure risk vs. long-term cost 19
  • 20. Considering Cloning harmful in general can be harmful! 20