https://en.wikipedia.org/wiki/Procedural_programming
https://en.wikipedia.org/wiki/Object-oriented_programming
https://en.wikipedia.org/wiki/Software_design_pattern
Object-oriented programming (OOP) is a programming paradigm based on the concept of 'objects', which can contain data (attributes) and procedures (methods). Methods can access and often modify the attributes of the object with which they are associated (objects have a notion of "this" or "self"). Computer programs are designed by making them out of objects that interact with one another.
Classes sometimes correspond to things found in the real world.
Inheritence in typically used for code reuse.
Encapsulation is an object-oriented programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding.
Objects can contain other objects in their instance variables; this is known as object composition.
A software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is a template for how to solve a problem that can be used in many different situations.
Design patterns had originally been categorized into 3 sub-classifications
based on kind of problem they solve.
(a) Creational patterns (abstract factory, singleton)
(b) Structural patterns (adapter, decorator)
(c) Behavioural patterns (iterator, visitor)
# A simple example class. class MyClass: def speak(self): # a sample method print("Hello") # Driver code. instance = MyClass() instance.speak() # Hello MyClass.speak(instance) # the same, instance as self
Data hiding (_variable, __hidden).