Friday, December 24, 2010

Google: TIPS AND TRICKS

To find defination:
===================
define: [search keyword]

To fine somw wheres time:
=========================
What time is it in [location]
or

Tuesday, December 7, 2010

Class

A Class is a blueprint / template of an object. A class contains all the code that relates to its object. A class is a user defined datatype which contains Methods, Variables and Properties.
Consider example of a cat (class), it will consist of color, breed .... etc (characteristics) and the ability to jump, run ..... etc (behaviors)

Object

An Object of a given class is called an instance of the class. The instance is the actual object created at runtime. Object belonging to a class will have same attributes and actions as the class. Here Attributes are the characteristics that describes an object.

When we look at the real world we see all objects share two characteristics, state and behavior.
Like a man will have different
States : Name, Skin tone, Hungry .... etc
Behaviors: Eating, Talking, Relaxing, walking .... etc

Take a self test, look at objects around you in your surrounding and decide what states and behaviors these objects posses. Identifying things like this is actually thinking in terms of Object Oriented Programming (OOP).

Software Objects are also similar to real world objects they also posses states and behaviors. States are stored in Fields and behaviors are exposed through Methods (also known as functions in some programming languages).

Advantages of Object Oriented Programming

Following are the key benefits / advantages of using Object Oriented Programming technique :

- Modularity:
Source code for every object can be maintained independently of
the other objects.

- Data / Information Hiding: The details of the internal implementation of the objects remain hidden.

- Code Reuse: If an object already exists you can reuse it and can also expand it.

- Debugging Ease and Plug Ability: If an object became problematic you can easily debug it or you can replace it with another object.

- Method Overloading: Methods with same name having different Parameters.

Object Oriented Programming

Object Oriented Programming uses objects together with their interaction to design computer applications. It uses data structures consisting of data fields and methods. Where, Data fields are the data encapsulated within a class and Methods are a sequence of programming statements to perform a specific action or task.

Object is a member of a class. An object of a given class is called an instance of the class. Instance refers to any running process. Class is used as a template to create objects of that class. The template describes the state and behavior that the objects of the class share.

In real world whatever we see or with whatever we interact are objects like a man/women, a cycle or a bike …. etc. Every object have a theoretical background, the theory(class) is first designed in order to create objects.

As an Example consider a factory making registers or books. For this purpose it will create a class/theory first which will contain every detail about the register. Now depending on this single class it will create like 1000 registers (objects).

Three basic pillars of Object Oriented Programming are :
- Encapsulation
- Inheritance
- Polymorphism