Presentation is loading. Please wait.

Presentation is loading. Please wait.

XP2007b Extreme Code Quality Dongsu Park Venkatesh BS.

Similar presentations


Presentation on theme: "XP2007b Extreme Code Quality Dongsu Park Venkatesh BS."— Presentation transcript:

1 XP2007b Extreme 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 Example. Test everything. Finite State Machine. Keep it DRY / Eliminate Duplication. Extract Superclass Logic Actions Logic Actions

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 danke für Ihnen Aufmerksamkeit Fragen?

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


Download ppt "XP2007b Extreme Code Quality Dongsu Park Venkatesh BS."

Similar presentations


Ads by Google