Kamis, 11 Oktober 2012

SUMMARY OF CHAPTER 2

SUMMARY OF CHAPTER 2


  •  Object Orientation is a significantly different way of thinking about  solving problems and developing software solutions.
  •  An Object-Oriented System is one that has been designed using abstraction with objects, encapsulated classes, communication via messages, object lifetime, class hierarchies, and polymorphism.
  • An object represents an instance of a real or abstract thing.
  • Encapsulation is one of the most important aspects of  OO. It is what allows each object to be independent. The exact implementation of attributes and of object behavior is hidden from the rest of the world through encapsulation.
  • The attributes of  a class are defined by the declaration of  variables of  various types such as int or boolean.
  •  A Java class includes the definitions of  the methods used to implement the behaviors of  the class.
  •  The method definitions are integral parts of the class definition.
  •    Object-oriented languages usually provide four levels of visibility for classes.
  • Public Visibility. Public attributes and operations are visible to the whole world. Any other class can access the public items of a class.
  •   Private Visibility. Private attributes and operations are visible only to members of the given class.
  •      Protected Visibility. Protected attributes and operations are visible to the class and its subclasses.

  •   Friend Visibility. Friend attributes and operations are visible to a specified set of other classes. In Java, the package is used to define friend visibility. In C++, the friend specifier is used.
  •    Identity The characteristics or state of an object that allows it to be distinguished from other objects.
  •        A class is the definition of the attributes and methods needed to model a related group of objects.
  •   Classes can be organized into hierarchies. Association is a relationship between classes. Aggregation and compositionrepresent whole/part relationships. Inheritance represents generalization/specialization.
  •  An aggregate object includes (has-a) other objects, each of which is considered to be a part of (part-of) the aggregate object.
  •     A composition is a form of aggregation where the whole cannot exist without having the parts.
  •   The communication via message. A message is sent by a method call as a normal part of the execution of the program logic of an object.
  •   Object Lifetime. The time an object exists - from its instantiation in its constructor until the object no longer exists and has been finalized by the Java garbage collector.
  •      An object becomes available for garbage collection when it is no longer referred to by any other object in Java.
  • Inheritance allows subclasses to selectively derive the properties of a superclass.
  • Polymorphism is a characteristic of inheritance that ensures that instances of such subclasses behave correctly.
  •   Polymorphism goes hand in hand with inheritance, and means the right methods are used for individual objects in a derived class.An understanding of how objects are created and implemented can make it easier to write good OO programs.
  • Just as any other specialized discipline, object-orientation has its own vocabulary.
Read More →SUMMARY OF CHAPTER 2

Sabtu, 06 Oktober 2012

Read More

Chapter 2

What Is an Object-Oriented System?


Any object-oriented software system will have the following properties:


1. Abstraction with objects
2. Encapsulated classes
3. Communication via messages
4. Object lifetime
5. Class hierarchies
6. Polymorphism
The next section gives a brief overview of each of these properties, while the following sections give more detailed explanations of each.
object orientation A method of developing software that uses abstraction with objects, encapsulated classes, communication via messages, object lifetime, class hierarchies, and polymorphism.  


Fundamental Properties of an Object-Oriented System


Abstraction with objects

An abstraction is a mechanism that allows a complex, real-world
situation to be represented using a simplified model. Object
orientation abstracts the real world based on objects and their
interactions with other objects. For example, one possible abstraction
of a color is the RGB model.
  


 





Read More →Chapter 2

Jumat, 05 Oktober 2012

The Essence of Object Oriented Programming with Java and UML by Bruce E. Wampler, Ph.D.




The Essence of Objects

class A class is a description of a set of objects. The set of objects share common attributes and common behavior. Class is similar in concept to abstract data types found in non-OO programming languages, but is more comprehensive in that it includes both structure and behavior. A class definition describes all the attributes of member objects of that class, as well as the class methods that implement the behavior of member objects.

object The basic unit of object orientation. An object is an entity that has attributes, behavior, and identity. Objects are members of a class, and the attributes and behavior of an object are defined by the class definition.

class is a description or definition of the characteristics of objects that belong to that class. An object is a single instance or member of a class that is created and exists while the program is running. A class may have just a single object or any number of member objects existing at any given time. All members of a class have similar behavior.

For example, consider a software system used to monitor various sensors in a factory. One obvious kind of object present is such a system is a sensor. A class called Sensor would be defined and used to model physical sensors. The class would define the basic characteristics of any Sensor, such as its location, value, and identification number, as well as a set of services used to carry out its responsibilities. Each individual physical sensor in the system would be represented as an object belonging to the class Sensor, and have specific values for the attributes described by the class definition.
The class description includes the means of accessing and changing the state of individual object members of that class. A common representation of color is called RGB, where the color is specified by the values of its red, green, and blue components. One possible design of a class called Color could provide the means of manipulating the color by both retrieving and setting the RGB values of a Color object. In an object-oriented system, it is typical to describe one class based on a pre-existing class, either by extending the description of a higher level class, or by including the description of another class within the current class. For example, you could create one class that describes the general characteristics of all sensors, and then more specialized classes that describe specific sensors such as temperature or pressure sensors, each based on the original general Sensor class.
Placing attributes and responsibilities in a top level general class can provide many benefits. For example, if the responsibilities of the general Sensor class included keeping track of a history of readings from a sensor, programming that capability could get somewhat complex. By placing the history code in the top level class, that code need be defined only once, and won't be repeated in new classes. Each of the specialized sensors can then use the history capabilities of the top level Sensor class. Objects and classes are really the heart of object orientation. OO software systems consist of objects of different classes that interact with each other using well-defined methods or services specified by the class definitions. When used properly and consistently, object- oriented software development leads to programs that are robust, and easy to debug, modify, and maintain. To produce successful OO programs, it is important to always "think objects." Just because a program is written in Java or C++ does not mean it is an object-oriented program! If you have a programming background that is not OO based, or even if you've just learned Java, one of the great challenges is to switch the way you think about programming to use the object-oriented programming paradigm.





 

Read More →The Essence of Object Oriented Programming with Java and UML by Bruce E. Wampler, Ph.D.