Professional Documents
Culture Documents
ER/CORP/CRS/ LA1026
Confidential
Ver. No.:1.1
General Guideline
(2008) Infosys Technologies Ltd.
This document contains valuable confidential and proprietary information of Infosys. Such
confidential and proprietary information includes, amongst others, proprietary intellectual
property which can be legally protected and commercialized. Such information is furnished
herein for training purposes only. Except with the express prior written permission of Infosys,
this document and the information contained herein may not be published, disclosed, or used
for any other purpose.
Confidential
Confidential Information
Confidential
Learning approach
The following are strongly suggested for a better learning and
understanding of this course:
Noting down the key concepts in the class, explained by the
educator
Analyze all the examples / code snippets provided
Study and understand the self study topics
Completion and submission of all the assignments, on time
Completion of the self review questions in the lab guide
Study and understand all the artifacts including the reference
materials / e-learning / supplementary materials specified
Completion of the project (if applicable for this course) on time
inclusive of individual and group activities
Taking part in the self assessment activities
Participation in the doubt clearing sessions
Copyright 2008, Infosys Technologies Ltd.
Confidential
Course Pre-Requisites
The participants should have knowledge of programming basics
Confidential
Implementation of OOP
features using Java
Object Oriented programming skills are essential for creation of robust software
using languages like Java and C#
Confidential
Topics covered
Introduction to OOP
Object Oriented Concepts
Day 1
Structured vs OOP
Java as an OOP Language
Day 2
Selection Statements
Iteration Statements
Classes and Objects
this keyword
Confidential
Topics covered
Day 3
Day 4
Inheritance
Visibility Control: protected
'final' and 'super' keywords
Method Overriding
Abstract Class
Day 5
'static' keyword
Visibility Controls: public and private
Arrays and Strings
Method Overloading
Interfaces
Packages
Visibility Controls: default
Overview of OOAD and UML
Confidential
References
Grady Booch Object-Oriented Analysis & Design With
Applications(2nd Edition) in 2007
Craig Larman,Applying UML and Patterns, Pearson Education
Herbert Schildt The complete reference Java 2, 7th edition,
TML publication 2006
Cay S .Horstmann and Gary Cornell Core Java (TM) 2, Volume
I--Fundamentals (8th Edition) by Prentice Hall in 2007
Steven Holzner Java 2 Programming (JDK 5 Edition) Black
Book in 2006 Paraglyph press, Dreamtech press 2006
Web Site : http://java.sun.com/docs/books/tutorial/
Confidential
CMap
10
Confidential
Session Plan
Introduction to OOP
Object Oriented Concepts
Structured vs OOP
Java as an OOP Language
Java Architecture, Program Structure
Java Identifiers and Operators
11
Confidential
The structure of
plants - Complex
Human Brain A
very complex
system
What about
In real-world, systems are very complex in nature
Software??
Comprehending the complexity of such systems are beyond the
12
Confidential
System
Trading
Trading Interface
System
Middleware
My module
???
Remittance
Demand
Processing
Forecasting
Travel
Salary
System
System
HR
Policies
System
System
Departments
& Locations
Middleware
Web based
Users
Business
Intelligence
Sales
Electronic
Fund Transfer
System
Analysis
Customer
Order
Middleware
Support
Payments
System
Financial
Accounting
System
System
Finance
Analysis
Ageing
Sub-system 1
Analysis
Funds
Brokers
Order
Customer
Processing
Complaints
Assets
Banks
13
Sub-system 2
Confidential
Sub-system 3
14
Confidential
15
Confidential
How do we design
such complex systems
with such simple and
flexible interfaces???
16
Confidential
The technique of mastering complexity has been known since ancient times
:divide et impera(divide and rule)
-Dijkstra
17
Confidential
18
Confidential
Plant
Performs
Photosynthesis
Leaves
Stem
Leaf
Root
...
Root Hair
Root Apex
..
.
..
.
Root Cap
..
.
..
.
Stem
Holds Branches
and Leaves
Roots
Absorbs Water
and Nutrients
Complex
systems show
hierarchy
19
Confidential
made
up of
cells
Stem
Root
...
Complex
systems are
exhibit
common
patterns
Seed
Leaf
Root
Hair
...
made
up of
cells
Root
Apex
...
...
Root
Cap
...
made
up of
cells
made
up of
cells
Plant
Seedling
Complex systems
are built from
simpler
subsystems
20
Confidential
Tree
21
Confidential
Bottom up approach
22
Confidential
Item Maintenance
Menu
Item Maintenance
Menu
Add Item
Generate Item
Report
Item Purchase
Menu
Retail
Store
Add,update and
generate reports
Item
Master
Generate Bill
Purchase
Master
Search for items
Structured Approach
23
Confidential
24
Confidential
ER/CORP/CRS/ LA1026
Confidential
Ver. No.:1.1
Abstraction
Encapsulation
Inheritance
Polymorphism
26
Confidential
What is an Object?
An Object is
a tangible and/or visible entity
something that may be apprehended intellectually
something towards which thought or action is directed
something that has crisply defined boundaries
etc
A Better Definition could be
An Object
has state,
exhibits some well defined behavior,
has a unique identity
27
Confidential
What is an Object ?
STATE
BEHAVIOUR
It rolls
IDENTITY
28
Confidential
What is a class?
A class is a set of objects that share
a common behavior
29
Confidential
Figure shows that all these objects share common properties and behaviour
Vehicle is the class for all kinds of vehicle objects
Copyright 2008, Infosys Technologies Ltd.
30
Confidential
Abstraction(1/2)
Defined as the process of exposing the essential details and hiding
the non-essential details
Helps simplify the understanding and using of any complex
system
Eg.One does not have to understand how the engine works to drive
a car
Eg.Similarly one does not have to understand the internal
implementation of a software object to use it
31
Confidential
Abstraction(2/2)
Abstraction
Abstraction hides the essential and non-essential characteristics
based on the perspective of the user
Chloroplast,
Pigments,
Petals,
Stigma,
Stylus
Cells
Micro
Biologist
Botanist
Poet
32
Confidential
Encapsulation(1/3)
Encapsulate = En + Capsulate; En = In a; Encapsulate =
In a Capsule
Localization of information of knowledge within an object
Information hiding
Eg. The dashboard of a vehicle encapsulates all the
internal parts and hides certain details as well
33
Confidential
Encapsulation(1/3)
34
Confidential
Inheritance (1/2)
Concept wherein a class shares some common structure or
behaviour with one or more classes
Leads to the concept of Reusability of code
Classes are arranged in a tree like structure called a
hierarchy
Base class:
The class providing the implementation
Derived class:
The class inheriting the implementation
Copyright 2008, Infosys Technologies Ltd.
35
Confidential
Inheritance(2/2)
Base Class
Derived
Classes
Vehicle
Land Vehicle
Rail Vehicle
Water Vehicle
Road Vehicle
36
Confidential
Air Vehicle
Polymorphism(1/2)
Refers to an objects ability to behave differently depending
on its type
Poly = many
morph = form
Practice of using same method name/object to denote
several different operations
37
Confidential
Polymorphism(1/2)
Save As is used in
MS-Excel
application
Copyright 2008, Infosys Technologies Ltd.
38
Confidential
Polymorphism(1/2)
Save As is used in
MS-Word
Application
39
Confidential
Polymorphism(1/2)
Save As is used in
S-Powerpoint
Application
The Save As option saves the file differently depending on the application viz. Excel,Word or
PowerPoint , but the option remains the same in any Microsoft application
Copyright 2008, Infosys Technologies Ltd.
40
Confidential
Access Specifiers
Used to expose or hide the details/attributes in a class
Public
A declaration that is accessible to all clients
Protected
A declaration that is accessible to only to the class itself and its subclasses
Private
A declaration that is accessible to only to the class itself
41
Confidential
- Represents private
access specifier
+ Represents public
access specifier
Customer
-customerNo:int
-customerName:String
+getCustomerNo():int
+setCustomerNo(int)
+getCustomerName():String
+setCustomerName(String)
+displayBillAmount()
42
Methods or activities in
the class
Confidential
43
Confidential
44
Confidential
45
Confidential
Features (1/2)
Object-oriented
Pure Object oriented Language - class definitions are
mandatory
Programmer friendly features
Compared to earlier OO languages like C++, it is simpler for the
programmer to use the features
Designed considering the pitfalls of earlier languages
Robust
Exception handling is built-in as part of the language
Strong type checking (all data must be declared to belong to an
explicit type)
Local variables must be initialized
46
Confidential
Features (2/2)
Architecture Neutral / Portable
Example: Java code compiled on Windows can be run on Unix
without recompilation
Security
The Java language has built-in capabilities to ensure that
violations of security do not occur
47
Confidential
Java
Source
code
Java
Compiler
Java Virtual
Machine
48
Confidential
49
Confidential
50
Confidential
51
Confidential
Java Compiler(javac)
Byte Code(.class)
Interpreter(java)
Interpreter(java)
Win32
Interpreter(java)
Linux
52
Mac
Confidential
53
Confidential
54
Confidential
ER/CORP/CRS/ LA1026
Confidential
Ver. No.:1.1
Identifiers
Examples:
identifier
user_name
_sys_var1
$count
56
Confidential
57
Confidential
58
Confidential
Arithmetic Operators
Operators Description
+
Subtraction operator
Multiplication operator
Division operator
Remainder operator
59
Confidential
Relational Operators
Comparison operators (can be known as Relational operators)
can be used in conditional statements to compare values and
take action depending on the result
Operators
==
<
>
<=
>=
!=
Description
Equal to
Less than
Greater than
Less than or equal to
Greater than or equal to
Not equal to
60
Confidential
Logical Operators
Logical operators are based on boolean algebra
Based on testing conditions and results being true or false
Logical operators allow a program to make a decision based on
multiple conditions
Each operand is considered a condition that can be evaluated to
a true or false value
Operator
&&
||
Meaning
Operator
Short Circuit-AND
Short Circuit-OR
61
Meaning
Logical unary NOT
==
Equals to
!=
Not Equals to
Confidential
Summary
Introduction to Object-Oriented Programming
Object Oriented Concepts
Structured vs OO programming
Java Program Structure and Architecture
Java Language fundamentals
62
Confidential
Thank You
The contents of this document are proprietary and confidential to Infosys Technologies Ltd. and may
not be disclosed in whole or in part at any time, to any third party without the prior written consent of
Infosys Technologies Ltd.
2008 Infosys Technologies Ltd. All rights reserved. Copyright in the whole and any part of this
document belongs to Infosys Technologies Ltd. This work may not be used, sold, transferred, adapted,
abridged, copied or reproduced in whole or in part, in any manner or form, or in any media, without the
prior written consent of Infosys Technologies Ltd.
63
Confidential