Intro

There has been a shift in programming languages from POP (Process Oriented Programming) to OOP (Object Oriented Programming).

POP (Process Oriented Programming) conceptually focuses on developing processes whereas OOP develops objects and manages the state inside objects, and the processes involved with objects. A POP program tends to start at the first line of code and then proceed on through the program in a particular sequence.

OOP (Object Oriented Programming) has three signature principles:

  • Encapsulation. This basically turns bits of code into "black boxes". You don't need to know the internal workings, you just need to know the minimal amount needed to interface with the code. The interface is usually done with members:
    • Properties. Properties are changeable characteristics of an object. These can usually be read from the object or assigned (set) to the object. This includes variables, settings, attributes, and data. These are usually named as nouns or adjectives. EG: obj.Height or obj.Visible.
    • Methods. Methods are actions that objects can do. These are functions of the object and can usually accept parameters. These are usually named as verbs. EG: obj.Hide() or obj.Show(3, strName).
    • Events. An object can be designed to fire an event under certain conditions. That event can be detected by users of the object and responded to. These are usually named as prepositional phrases. EG: obj_onClick() or obj_beforeChange().
  • Inheritance. Why redo work when you can inherit it? If class "A" has a lot of features you like then make a subclass "Aa" that inherits much of the features of class "A".
  • Polymorphism. When a subclass inherits a method (EG: The shape class may have subclasses of square and circle), the methods should change (be redefined or polymorphed) for the new class (EG: Circumference() method of the shape class has the same name for its sublcasses but the actual equation behind Circumference() is different for the square and circle subclasses).

The idea is to define a "class" which can be used to instantiate many different individual objects. Instantiating an object is basically allocating memory for your object/data structure. Objects of a class use the class as a template but will have different values for their properties, and do methods as needed, and react to events independently. A Class is a template for creating objects that contain both data and methods that operate on the data.

Furthermore, a "component" can be made which has a family of classes. A "component.class" can be used to instantiate objects in multiple programs.

OOP make programs more modular, and thus easier to debug, reuse, maintain, and enhance, whereas in POP everything is sort of enmeshed and inseparable.

Component technologies (EG: COM) work with the creation of classes, whereas object models (EG: ADO) are describe how to implement a set of classes.

Components

All components are sort of like living creatures that can do the following:

  • Create an object, ie an instance of itself.
  • Communicate with other components.
  • Destroy an object, ie remove itself from the computers memory.

In addition, a component has the following features:

  • Binary compatibility. Components can be used and can speak with other components regardless of the language used to make the component.
  • Cross-platform compatibility. Components must be able to operate on other operating systems.
  • Location transparency. The location of components should make no difference. A component may be on the local machine or a machine on the LAN or the Internet. Non-local components are said to be distributed.
  • Code reusability. The components should not need to be re-written.
  • Version control. Different versions of a the same component should be able to function on one computer.
  • Encapsulate. Components must hide their inner workings. A user of the component must not see or care how a component works internally.
  • Data hiding. Components should protect its internal data. A user should access a component only through its exposed interfaces. This protects internal data from unintentional effects or data corruption.
  • Polymorphic interfaces. Interfaces look and behave similarly even between different classes of a component. EG: A Plant component with a Tree class may have two classes called Oak and Pine where each has similar methods such as Grow(). Note that true OOP languages provide polymorphism by letting child classes (Oak and Pine) inherit but override an interface from a parent class (Tree). Some languages, like Visual Basic, provides polymorphism by providing multiple interfaces. EG: The "abstract" class (Tree) has a "blank" interface that is actually implemented by the child classes (Oak and Pine).

The innards of implementing components, classes, and object is done with the three major standards for components: follows:

  • Microsoft's COM (Component Object Model). This includes ActiveX Controls, DCOM and COM+.
  • OMG's (Object Management Group) CORBA (Common Object Request Broker Architecture). This includes ORB.
  • Apple and IBM's OpenDoc. OpenDoc has dropped from the market.

Object Models

Object Models are sets of rules that deal with particular components. The object model describes the objects in the model, the relationship between objects within the model, and what the members of the objects. An object model is closer to an API (Application Programming Interface) for developers.

Here is a listing of some major object models:

  • DOM (Document Object Model). This is the HTML as an XML DOM by the W3C. This enables data access via form, CSS, CSSP, etc.
  • DHTML (Dynamic HTML). This is Microsoft's super set of the DOM. This provides additional programming functionality specific to MSIE4+.
  • Data access APIs:
    • ODBC (Open DataBase Connectivity). ODBC is a C-level API (Application Programming Interface) that provides a common interface to a variety of SQL databases.
    • OLE DB (Object Linking and Embedding DataBase). OLE DB is a collection of COM objects that encapsulate database management system services for a number of services and data providers.
    • ADO (ActiveX Data Objects). ADO provides objects that developers can use in their consumer applications to interface with OLE DB which in turn connects to the data providers themselves.
  • ASP (ActiveX Server Pages). An object model that enables server side script for Microsofts IIS web server.
  • XML (Extensible Markup Language). XML is plain text formatted in a way that is conducive for the transmission and storage of structured data especially trans Web and trans platforms. A DOM API is used to manipulate XML data.


GeorgeHernandez.comSome rights reserved