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.

Object Calisthenics; Practices for Writing Object-Oriented C#


Published on

According to Wikipedia, Calisthenics are a form of exercise consisting of a variety of simple, often rhythmical, movements, generally without using equipment or apparatus. Since programming without Visual Studio is going to be a bit challenging you can define Object Calisthenics as a programming exercise that uses simple rules to motivate you to take an object-oriented approach to programming. As an experienced developer practicing Test Driven Development I was a bit sceptical of whether I really needed those rules to be a better programmer. But to my surprise those little rules really reinforced my beliefs about building high-quality software using the principles of object-orientation, SOLID and Clean Code. So what are those rules? I won’t tell you…yet. Just come to my session and I’ll let you in on my secrets….

Published in: Technology

Object Calisthenics; Practices for Writing Object-Oriented C#

  1. 1. #comdaybeObject CalisthenicsPractices for Writing Object-OrientedAviva SolutionsDennis Doomen
  2. 2. Object…what?Object CalisthenicsObject..ˌka-ləs-ˈthe-niks
  3. 3. Like this?
  4. 4. “…9 rules of thumb that will help pushyour code into good object-orientedshape...”Jeff Bay
  5. 5. So who am I?Principal ConsultantAviva SolutionsFluent AssertionsC# CodingGuidelines@ddoomenTDD, DDD, BDDApplication
  6. 6. demoOne level of indentation per methodRule 1
  7. 7. demoOne dot per lineDon’t use the else keywordRules 2 & 5
  8. 8. demoWrap all primitives and strings…a.k.a. first-class typesRule 3
  9. 9. demoFirst-class collectionsRule 4
  10. 10. Choose names carefully…not too short…and…not too long…contextualRule 6
  11. 11. Keep all classes small…a.k.a. Single Responsibility PrincipleRule 7
  12. 12. No more than two instance variablesRule 8
  13. 13. demoNo propertiesRule 9
  14. 14. demo…no protected properties…test data builders…more refactoringFinal result
  15. 15. Q&A
  16. 16. Resources• Example Code (original by JohanMartinsson)• Object Calisthenics (by Jeff Bay)• C# Coding Guidelines (by me)• (by me…again )• Agile Principles, Patterns, and Practices inC# (by Uncle Bob)
  17. 17. Thank you!Object Calisthenatics