Title: Object Oriented Programming
Course: COP1000: Introduction to Programming > Section: Module Twelve

Introduction

Object-oriented programming (OOP) is a programming paradigm using "objects" – usually instances of a class – consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP, at least as an option. (http://en.wikipedia.org/wiki/Object_oriented_programming)

A class is a construct that is used to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable its instances to have state and behavior. Data field members (member variables or instance variables) enable a class instance to maintain state. Other kinds of members, especially methods, enable the behavior of class instances. Classes define the type of their instances. A class usually represents a noun, such as a person, place or thing, or something nominalized. For example, a "Banana" class would represent the properties and functionality of bananas in general. A single, particular banana would be an instance of the "Banana" class, an object of the type "Banana". (http://en.wikipedia.org/wiki/Class_%28computer_programming%29)

A member variable (sometimes called a member field) is a variable that is associated with a specific class, and accessible for all its methods. If there is only one copy of the variable shared with all instances of the class, it is called a class variable or static member variable. If each instance of the class has its own copy of the variable, the variable is called an instance variable. (http://en.wikipedia.org/wiki/Member_variable)

A method is a subroutine (or procedure or function) associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time. Methods have the special property that at runtime, they have access to data stored in an instance of the class (or class instance or class object or object) they are associated with and are thereby able to control the state of the instance. The association between class and method is called binding. A method associated with a class is said to be bound to the class. Methods can be bound to a class at compile time (static binding) or to an object at runtime (dynamic binding). (http://en.wikipedia.org/wiki/Method_%28computer_programming%29)

Objects are basically data structures combined with the associated processing routines. For instance, a file is an object: a collection of data and the associated read and write routines. Objects are considered instantiations of classes. In common parlance one refers to a file as a class, while the file is the object. A class defines properties and behavior once, usually for multiple instantiations. (http://en.wikipedia.org/wiki/Object_%28computer_science%29)

Objectives

Upon completion of this module, the student will be able to:

Define the following: "Object Oriented Programming", "Class", "Member Variable", "Method", "Objects"
Create a class
Create an object
Set variables and call methods of the object