1 / 9

XP2007b Extreme Code Quality

XP2007b Extreme Code Quality. Dongsu Park Venkatesh BS. Agenda. What is “Extreme Code Quality”? How to do it in XP. Example. Remember. What is Extreme Code Quality?. Code Quality: Amount of flexibility in the code. Flexibility: change, adapt and re-use.

colt-reid
Download Presentation

XP2007b Extreme Code Quality

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XP2007bExtreme Code Quality Dongsu Park Venkatesh BS

  2. Agenda • What is “Extreme Code Quality”? • How to do it in XP. • Example. • Remember.

  3. What is Extreme Code Quality? • Code Quality: Amount of flexibility in the code. • Flexibility: change, adapt and re-use. • Extreme : To the maximum possible via XP paradigm. • Why? • Because of humans. • Misunderstand communications. • Requirements change. • Examples*: • @2% per month (software industry requirement change). • 30% of rework due to mistakes (building construction). • “Soft”ware – easy to change: how well, how fast, how cheap. To get a good design. * Source: IEEE Software, May 2004; Andy Hunt and Dave Thomas

  4. How to do it in XP? • Test everything. • Code should be testable. • Write tests together with code. • Keep it DRY / Eliminate Duplication. • Don’t Repeat Yourself: Code (Documents, Review, Processes) • Duplication is harder to read (time consuming and redundant reading), understand and maintain. • Keep it Shy • Highly modular, highly cohesive and loosely coupled. • Static, Dynamic, Domain and Temporal couplings. • Tell the other guy. • Tell, don’t ask (OO Principle: not as Function -> as Message!). • Let the code reflect your intentions. Tools: Refactoring. DRY: Do not Repeat Yourself.

  5. Actions Logic Actions Logic Example. • Test everything. • Finite State Machine. • Keep it DRY / Eliminate Duplication. • Extract Superclass

  6. Example…cont. • Minimize entities. • Extract class • Express all ideas. • Introduce explaining variable. if ( (platform.toUpperCase().indexOf("MAC") > -1) && (browser.toUpperCase().indexOf("IE") > -1) && wasInitialized() && resize > 0 ) { // do something } final boolean isMacOs = platform.toUpperCase().indexOf("MAC") > -1; final boolean isIEBrowser = browser.toUpperCase().indexOf("IE") > -1; final boolean wasResized = resize > 0; if (isMacOs && isIEBrowser && wasInitialized() && wasResized) { // do something }

  7. Remember • Keep it DRY, Keep it Shy and Tell the other guy. • Test everything, Eliminate duplication, Minimize entities and Express all ideas. • Extreme code quality is important. • Apply the principles and review (daily/weekly). • Allocate time in your planning. • It looks subjective – so understand and practice ! • Past eXP: Everyone knew refactoring but was not applied. It’s a challenge for us to apply … 

  8. Fragen? danke für Ihnen Aufmerksamkeit

  9. References • http://www.pragmaticprogrammer.com/ • http://www.xprogramming.com/xpmag/expEmergentDesign.htm • http://www.extremeprogramming.org/ • http://www.xprogramming.com/ • Agile Software Development, Principles, Patterns and Practices; Robert C. Martin • Previous XP Lab presentations; XP2007a

More Related