Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Avoid code duplication! Principles & Patterns

5,676 views

Published on

A presentation I gave for the Capgemini Microsoft Group on principles and patterns to use in order to avoid code duplication.

Published in: Technology
  • Have you ever used the help of ⇒ www.WritePaper.info ⇐? They can help you with any type of writing - from personal statement to research paper. Due to this service you'll save your time and get an essay without plagiarism.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Have you ever used the help of ⇒ www.HelpWriting.net ⇐? They can help you with any type of writing - from personal statement to research paper. Due to this service you'll save your time and get an essay without plagiarism.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • You have to choose carefully. ⇒ www.HelpWriting.net ⇐ offers a professional writing service. I highly recommend them. The papers are delivered on time and customers are their first priority. This is their website: ⇒ www.HelpWriting.net ⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi there! I just wanted to share a list of sites that helped me a lot during my studies: .................................................................................................................................... www.EssayWrite.best - Write an essay .................................................................................................................................... www.LitReview.xyz - Summary of books .................................................................................................................................... www.Coursework.best - Online coursework .................................................................................................................................... www.Dissertations.me - proquest dissertations .................................................................................................................................... www.ReMovie.club - Movies reviews .................................................................................................................................... www.WebSlides.vip - Best powerpoint presentations .................................................................................................................................... www.WritePaper.info - Write a research paper .................................................................................................................................... www.EddyHelp.com - Homework help online .................................................................................................................................... www.MyResumeHelp.net - Professional resume writing service .................................................................................................................................. www.HelpWriting.net - Help with writing any papers ......................................................................................................................................... Save so as not to lose
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/2Q98JRS ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Avoid code duplication! Principles & Patterns

  1. 1. Avoid Code Duplication! Principles & Patterns Lars-Erik Kindblad Senior Consultant Blog: kindblad.com
  2. 2. Agenda Why avoid code duplication? Principles and patterns:  Extract Method Principle  Inheritance Principle  Execute Around Method Pattern
  3. 3. Why avoid code duplication? “The way you get programmer productivity is by eliminating the lines of code you have to write” – Steve Jobs How? Stop duplicating and repeating code! Less Code to Write = Less Code to Maintain = More features delivered = More productive We normalize databases – should also normalize our code DRY – Don’t repeat yourself – Single Source of Truth
  4. 4. Extract Method Principle: Example Duplicated Code
  5. 5. Extract Method Principle: Example Extract the code to a new method
  6. 6. Extract Method Principle: Example Refactored to call the new method
  7. 7. Inheritance Principle: Example Duplicated Code
  8. 8. Inheritance Principle: Example Refactored to a common base class
  9. 9. Execute Around Method Pattern: Example Duplicated Code
  10. 10. Execute Around Method Pattern: Example Refactored to a new execute around method
  11. 11. Execute Around Method Pattern: Example Refactored to use the new method
  12. 12. Execute Around Method Pattern: Example Or:
  13. 13. About CapgeminiWith more than 120,000 people in 40 countries, Capgemini is oneof the worlds foremost providers of consulting, technology andoutsourcing services. The Group reported 2011 global revenuesof EUR 9.7 billion.Together with its clients, Capgemini creates and deliversbusiness and technology solutions that fit their needs and drivethe results they want. A deeply multicultural organization,Capgemini has developed its own way of working, theCollaborative Business ExperienceTM, and draws on Rightshore ®,its worldwide delivery model.Rightshore® is a trademark belonging to Capgemini www.capgemini.com The information contained in this presentation is proprietary. © 2012 Capgemini. All rights reserved.

×