eWebProgrammer eweb





ASP   «Prev 

An outline of Object-Oriented Programming (OOP)

In procedural programming, you think about the algorithms and data structures that are used to model the problem and then divide the problem into a series of ever-smaller procedures. Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.
The programming challenge was seen as how to write the logic, not how to define the data. Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them. Examples of objects range from humans (described by name, address, and so forth) to cyborgs (whose properties can be described and managed) down to the integrated circuits (such as CPU and ALU).


In object-oriented programming, you think about the overall system you are modeling and how the elements in the system interact with each other. In procedural programs, procedures are the highest-level elements. They define what the program does. In object-oriented programs, classes are the highest level elements.
Classes correspond to real-world entities such as employees or automobiles. An object is one instance of a class, much as 3 is an instance of a number and hello is an instance of an English word. There are rules about how to add and subtract numbers, and they apply to all numbers. When you define a class, you are setting the rules for all the members (objects) of that class.
Objects combine data (also called attributes, variables, and state) with behavior (also called methods, functions, and operations). An object holds information, and can do things with that information on request.
The application of OOP to ASP objects is that each object we will encounter has properties and methods already defined. When you set a property (attribute) equal to a variable of the appropriate type and refer to one of the object's methods a known and consistent operation will occur on, or using, that property (or those properties).