| Hyderabad Jobs | Book Website | ![]() |
I Love Hyderabad | Hyderabad Colleges |
| Home | Business Emails | Hyderabad Classifieds | Contact Us | |
| 7 Wonders of Hyderabad | Web Hosting | Yellow Pages | Our Network | |
Advanced PowerBuilder
Objects BasicsEvery object has a state and behavior. For an object, attribute defines the state and services describes the behavior. The attributes of an object are the characteristics ( that represent the properties ) that give it a distinct identity. They may be called attributes, properties, or fields, but, they always represent the same thing. Attributes represent the set of properties to which values can be assigned in order to describe the object, and thus establish its identity. In practical terms, attributes are the data elements that can be accessed in an object. In programming implementation of an object, attributes are defined by its instance variables. Instance variables are private to the object. Unless explicitly made public or made available to other "friendly" classes, an object's instance variables are inaccessible from outside the object. An object's behavior is defined by its services. Many different terms are used to refer to the services of objects. They can be called functions, services, responsibilities, methods or operations. They all represent something which responds either directly or indirectly to the actions directed at one object by other objects. In practical terms, services are the processes that can be triggered in an object. Services manipulate the instance variables to create new state; can also create new objects.
The small picture above is a commonly used graphical representation of an object. The diagram illustrates the conceptual structure of a software object - it's like a cell, with an outer membrane, its interface to the world, and an inner nucleus protected by the outer membrane. ClassA class is a software construct that defines the data ( instance variables ) and services of an object. A class in itself is not an object. A class is a template which defines how an object looks and behaves, when the object is created or instantiated from the specification declared by the class. You obtain concrete objects by instantiating a previously defined class. You can instantiate many objects from one class definition, just as you can construct many houses from a single architect's drawing.
InstancesObjects that behave in a manner specified by a class are called instances of that class; these instances are created, when a message to create it is received by the class. All objects are instances of one class or another. Once an instance of a class is created, it behaves just like other instances of its class and is able to perform any service for which it has methods. An application can have as many or as few instances of a particular class as required. Abstract ClassAn abstract class, simply stated as a catalog of common services and attributes. It is the one in which there are no physical representation of its associated object. In other words, the object associated with an abstract class can have no instances. Abstract classes are formed to represent the common services and attributes extracted from objects during classification and are the upper-level classes in an inheritance ( we will explain in a moment ) hierarchy. The distinguishing feature of an abstract class is that it always has subclasses.
Abstract classes are often used to define default process services and to set the initial conditions of data attributes of the objects associated with its subclasses. The services and attributes contained in an abstract class tend to be separate and distinct from one another. They are merely cataloged together because they all serve the same set of lower-level objects. Each has its own internal design, which can be modified at any time without disrupting the integrity of the design of the other objects. Just as the services and attributes of an abstract class can be used in its subclass objects, an abstract class can make use of the services and attributes from a higher-level abstract class to which it is a subclass. Concrete ClassThe classes of objects remaining after extracting common services and attributes are said to be concrete classes. A concrete class is the one in which there can be a physical representation of its associated object at runtime. In other words, the object associated with a concrete class can have instances. They are the lower-level classes in an inheritance hierarchy. Concrete classes may or may not have subclasses, but the distinguishing feature of a concrete class is that the object associated with it can always have instances at runtime. MessagesUnlike passive data items in traditional systems, objects have the ability to act. An action occurs when an object receives a message, that is, a request asking the object to behave in a certain way. When an object sends a message to another object, the sender is requesting the receiver to perform the named service and (possibly) return some information. When the receiver receives the message, it performs the requested service in any way that it knows. The request doesn't specify how a service has to be performed - such information is always hidden from the sender. The set of messages to which an object can respond is known as the behavior of the object. However, not all messages that an object can respond to needs to be part of its publicly accessible interface. An object can send private messages to itself, to implement publicly accessible services.
For example, suppose a drawing object has received a message to draw a pie chart. The object may internally call a method to calculate the percentage of each member in the pie chart. However, if you send a message to the object to calculate the percentages for each member, it would result in an error saying that this service isn't available. Since it is private, it can be called only by another method of the same object. MethodsWhen an object receives a message, it performs the requested service by executing a method. A method is a step-by-step algorithm, that is executed in response to a message, whose name matches with the method. A method is always part of the private representation of an object; it is never part of the public interface. For example, an object can send a message to the drawing object to draw a circle, but the sender object never says how to draw the circle. SubclassA Subclass is a class that inherits behavior from another class. A subclass inherits all the behavior of its parent class and then adds its own specific behavior to define an unique object. SuperClassA Super class is a class from which specific behaviors are inherited. A class might have only one Super class, or it might have several, combining behaviors from several sources and adding only a little of its own to produce its own unique object.
|
| Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com |