Summary of Stage 3 Lessons

Intro: Program with Objects

1. Object-Oriented Programming (OOP)

Object-oriented programming (OOP) is a programming language model organized around objects and data. Python is an object-oriented programming language.

2. Class

A user-defined prototype for an object that defines a set of attributes that characterize any object of the class. The attributes are data members (class variables and instance variables) and methods, accessed via dot notation.

YOu can create a class by grouping a few related functions together.

Class is like a blueprint.

3. Object

A unique instance of a data structure that's defined by its class. An object comprises both data members (class variables and instance variables) and methods.

Object is like a specific building that is built from a blueprint.For example: Brad & Angie are objects of Class Turtle.

4. Instance

An individual object of a certain class. An object brad that belongs to a class Turtle, for example, is an instance of the class Turtle.

5. Method

A special kind of function that is defined in a class definition.

6. Class Variable

Variable that is shared by all instances of a class. Class variables are defined within a class but outside any of the class's methods.

7. Instance variable

A variable that is defined inside a method and belongs only to the current instance of a class.

8. Inheritance

The transfer of the characteristics of a class to other classes that are derived from it.

9. Module

A module is a Python object with arbitrarily named attributes that you can bind and reference.

A module can define functions, classes and variables. Grouping related code into a module makes the code easier to understand and use.

You can use any Python source file as a module by executing an import statement in some other Python source file.

10. Python Standard Library

Python’s standard library is very extensive, offering a wide range of facilities. The library contains built-in modules (written in C) that provide access to system functionality, as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming.

11. Why is "OOP" a valuable tool for thinking about large progarmming projects?

Python classes are tools that programmers can create and reuse forever! Once you've created a class once, you never have to create it again. Classes group functions (in a class they are called methods) that belong together. This is sort of what modules do. However, classes have a leg up on modules, they have a way to inherit other classes and establish a tree search structure for attributes in any of these inherited/linked classes. You can go without classes and OOP, but the ease of reuse of existing code makes a difference as you write larger programs.

12. Method Overriding

Overriding is the ability of a class to change the implementation of a method provided by one of its ancestors.
Overriding is a very important part of OOP since it is the feature that makes inheritance exploit its full power. Through method overriding a class may "copy" another class, avoiding duplicated code, and at the same time enhance or customize part of it. Method overriding is thus a strict part of the inheritance mechanism.