The document discusses object-oriented programming concepts in Java such as encapsulation, abstraction, inheritance and polymorphism. It explains how Java classes contain methods and fields to implement objects and describes relationships between classes. Reusability of classes is also discussed as it allows building software from existing components.
The document discusses object-oriented programming concepts in Java such as encapsulation, abstraction, inheritance and polymorphism. It explains how Java classes contain methods and fields to implement objects and describes relationships between classes. Reusability of classes is also discussed as it allows building software from existing components.
The document discusses object-oriented programming concepts in Java such as encapsulation, abstraction, inheritance and polymorphism. It explains how Java classes contain methods and fields to implement objects and describes relationships between classes. Reusability of classes is also discussed as it allows building software from existing components.
The document discusses object-oriented programming concepts in Java such as encapsulation, abstraction, inheritance and polymorphism. It explains how Java classes contain methods and fields to implement objects and describes relationships between classes. Reusability of classes is also discussed as it allows building software from existing components.
Object-Oriented: Although influenced by its predecessors, Java was not designed to be
source-code compatible with any other language. This allowed the Java team the freedom to design with a blank slate. One outcome of this was a clean, usable, pragmatic approach to objects. Borrowing liberally from many seminal object-software environments of the last few decades, Java manages to strike a balance between the purist’s ―everything is of my way‖ model. The object model in Java i such as integers, are kept as high-performance non objects. [JAVA PROGRAMMING] Page 4 OOD encapsulates (i.e., wraps) attributes and operations (behaviors) into objects, an object’s attributes and operations are intim information hiding. This means that objects may know how to communicate with one another across well-defined interfaces, but normally they are not allowed to know how other objects are implemented ,implementation details are hidden within the objects themselves. Wecan drive a car effectively, for instance, without knowing the details of how engines, transmissions, brakes and exhaust systems work internally—as long as we know how to use the accelerator pedal, the brake pedal, the wheel and so on. Information hiding, as we will see, is crucial to good software engineering. Languages like Java are object oriented. Programming in such a language is called object-oriented programming (OOP), and it allows computer programmers to implement an object-oriented design as a working system. Languages like C, on the other hand, are procedural, so programming tends to be action oriented. In C, the unit of programming is the function. Groups of actions that perform some common task are formed into functions, and functions are grouped to form programs. In Java, the unit of programming is the class from which objects are eventually instantiated (created). Java classes contain methods (which implement operations and are similar to functions in C) as well as fields (which implement attributes). Java programmers concentrate on creating classes. Each class contains fields, and the set of methods that manipulate the fields and provide services to clients (i.e., other classes that use the class). The programmer uses existing classes as the building blocks for constructing new classes. Classes are to objects as blueprints are to houses. Just as we can build many houses from one blueprint, we can instantiate (create) many objects from one class. Classes can have relationships with other classes. For example, in an object-oriented design of a bank, the ―bank teller‖ class needs to relate ―safe‖ class, and so on. These relationships Packaging software as classes makes it possible for future software systems to reuse the classes. Groups of related classes are often packaged as reusable components. Just as realtors often say that the three most important factors affecti location,‖ people in the software community affecting the future of software development are ―reuse, classes when building new classes and programs saves time and effort.Reuse also helps programmers build more reliable and effective systems, because existing classes and components often have gone through extensive testing, debugging and performance tuning. Indeed, with object technology, you can build much of the software you will need by combining classes, just as automobile manufacturers combine interchangeable parts. Each new class you create will have the potential to become a valuable software asset that you and other programmers can use to speed and enhance the quality of future software development efforts.