Your SlideShare is downloading. ×
0
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Object Calisthenics Refactoring Dojo
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Object Calisthenics Refactoring Dojo

3,648

Published on

Introductory slides for an Object Calisthenics Refactoring Dojo

Introductory slides for an Object Calisthenics Refactoring Dojo

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

  • Be the first to like this

No Downloads
Views
Total Views
3,648
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
5
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. Object CalisthenicsCODING DOJO
  • 2. Coding Dojo• Working in pairs• TDD (Red, Green, Refactor)• Doing something you can’t comfortably do (yet)• Slowly 
  • 3. Format• 45 minute session• Lunch• 45 minute session• Retrospective
  • 4. The Problem
  • 5. The Rules…
  • 6. One level of indentation per methodclass Board {... String board() { StringBuffer buf = new StringBuffer(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) buf.append(data[i][j]); buf.append(“n”); } return buf.toString(); }}
  • 7. One level of indentation per methodclass Board {... String board() { StringBuffer buf = new StringBuffer(); collectRows(buf); return buf.toString(); }}
  • 8. Don’t use the ELSE keywordif (status == DONE) { doSomething();} else { … Think of polymorphism, Null objects
  • 9. Wrap all primitives and Stringspublic void addHours(int hours);public void add(HourDuration hours);currentTime.addHours(2); vs.HourDuration twoHours = new HourDuration (2);currentTime.add(twoHours);
  • 10. First class collectionsAny class that contains a collection shouldcontain no other member variables.
  • 11. One dot per line• Law of Demetergame.getRow(1).countCrosses(); vsgame.crossesForRow(1);
  • 12. Don’t abbreviate• Why do we abbreviate in the first place? – Repetition? – Names too long? – Duplication of context?
  • 13. Keep all entities small• No classes over 50 lines• No packages over 10 files (should be easy)
  • 14. No classes with more than two instance variablesclass Name { class Name { String first; Surname family; String middle; GivenNames given; String last; }} class Surname {would be decomposed String family;into two classes }thus=> class GivenNames { List<String> names; }
  • 15. No classes with more than two instance variablesclass Name { class Name { String first; Surname family; String middle; GivenNames given; String last; }} class Surname {would be decomposed String family;into two classes }thus=> class GivenNames { List<String> names; }
  • 16. No getters/setters/properties
  • 17. The Rules!1. One level of indentation per method2. Don’t use the ELSE keyword3. Wrap all primitives and Strings4. First class collections5. One dot per line6. Don’t abbreviate7. Keep all entities small8. No classes with more than two instancevariables9. No getters/setters/properties
  • 18. Credits• Cathttp://www.funnyjunk.com/funny_pictures/189828/Calisthenics/• Kidhttp://www.kidsguideperth.com.au/byford-calisthenics/

×