Google
Information Storage and Retrieval: Object Oriented Programming: Some Basic Concepts

Pages

Monday, September 19, 2011

Object Oriented Programming: Some Basic Concepts

All computer programs consist of 2 parts: code and data. So, a program can be conceptually organized around its code or around its data. So, there are 2 approaches of writing computer programs: Programs that are written around "what is happening" and programs that are written around "who is being affected". The first approach is known as process-oriented approach. Procedural languages like C follow this model. The second approach is known as 'object-oriented' approach. Languages like C++ and Java follow this approach.

Object -Oriented approach helps in managing complexity better as it is more similar in nature to as how humans manage complexity. Human beings manage complexity through abstraction. e.g people do not think of a car as a set of thousands of individual parts or as a set of thousands of different processes that undergo in running a car. Instead they look at it as a well-defined object with its own unique behaviour. People can easily ignore the complex details of  how the engine, transmission and breaking systems work, while they drive a car. So a car can be visualized as a single object containing of several subsystems(with each of its unique behaviour) like steering, breakes, sound-system etc. In a similar fashion, a program can be written wherein data can be transformed by abstraction into its component objects and each of these objects describes its own unique behaviour.

Every object has state and behaviour. e.g Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes). In similar fashion, software objects  too consist of state and related behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages). Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication.

Encapsulation:

Encapsulation is a mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse. Class is an example of encapsulation.

Inheritance:

Inheritance is the process by which one object acquires the properties of another object. So a class can have a subclass. The subclass will inherit the state and behaviour of its parent class plus it can have its own state and behaviour.

Polymorphism:

Polymorphism is a concept that allows one interface to be used for a general class of actions. e.g if in a program you need 3 differnt kind of stacks: 1 used for integers, one for characters and one for floating point numbers, then you can use 3 methods with the same name.

6 comments:

Anonymous said...

Exactly how do you spell the label of the chemical?

Here is my web blog xerox phaser 8560 ink

Anonymous said...

These conveniences (we counted 5) should make you take into
consideration purchasing multi-function printers.
There are lots of printer brand names online that offer advanced requirements.
So it's helpful if you scout for these multifunction printers on amazon, reviewed evaluations and discover a cheap multifunction printer for on your own.
+1.

Here is my web blog ... xerox phaser 8560 driver

Anonymous said...

Everуthing is verу open with a cleaг
еxplanаtіon of the issuеs. It was truly infοrmatіve.
Your site іs verу hеlpful. Many thanks foг sharing!


Hеre is mу blog poѕt :: facebook news

Anonymous said...

SIR, PLS SEND ME THIS VIDEO CLIP THROUGH E-MAIL PREFERABLY.

CURRENTLY I AM UNABLE TO SEE ON SITE.

My homepage: xerox phaser 8560mfp (harfiz-bizstudent.blogspot.co.uk)

Anonymous said...

At this time it seems like Movable Type is the best blogging
platform available right now. (from what I've read) Is that what you are using on your blog?

Feel free to visit my web site: Buy LG 42LS5600

Anonymous said...

I should downloads printer motorist for Hp Laserjet 1020.


My web blog ... xerox phaser 8560 toner []