Friday, February 13, 2015

WEEK#6 Object-oriented Programming Concepts

WEEK#6 Object-oriented Programming Concepts


Stack: in a stack, you remove items in reverse order you insert them, so the first item removed is the most recently-added.
ADT(abstract data type): An ADT describes how it stores data, and what operations(methods) one can perform on this data.
This is abstract because there is no code required to understand an ADT.

Class

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.
Class variable: A variable that that is shared by all instances of a class. Class variables are defined within a class but outside any of the class’s methods. Class variables aren’t used as frequently as instance variables are.
Instance variable: A variable that is defined inside a method and belongs only to the current instance of a class.
Inheritance: The transfer of the characteristics of a class to other classes that are derived from it.
Method: A special kind of function that is defined in a class definition.
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 method.
Operator overloading: The assignment of more than one function to particular operator.
Exception: the purpose of the Exceptin is to stop the program woth a meaningful message if there is an advertent executin path that would return NoneType.

Recursion

Recursion means “defining something in terms of itself” usually at some smaller scale, perhaps multiple times, to achieve your objective.
Data Structure:The organization of data for the purpose of making it easier to use is called a data structure
 recursive call : The statement inside the function definition in which the function calls itself is known as the recursive call.
base case: It does not lead to a recursive call: the case where the element is not a (sub-) list. Without a base case, you’ll have infinite recursion, and your program will not work.
## base case: A branch of the conditional statement in a recursive function that does not give rise to further recursive calls.
## infinite recursion: A function that calls itself recursively without ever reaching any base case. Eventually, infinite recursion causes a runtime error.
## recursion: The process of calling a function that is already executing.
##recursive call: The statement that calls an already executing function. Recursion can also be indirect — function f can call g which calls h, and h could make a call back to f.

## recursive definition: A definition which defines something in terms of itself. To be useful it must include base cases which are not recursive. In this way it differs from acircular definition. Recursive definitions often provide an elegant way to express complex data structures, like a directory that can contain other directories, or a menu that can contain other menus.

No comments:

Post a Comment