문제

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.

도움이 되었습니까?

해결책

I think you're refering to Object Calisthenics which have the following rules:

  1. Use one level of indentation per method
  2. Don't use the else keyword
  3. Wrap all primitives and strings
  4. Use only one dot per line
  5. Don't abbreviate
  6. Keep all entities small
  7. Don't use any classes with more than two instance variables
  8. Use first class collections
  9. Don't use any getters, setters or properties
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top