Programming paradigm with heavy OO constraints
Question
Hey. I remember reading somewhere about a programimng paradigm that has very tough restrictions about OO. It forbids nested ifs and elses entirely, avoid functions in the global namespace not associated with a class, and stuff like that. It's supposedly pretty famous. Does anyone know how it is called? Thanks.
I'll give an example. This is not supposed to be a totally serious paradigm - its just heavy restrictions to improve your "OO style". For example a FizzBuzz program you'll make an object that inherits from integer and has a method 'representMyself', and an object 'FizzBuzzNumbersRange' which holds an array of FizzBuzz numbers with a method 'representAll', or something. etc. etc.
Solution
I think you're refering to Object Calisthenics which have the following rules:
- Use one level of indentation per method
- Don't use the else keyword
- Wrap all primitives and strings
- Use only one dot per line
- Don't abbreviate
- Keep all entities small
- Don't use any classes with more than two instance variables
- Use first class collections
- Don't use any getters, setters or properties