Object Oriented Programming

From wikinotes

Object-Oriented Programming (commonly abbreviated to OO, OOP) introduces classes, a layer between modules and functions/varibles.

class ReportFormatter(object):
    def set_report_data(self, report_data):
        self._data = report_data

    def format(self):
        return repr(self._data)

Info about OOP is already widely available, there is no need to repeat it here. Some goals:

  • Objects often represent pluggable-behaviours that can substituted in/out without requiring changes to code.
  • Inheritance is intended for specialization, not code-reuse
  • Good OO Design favours composition over inheritance.


Excellent sources of information

Christopher Ohkravi https://www.youtube.com/results?search_query=christopher%20ohkravi
Sandi Metz https://www.youtube.com/results?search_query=sandi%20metz
Martin Fowler https://martinfowler.com/
Bob C. Martin https://www.youtube.com/results?search_query=bob%20c%20martin