Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1.
Object Calisthenics; Practices for Writing Object-Oriented C#
-
Upload
dennis-doomen -
Category
Technology
-
view
1.278 -
download
4
description
Transcript of Object Calisthenics; Practices for Writing Object-Oriented C#
#comdaybe
Object CalisthenicsPractices for Writing Object-Oriented
Aviva SolutionsDennis Doomen
Object…what?
Object Calisthenics
Object..\ˌka-ləs-ˈthe-niks\
Like this?
“…9 rules of thumb that will help push your code into good object-oriented shape...”Jeff Bay
So who am I?
Principal ConsultantAviva Solutions
Fluent Assertions
C# Coding Guidelines
@ddoomen
TDD, DDD, BDD
Application Lifecycle Management
Agile
XP
www.dennisdoomen.net
demo
One level of indentation per methodRule 1
demo
One dot per lineDon’t use the else keyword
Rules 2 & 5
demo
Wrap all primitives and strings…a.k.a. first-class types
Rule 3
demo
First-class collectionsRule 4
Choose names carefully…not too short
…and…not too long…contextual
Rule 6
Keep all classes small…a.k.a. Single Responsibility
Principle
Rule 7
No more than two instance variablesRule 8
demo
No propertiesRule 9
demo
…no protected properties…test data builders…more refactoring
Final result
Q&A
Resources
• Example Code (original by Johan Martinsson)
• Object Calisthenics (by Jeff Bay)• C# Coding Guidelines (by me)• www.dennisdoomen.net (by me…
again )• Agile Principles, Patterns, and Practic
es in C# (by Uncle Bob)
Thank you!Object Calisthenatics