0% found this document useful (0 votes)
8 views25 pages

OOP Unit1 P1

Oops

Uploaded by

sonud96180
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views25 pages

OOP Unit1 P1

Oops

Uploaded by

sonud96180
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 25

II-B.E.

III-SEMESTER

OBJECT ORIENTED PROGRAMMING


(OOP)

Presented By
Dr. D. BASWARAJ
Professor, CSE DEPT.
VCE, HYDERABAD
COURSE OBJECTIVES

Apply object-oriented principles to


develop applications using Java
constructs.
COURSE OUTCOMES

1. Apply object-oriented programming concepts to solve a


problem.
2. Employ exception handling, concurrent
programming practices to develop a parallel processing
application.
3. Perform I/O operations to develop an interactive Java
application.
4. Design a Java utility using the collection framework.
5. Apply functional programming constructs and
understand a large-scale project development
architecture style
SYLLABUS
UNIT – I: Object Oriented System Development: Understanding Object
Oriented Development, Understanding Object Concepts, Benefits of Object-
Oriented Development.
Java Programming Fundamentals: Introduction, Overview of Java, JVM
Architecture, Data types, Variables and Arrays, Operators, Control
Statements, Classes and Methods, Garbage Collection, this keyword, final,
Inheritance, Method Overriding.
UNIT – II: Classes and Interfaces: Singleton class, Abstract class, Nested
class, Interface, Package.
Exception Handling: Introduction, types of exceptions, syntax of exception
handling code, multiple catch statements, using finally statement, user-defined
exceptions.
Multithreaded Programming: Introduction to threads, creating threads,
extending the Thread class, implementing the Runnable interface, life cycle of
a thread, priority of a thread, synchronization, and Inter-thread
Communication, Deadlock.
SYLLABUS
UNIT – III:
String Handling: String, StringBuffer and StringBuilder.
Java.lang : Type Wrapper, Process, Runtime, Object class,
Generics.
Java.io: Java I/O Classes and Interfaces, Files and
Directories, Byte and Character Streams, Serialization.
UNIT – IV:
Introduction to Collection: Interfaces, Collection Classes,
Iterators, List, Set, Maps, Comparator, Arrays, Legacy
Classes and Interfaces, StringTokenizer, BitSet, Date,
Calendar, Random, Flow, Timer.
SYLLABUS …

UNIT – V:
Lambda expressions: Expressions, Functions, lambda as
argument
Stream API: Basics, Filter, Sort, Map, Collect
Regular Expressions: Pattern, Matcher, Regular expression
Syntax
JAVA Beans: Architecture
SYLLABUS …
Learning Resources:
1. Herbert Schildt, Java: The Complete Reference, 12th Edition, Tata
McGraw Hill 2021.
2. Joshua Bloch, Effective Java, 3rd Edition, Pearson, 2017
3. Timothy Budd, An introduction to Object-Oriented Programming,
3rd Edition, Pearson Education, 2008
4. Eric Freeman, Bert Bates, Kathy Sierra , Head First Design
Patterns: A Brain-Friendly Guide, 1st Edition, O’Reilly, 2016
5. P. RadhaKrishna, Object Oriented Programming through Java,
UniversitiesPress,2007.
6. Sachin Malhotra, Saurabh Choudhary, Programming in Java, 2nd
Edition, Oxford Press, 2014.
7. https://docs.oracle.com/javase/tutorial/java
UNIT-I

PART-1: Object Oriented System Development


1. Understanding Object Oriented Development
2. Understanding Object Concepts
3. Benefits of Object-Oriented Development
PART-2: Java Programming Fundamentals
1. Introduction, Overview of Java
2. JVM Architecture
3. Data types, Variables and Arrays
4. Operators, Control Statements,
5. Classes and Methods, this keyword, final
6. Inheritance, Method Overriding
7. Garbage Collection,
Part-1: Object Oriented System Development
1. Understanding Object Oriented Development
• Object-oriented development is a partial-lifecycle software
development method in which the decomposition of a system is
based upon the concept of an object.
• This method is fundamentally different from traditional functional
approaches to design and serves to help manage the complexity of
massive software-intensive systems.
• An object-oriented system is a software development model that
uses objects to represent different aspects of the application.
• Everything is considered an object in this type of system, including
data, processes, and functions.
• Object Oriented Programming (OOP) is a programming paradigm
that focuses on the use of objects to represent and manipulate data.
Need for OOP Paradigm
 OOP is an approach to program organization and
development, which attempts to eliminate some of the
drawbacks of conventional programming methods by
incorporating the best of structured programming
features with several new concepts.
 OOP allows us to decompose a problem into number of
entities called objects and then build data and methods
(functions) around these entities.
 The data of an object can be accessed only by the
methods associated with the object.
Understanding Object Oriented Development…
• OOP provides several key concepts that enable developers to write
modular, reusable, and maintainable code.
• The main ideas behind Java’s Object-Oriented Programming, OOP
concepts include abstraction, encapsulation, inheritance and
polymorphism.
• Object-oriented programming (OOP) is a programming
paradigm that uses “Objects “and their interactions to design
applications.
• OOP is an approach or a Programming pattern where the programs
are structured around objects rather than functions and logic.
• It makes the data partitioned into two memory areas, i.e., data and
functions, and helps make the code flexible and modular.
• Object-oriented programming mainly focuses on objects that are
required to be manipulated. In OOPs, it can represent data as
objects that have attributes and functions.
FOP versus OOP
Function Oriented Programming (FOP) Object Oriented Programming
(OOP)
Program organization Program is divided into small parts called functions. Program is divided into parts called
objects.

Importance Importance is not given to data but to functions Importance is given to the data rather than
procedures
Approach FOP follows top down approach OOP follows bottom up approach
Access Specifiers Does not have any access specifier Has three access specifiers, namely
Public, Private, Protected
Data Moving Data can move freely from function to function in the Objects can move and communicate with
system each other
Maintainability To add new data and function is not so easy Provides an easy way to add new data and
function
Data Access Function uses global data for sharing that can be accessed Object uses local data and can be
freely from function to function accessed in a control manner
in the system.
Data Hiding No data hiding is possible, hence security is not possible Provides data hiding, hence secured
programming is possible
Overloading Polymorphism is not possible Polymorphism is possible

Examples C, Visual Basic, FORTRAN, Pascal. C++, JAVA, Python, VB.NET, C#.NET.
Understanding Object Oriented Development…
• Object-oriented programming (OOP) is a programming
paradigm that uses “Objects “and their interactions to design
applications.
• It simplifies the software development and maintenance by
providing some concepts:
• Object
• Class
• Data Abstraction & Encapsulation
• Inheritance
• Polymorphism
• Objects are the basic run time entities in an object- oriented system.
They may represent a person, a place, a bank account, a table of
data or any item that the program has to handle.
Understanding Object Oriented Development…
• Class: The entire set of data and code of an object can be made of a
user defined data type with the help of a class.
• In fact, Objects are variables of the type class. Once a class has been
defined, we can create any number of objects belonging to that class.
• Classes are data types based on which objects are created.
Objects with similar properties and methods are grouped together
to form a Class.
• Thus, a Class represents a set of individual objects.
• Characteristics of an object are represented in a class as Properties.
The actions that can be performed by objects become functions of
the class and is referred to as Methods.
• A class is thus a collection of objects of similar type. For example,
mango, apple, and orange are members of the class fruit. Statement
fruit mango; will create an object mango belonging to the class fruit.
Understanding Object Oriented Development…
• Data Abstraction & Encapsulation:
• Abstraction refers to the act of representing essential features
without including the background details or explanations.
• Since the classes use the concept of data abstraction ,they are
known as abstraction data type(ADT).
• For example, a class Car would be made up of an Engine, Gearbox,
Steering objects, and many more components.
• To build the Car class, one does not need to know how the different
components work internally, but only how to interface with them.
• Humans manage complexity through abstraction. When you drive
your car, you do not have to be concerned with the exact internal
working of your car (unless you are a mechanic).
Encapsulation in
Java

Encapsulation in Java is a process of wrapping


code and data together into a single unit, for
example, a capsule which is mixed of several
medicines.
Understanding Object Oriented Development…
• Inheritance:
• Methods allows to reuse a sequence of statements.
• Inheritance allows to reuse classes by deriving a new class from an
existing one
• The existing class is called the parent class, or superclass, or base
class
• The derived class is called the child class or subclass.
• The child class inherits characteristics of the parent class (i.e., the
child class inherits the methods and data defined for the parent
class).
Understanding Object Oriented Development…
• Polymorphism:
• The same word or phrase can mean different things in different
contexts
• Analogy: In English, bank can mean side of a river or a place to put
money
• Function Overloading:
• The operation of one function depends on the argument passed to it.
Example: Fly(), Fly(low), Fly(150)
• In object-oriented programming, polymorphism refers to a
programming language's ability to process objects depending on
their class.
Polymorphism: Example
x, y;
s1, s2;
Img,Doc,Doc1,Doc2
print()
Add(x, y)
Add(s1, s2)
Add(Img, Doc)
Add(Doc1, Doc2)

Add(x, y) : 12 +34 Add two numbers

Add(s1 + s2) : Vasavi + College Merge two strings

Add(Img, Doc) : Image + Document Paste an Image to a document

Add(Doc1, Doc2) : Document1 + Document2 Merge two documents


2. Understanding Object Concepts
• The object concept is the knowledge that objects are permanent,
independent entities that exist in space and time even when one
cannot perceive or act on them.
• Humans would be almost unable to function without this
knowledge.
• The Swiss researcher Jean Piaget proposed the earliest
comprehensive account of object concept development in the 1930s.
• Objects contain data, referred to as attributes or properties, and
methods.
• OOP allows objects to interact with each other using four basic
principles: encapsulation, inheritance, polymorphism, and
abstraction.
• These four OOP principles enable objects to communicate and
collaborate to create powerful applications..
Understanding Object Concepts…
• An object in Java is a basic unit of Object-Oriented Programming
and represents real-life entities.
• Objects are the instances of a class that are created to use the
attributes and methods of a class.
• A typical Java program creates many objects, which as you know,
interact by invoking methods..
• An object consists of :
• State: It is represented by attributes of an object. It also reflects the
properties of an object.
• Behavior: It is represented by the methods of an object. It also
reflects the response of an object with other objects.
• Identity: It gives a unique name to an object and enables one object
to interact with other objects.
Understanding Object Concepts…
• Example of an Object: Dog
3. Benefits of Object-Oriented Development
• Object Oriented Development (OOD) has been touted as the next
great advance in software engineering.
• It promises to reduce development time, reduce the time and
resources required to maintain existing applications, increase code
reuse, and provide a competitive advantage to organizations that use
it.
• Many benefits are cited for OOD, often to an unrealistic degree.
Some of these potential benefits are…
• Faster Development: OOD has long been touted as leading to faster
development. Many of the claims of potentially reduced
development time are correct in principle, if a bit overstated.
• Reuse of Previous work: This is the benefit cited most commonly in
literature, particularly in business periodicals. OOD produces
software modules that can be plugged into one another, which
allows creation of new programs.
3. Benefits of Object-Oriented Development
• Increased Quality: Increases in quality are largely a by-product of
this program reuse. If 90% of a new application consists of proven,
existing components, then only the remaining 10% of the code has
to be tested from scratch. That observation implies an order-of-
magnitude reduction in defects.
• Modular Architecture: Object-oriented systems have a natural
structure for modular design: objects, subsystems, framework, and
so on. Thus, OOD systems are easier to modify.
• Client/Server Applications: By their very nature, client/server
applications involve transmission of messages back and forth over a
network, and the object-message paradigm of OOD meshes well
with the physical and conceptual architecture of client/server
applications.
• Better Mapping to the Problem Domain: This is a clear winner for
OOD, particularly when the project maps to the real world.
END OF
UNIT-1
PART-1

You might also like