Tuesday, January 14, 2014

What is Object?


What is Object?
·         An Instance of a Class.

·         Think of an object as a fancy variable.

·         It stores data, but you can “make requests” to that object, asking it to perform operations on itself.

·         To make a request of an object, you “send a message” to that object.

·         An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student (object) can give the name or address.

·         Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed and hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, and current speed) and behavior (changing gear, changing pedal cadence, applying brakes). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.


·         In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.



What is OOP?

What is OOP?

·         OOP is a design philosophy.
·         It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.).
·         Everything in OOP is grouped as self-sustainable "objects". Hence, you gain re-usability by means of four main object-oriented programming concepts.
·         Today, many popular programming languages (such as Java, JavaScript, C#, C++, Python, PHP, Ruby and Objective-C) support object-oriented programming (OOP).
As an example, suppose you wish to write a computer soccer games (which I consider as a complex application). It is quite difficult to model the game in procedural-oriented languages. But using OOP languages, you can easily model the program accordingly to the "real things" appear in the soccer games.
·         Player: attributes include name, number, location in the field, and etc. operations include run, jump, kick-the-ball, and etc.
·         Ball:
·         Reference:
·         Field:
·         Audience:
·         Weather:

Most importantly, some of these classes (such as Ball and Audience) can be reused in another application, e.g., computer basketball game, with little or no modification.