Ruby object oriented programming
20 February 2017
DESCRIPTION: Everything in Ruby is an object. Programming should be in an object-oriented way.
Programming Object Oriented Design Rules
- A class should have no more than 100 lines.
- Classes should do one thing.
- Methods should be no more than 5 lines.
- Pass no more than 5 params in an argument.
- Controller can only instantiate one object.
- Views can know about only 1 instance variable.
attr_reader determines which variables are allowed to be passed into the class.
Start the class with the first method
class Test def initialize end end