Skip to content

Instantly share code, notes, and snippets.

@marcelsud
Created July 28, 2014 01:58
Show Gist options
  • Save marcelsud/e4c395ebd56633f39f66 to your computer and use it in GitHub Desktop.
Save marcelsud/e4c395ebd56633f39f66 to your computer and use it in GitHub Desktop.
Object Calisthenics applied to PHP

Object Calisthenics applied to PHP

  • OC#1 - Only one indentation level per method

  • OC#2 - Do not use the 'else' keyword

  • OC#3 - Wrap primitive types and string, if it has behaviour

  • OC#4 - Only one -> per line, if not getter or fluent

  • OC#5 - Do not abbreviate

  • OC#6 - Keep your classes small

    • classes, interfaces, and traits should be <= 200 lines

    • methods should be <= 25 lines

  • OC#7 - Limit the number of instance variables in a class (max: 5)

  • OC#8 - Use first class collections

  • OC#9 - Do use accessors (getter/setter)

  • OC#10 - Document your code

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment