I came across this nice and somewhat strongly opinionated video on Defensive Programming:
Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven’t heard about – Object Calisthenics. Which turns out to be yet another set of rules and best practices for the object-oriented design and programming. Here are the rules to get you started:
- Only One Level Of Indentation Per Method
- Don’t Use The ELSE Keyword
- Wrap All Primitives And Strings
- First Class Collections
- One Dot Per Line
- Don’t Abbreviate
- Keep All Entities Small
- No Classes With More Than Two Instance Variables
- No Getters/Setters/Properties
Read the whole article for explanations and examples.
My favourite part of this video:
“You are dumb, I am dumb … those who say are not dumb, they are dumbest.”
That’s very true.