








































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































































1
2
(^) Procedure Oriented Vs. Object Oriented
(^) Objects & Classes (^) Elements of the Object Model (^) Problem solving in OOP methodology
(^) OOP implementations: Java Vs. C++ etc.
(^) Working of a Java Program
4
5
(^) As your employee program evolves, you will certainly findemployee program
yourself adding and changing procedureadding and changing procedure s so that everything works successfully.
(^) For example, as you start writing the computePay() procedurecomputePay() procedure, you might realize that there are two different types of employees (at least in terms of how they get paid): hourly employees and salaried employees.
(^) In this situation, you might decide to write two computePay() procedures, one for hourly employees and a different one for salaried employees.
(^) Writing a procedure to solve a specific task is a fundamental
programming concept used in both procedural languages and in objectoriented programming.
(^) As you design and write Java programs, procedures will be an
essential element for solving the problem at hand
7
(^) Functional/procedural programming:Functional/procedural programming:
program is a list of instructions to the computer .
(^) Objectoriented programmingObjectoriented programming
program is composed of a collection : objects that communicate with each other
(^) OOPS with JavaOOPS with Java
In Java, procedures are referred to as methods.
Methods in Java appear within a class. Procedures in a procedural language typically appear at a global level so that they can be invoked from anywhere.
10
11
Object-oriented programming (OOP) is a programming
paradigm that uses "objects" and their interactions to
design applications and computer programs. It is based
on several techniques.
Object oriented programming roots reach all the way
back to the 1960s. As researchers studied how softwarehow software
quality could be maintainedquality could be maintained****.
Object-oriented programming was deployed in part as an
attempt to address this problem by strongly emphasizingstrongly emphasizing
discrete units of programming logic and re-usabilitydiscrete units of programming logic re-usability in
software.
13
(^) With the dominance of OOP, Objectoriented modeling
has become the defacto standarddefacto standard in the early phases of a software development process during the last decade..
(^) The most single important abilityability in object oriented
analysis and design is;
(^) to skillfully assign responsibilities to software components.
(^) Bundling code into individual software objects has advantages;
Modularity: The source code for an object can be written and maintained independently of the source code for other objects. Once created, an object can be easily passed around inside the system.
Informationhiding : By interacting only with an object's methods, the details of its internal implementation remain hidden from the outside world.
Code reuse : If an object already exists (perhaps written by another software developer), you can use that object in your program. This allows specialists to implement / test / debug complex, taskspecific objects , which you can then trust to run in your own code.
Pluggability and debugging ease: If a particular object turns out to be problematic, you can simply remove it from your application and plug in a different object as its replacement. This is analogous to fixing mechanical problems in the real world. If a bolt breaks, you replace it, not the entire machine.
14
(^) As your problem evolves, you have to certainly identifyproblem
objects so that OOPS works successfully.
(^) After you have determined the objects in the problem, you
write a class to describe the attributes and behaviors of each object.
(^) The attributes of an object will be what the object “has” such
as a name, address, and so on.
(^) Each of these attributes will be represented by a field in the
Employee class.
(^) The behaviors of an object are what the object “doesdoes” (or,
more specifically, what we want the object to do).
(^) These desired behaviors become methods in the Employee
class.
(^) Writing a Method inside a Class , to solve a specific task is a
fundamental in objectoriented programming.
16
(^) your dog, your bicycle, your desk, your television set.your dog, your bicycle, your desk, your television set.
17
27/11/14 04:45 AM Marc Conrad - University of Luton 19
(^) Tangible Things as a car, printer, ...
(^) Roles as employee, boss, ...
(^) Incidents as flight, overflow, ...
(^) Interactions as contract, sale, ...
(^) Specifications as colour, shape, …
(^) An object represents an individual, identifiable item, unit, or entity, either real or abstract, with a welldefined role in the problem domain.
(^) An "object" is anything to which a concept applies.
(^) Observe the realworld objects that are in your immediate area.
(^) For each object that you see, ask yourself two questions:
I. "What possible states can this object be in?"
II. "What possible behavior can this object perform?".
(^) Make sure to write down your observations. As you do, you'll notice
that realworld objects vary in complexity;
off) and two possible behaviors (turn on, turn off),
current volume, current station) and behaviorbehavior (turn on, turn off, increase volume, decrease volume, seek, scan, and tune).
(^) You may also notice that some objects, in turn, will also contain
other objects.
(^) These realworld observations all translate into the world of object oriented programming.
20