SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Introduction to Java and
Object Oriented Programming
eLink Business Innovations -
©2000-2004
Overview of
WebSphere & Eclipse
Ready, Set, Start Your IDEs!
eLink Business Innovations
2002-2004 ©
WebSphere &
Eclipse
eLink Business Innovations
2002-2004 ©
Run a Wizard
Open a New
Perspective
List of Opened
Perspectives
Open Additional Views
Views
Editor Pane
Introduction to
Object Oriented (OO)
Concepts
eLink Business Innovations
2002-2004 ©
Programming Models
eLink Business Innovations
2002-2004 ©
Unstructured Programming
Main Program
Global Data
Unstructured
programming. The main
program directly operates
on global data.
Procedural Programming
Main Program
Procedural programming.
The main program
coordinates calls to
procedures and hands
over appropriate data as
parameters.
Still uses global data at
times.
Procedure 1
Procedure 2
Procedure 3
.
.
.
Execution Path
Modular Programming
Procedure 1
.
.
.
Module 1
Data (Global) + Data 1(Module 1)
Procedure 2 Procedure 1
.
.
.
Module 2
Data (Global) + Data 2(Module 2)
Procedure 2
Main Program
Data (Global)
In Modular
programming, the
main program
coordinates calls to
procedures in
separate modules
(files) and passes
appropriate data as
parameters.
Modular programs can
still have access to
global data.
Object Oriented
Programming Objects of the program
interact by sending
messages to each other
and encapsulating data in
the object or passed as a
message.Object 1
Object 3
Object 2
Object 4
Evolution of Programming Models
Object Instantiation
eLink Business Innovations
2002-2004 ©
Program Execution
File Definition
In-Memory Instantiation
CreditCardImpl
(creditcard1)
Instantiation
class abstract CreditCardImpl
extends Account
{
.
.
.
}
CreditCardImpl
(creditcard3)
CreditCardImpl
(creditcard2)
CreditCardImpl creditcard1 = new CreditCardImpl();
// Object Allocation
creditcard1.doSomething();
Denotes Sending Message to Object
Instantiation Properties:
Construction - Objects are created at execution time with new operator or declaration on some systems
Destruction - Objects are destroyed by delete operator, free call or garbage collectors
// Invoke Method
CreditCardImpl creditcard2 = new CreditCardImpl();
CreditCardImpl creditcard3 = new CreditCardImpl();
Inheritance
eLink Business Innovations
2002-2004 ©
Account
Savings Checking
Credit
Card
Money
Market
Visa AMEX
Interitance
"is-a"
"is-a"
Inheritance Properties:
Definition - Derivation from a Parent Cass to add/extend functionality in the child
Multipliciy - Language dependent, inheritance can have single (one) or multiple (more than one parent) parent
Associations
eLink Business Innovations
2002-2004 ©
Associations Multiplicity
Customer Account
1-*
Customer Account
0 1
Customer Account
1-* 1-*
"has-a or use"
Associations Properties:
Definition - Defines usage relationship with other objects.
Multiplicity - Associations can 0 or more relationship of other objects.
Binary Associate
"has-a or use"
"has-a or use"
Participating Class
customer[]account[]
Role Name
Encapsulation
eLink Business Innovations
2002-2004 ©
Encapsulation
Account
Credit Card
"is-a"
public static int TYPE_CC = 1;
private String name = "";
private int account = 0;
protected type = NONE;
public void setName( String name )
{
this.name = name;
}
CreditCard( int account )
{
// Valid
type = TYPE_CC;
// Invalid - Private
this.account = account;
}
Program Execution
// Allocate a new Object
CreditCard card =
new CreditCard("MyCard");
// Invalid - account is private
// and not using access
// method to data.
card.account = 12345;
// Valid - Using access method
card.setName("Changed My Mind");
Encapsulation Types:
private - Restricted access only to the Class, no external access
protected - Restricted to the inheritance hierarchy or namespace (classes in the namespace)
public - Visible to the world.
Polymorphism
eLink Business Innovations
2002-2004 ©
Polymorphism
Program Execution
// Allocate a new Object
CreditCard card =
new CreditCard("MyCard");
// Name Account - Casting Example
((Account)card).getName();
// Name from Credit Card
// Default
card.getName();
// Virtual method
card.getDescription();
Account
Credit Card
"is-a"
// Abstract Method
public abstract void getSummary()
{
return("Not summary for Account");
}
// Pure Virtual Method - No Body
public abstract void getDescription();
// Overloaded Method from Account
public String getSummary()
{
return("Summary for Credit Card");
}
// Required Implemented Method from Account
public String getDescription()
{
return("Credit Card Description");
}
Polymorphism Properties:
Virtual - Replace or extend by overloading/overiding the functionality of a parent's class method
Pure Virtual - Parent requires children to implement a specific method. Parent provides no implementation.
Construction/
Destruction
eLink Business Innovations
2002-2004 ©
Construction & Destruction
Account
Credit Card
"is-a"
Program Execution
// Construction
// Allocate a new Object
CreditCard card =
new CreditCard("MyCard");
// Java object destruction
card = null; // GC will process
// Destruction (Concept - C++)
// NOT available in Java
delete card;
CreditCard()
Account()
Instantiation Order Destruction Order
~Account()
~CreditCard()
Constructor Behavior:
Default - Default constructor provided if not explicitly specified in class.
Execution - Constructors are called only once for the creation of an object
Return Types - Constructors DO NOT support return types. To report errors they throw Exceptions.
Overloading - Constructors can be overloaded using various parameter types.
Destructor Behavior:
Default - Default constructor is provided if not explicity specified on systems that support destructors
Execution - Destructors are called only once at destruction of an object
Return Types - Destructors do NOT support return types. To report errors they throw exceptions.
Overloading - Destructors can NOT be overloaded with multiple parameter types.
Interface
eLink Business Innovations
2002-2004 ©
Interfaces
Program Execution
// Allocate a new Customer Object
CustomerAccount custAccount =
new AccountImpl();
// Access Customer Role
custAccount.getBalance();
// Allocate a new Teller Object
TellerAccount tellerAccount =
new TellerAccountImpl();
// Access Teller's Role
tellerAccount.getAuditRecords();
AccountImpl
(Class)
CustomerAccount
(Interface)
// Interface Definition
public int getBalance();
Interface Properties:
No Code - Interfaces contain no code, just the interface definitions.
No Statics - Interfaces cannot contain static interface definitions, because of the dependencies on classes for static initialization, excep static final for
constants definitions.
Multiplicity - Classes can implement multiple interfaces
TellerAccount
(Interface)
Dependency
class AccountImpl implements
CustomerAccount, TellerAccount
.
.
.
// Implementation
public int getBalance()
{
return( balance );
}
// Implementation
public AuditRecord[] getAuditRecords()
{
return( records );
}
// Interface Definition
public int getAuditRecords();
Templates
eLink Business Innovations
2002-2004 ©
Templates
Customer
(Source)
Template Properties:
Types - Templates allow strong typing of code
Cookie Cutter - Allows creation of source that can be reused again and again (cookie cutter)
Drawbacks - Causes considerable code growth in size, some compilers type to optimize this feature, but it's a macro type feature.
Examples - C++ Standard Collections, Microsoft Foundation Classes, Corba IDL languages
Customer
(New Source)
Account
(Source)
Account
(New Source)
Generated
Generated
Template Definition
template <typename T>
class List
{
private T list[];
public List<T []> list()
{
return(list);
}
}
Program Execution
// Account Using Template
Account account = new Account();
Account alist[] = null;
list = account.list();
// Customer Using Template
Customer customer = new Customer();
Customer clist[] = null;
list = customer.list();
Dependency (Utilizes)
Dependency (Utilizes)
Execution Path
Namespace
eLink Business Innovations
2002-2004 ©
Namespaces
Namespace Properties:
Resolution - Allows multiple names to exist in the same namespace with no conflicts.
Company 1
(no namespace)
Account
Company 2
(no namespace)
Account
Problem (Resolving)
Company 1
namespace: com.company1.accounting
Account
Solution (No Conflicts)
Company21
namespace: com.company2.accounting
Account
Naming Conflict
Exceptions
eLink Business Innovations
2002-2004 ©
Exceptions
Exception Properties:
Usage - Should not be used for normal flow control (like return codes). Exceptions require additional system
overhead on most systems.
Extentions - User can inherit from exceptions to create their own exception classes.
Program Execution
try
{
// Allocate a new Object
CreditCard card =
new CreditCard(0);
}
catch( NoAccountException nae )
{
// Process Exception
// Log something
}
catch( Exception unknown )
{
// Report Unknown Exception
}
finally
{
// Always do something
}
Credit Card
// Constructor
CreditCard( int account ) throws
NoAccountException
{
if( account == 0 )
throw NoAccountException();
}
Always called with/without Exception
UML Diagram
eLink Business Innovations
2002-2004 ©
Introduction to the
Java Model & History
eLink Business Innovations
2002-2004 ©
Java Objects
eLink Business Innovations
2002-2004 ©
java.lang
Java Object Hiarchy
Object
String Char Others
java.awt
Graphic
Implied Inheritance by Language
Security
eLink Business Innovations
2002-2004 ©
Java Security
Web Application
User
--------
--------
--------
--------
--------
01010110
1010100
101010
101
01
Web Service
01010110
1010100
101010
101
01
Mobile Clients
Service Layer Legacy Systems
MQ
CICS
DB2
LDAP
1
1
1
2
2
2
3
3
3
2
2
2
4
5
2
2
2
2
Security Points:
1. Authentication - User,Device or Service is Authenticated to the system or service (JAAS)
2. Transmission - Communications data is transmitted in Secure Socket (SSL or TLS) (JSSE)
3. Authorization - User, Device or Services is Authorized to use services, roles, (e.g. read/write/etc) (JAAS)
4. Isolation - Protectecting bad users or applications from each other. Sandbox issolation.
5. Validation - System validation between systems using
6. Auditing & Credentials - Auditing of activites for non-repudiation purposes along with credential monitoring
7. Encryption - Protecting data stored in persistence layer by encryption, hashing or certificates
4
4
7
1
3
7
5
5
5
5
5
6
3
3
3
Threads & Locks
eLink Business Innovations
2002-2004 ©
Java Threading & Locking
Thread Properties:
Create/Destroy - Ability to create and destroy threads in application
Suspend/Resume - Ability to suspend an resume threads
Priority - Ability to set the execution priority of threads
Synchronization/Locking - Create synchronized blocks of code that serialize data access between threads
Events/Semaphores/IPC - Supports wait and notify on objects to synchronize activities between threads
Main Program
(main thread)
Test 1 Thread
Test 2 Thread
Data
Begin Process
End Process
Thread Loops
Do work
asynchronously
Do work
asynchronously
Thread Ends
Thread Ends
Lock Data
Unlock Data
}Synchronization Block
Wait
Start Thread
Start Thread
Notify Thread
Threads are known by name.
Memory Management
eLink Business Innovations
2002-2004 ©
Java Program
Java Memory Management
Memory Management Properties:
Allocation - New allocation of objects is requested by the program and managed by the VM
DeAllocaiton - Object destruction and collection is managed by the Garbage Collector
Distributive GC - If working with distributive objects they are collected remotly then passed off the local GC
Hints - It's always good to assign null to objects or clear collections when finished using them
Java Virtual Machine
Garbage Collector (GC)
Object
Request New Object (new)
Object
Memory Manager
New
Object
Returned
Destroy Object
Object = null
Garbage Collector Checks
& Collects Unreference
Objects
Inform Memory
Manager Object has
been Collected
Internationalization
eLink Business Innovations
2002-2004 ©
Java Internationalization
Internationalization Properties:
Unicode - All Strings and Chars (2 bytes not 1) in Java are in Unicode Representation and UTF8 for ASCII
Locale - Users international location. Includes country code and regional information
Resources - Property names are used to fetch resource bundle based on User Locale
User - English
User - Spanish
User - Chineese
Application
--------
--------
--------
--------
--------
English
Resource Bundle
Spanish
Resource Bundle
Chineese
Resource Bundle
Check User Locale
get msg.hello
returns "Hello"
get msg.hello
returns "Hola"
get msg.hello
returns "030d020e0f" //
Unicode String Representation
Serialization
eLink Business Innovations
2002-2004 ©
Java Serialization
Serialization Properties:
Marshaling / Un-Marshaling - Enables "flattening" of objects in Java with minimal code changes
Caution - Be careful the "deepness" of an object and it's dependencies (inheritance & associations)
Externalization - Enables custom marshaling code like, encryption, compression, base64, etc.
Stored/Retrieved to/from a Database
Object
Serialize
010101010101010101010101010
De-serialize
Object
Sent Across a Network
Object 010101010101010101010101010 Object
Sent Across a Network
Use
Custom
Encoding
Use
Custom
Decoding
Externalization
JDK Packages
eLink Business Innovations
2002-2004 ©
Collections
eLink Business Innovations
2002-2004 ©
Java Collections
Collection Properties:
Framework - Common framework to standardize management of objects without writing custom code
Caution - Remember to clear collections or set colleciton object to null so memory leaks don't appear
Synchronization - Not all collections support synchronization for threading, check the documentation on collection.
Vector
Object
Object
Object
Hashtable
Object
Object
Object
MyKey_1 =
MyKey_2 =
MyKey_3 =
Collections Classes
- AbstractCollection
- AbstractList
- AbstractSet
- ArrayList,
- BeanContextServicesSupport
- BeanContextSupport,
- HashSet
- LinkedHashSet
- LinkedList
- TreeSet
- Vector
IO Streams
eLink Business Innovations
2002-2004 ©
Java Streams
Stream Properties:
Framework - Common framework to standardize input/output management of data without writing custom code
Object
Input Stream Classes
- AudioInputStream
- ByteArrayInputStream
- FileInputStream
- FilterInputStream
- InputStream
- ObjectInputStream
- PipedInputStream
- SequenceInputStream
- StringBufferInputStream
- AbstractCollection
Ouput Stream Classes
- ByteArrayOutputStream
- FileOutputStream
- FilterOutputStream
- ObjectOutputStream
- OutputStream
- PipedOutputStream
-----
--
----
File
Socket
Stream Reader/Writer
Stream Collection
Input
Stream
Output
Stream
Networking
eLink Business Innovations
2002-2004 ©
Java Networking
Network Properties:
Framework - Common framework to standardize networking without writing custom code
Network Classes (Some)
UDP Layer
- DatagramSocket
- DatagramPackets
- MulticastSockets
- DatagramChannel (NIO)
TCP Layer
- Socket
- SSLSocket
- SocketChannel (NIO)
- InetSocketAddress (NIO)
Application Layer
- URLConnection
- HTTPURLConnection
- JarURLConnection
- ServerSocket
- SSLServerSocket
- RMIClientSocketFactory/Listener
IP
UDP Layer (Datagrams)
TCP Layer
Application Protocols
TCP/IP Network Stack
Graphical Interfaces (GUI)
eLink Business Innovations
2002-2004 ©
2D Graphics
eLink Business Innovations
2002-2004 ©
Introduction to the Java
Language
(Syntax & Structure)
eLink Business Innovations
2002-2004 ©
Comments & JavaDocs
eLink Business Innovations
2002-2004 ©
Single Line Comment
// This is a Java Single Line Comment
Comment Block
/*
* This is a mult-line block comment
* Second line, so on.
*/
JavaDoc Comments to Generated Docs
/**
* @author Bubba Gump
* @example <h1>test message</h2>
*
* @todo
*/
JavaDoc Example
eLink Business Innovations
2002-2004 ©
Identifiers
eLink Business Innovations
2002-2004 ©
/**
* Example of Java Coding Syntax
*
*/
class CustomerAccount // First letter of each phrase, including first
{
private String accountNumber = null; // Field name lower case start, then uppercase
// for each phrase
/**
* Return an account number
* @return accountName
*/
public String getAccountNumber() // First letter lowercase, getter matches Field
{ // in Uppercase of each Phrase
return( accountNumber );
}
/**
* Set the account number
* @return accountName
*/
public void setAccountNumber( String accountNumber ) // Setter structure same as getter
{
this.accountNumber = accountNumber;
}
}
Literals
eLink Business Innovations
2002-2004 ©
long count = 10; // 10 is the literal value
char name = ’A’; // ‘A’ is a Unicode literal character
String name = “test”; // “Test” is a Unicode literal String
Java Logic Flow
eLink Business Innovations
2002-2004 ©
Java Development Process
Account.java
class Account
{
public static void main( String args[])
{
System.out.println("Hello World");
}
}
Java Compiler
01010101010101
00101010101010
10101010101010
101010101010
10101010
0101
Account.class
Java Interpreter Java Interpreter Java Interpreter
Windows Linux iSeries
Names Need to Match
Generated Byte-codes
Hello
World
Hello
World
Hello
World
Java Interface
eLink Business Innovations
2002-2004 ©
Interface Decomposition (File Representation)
interface CreditCard
extends Account
{
public static final TYPE_NONE = 0;
public setName(char name);
public setNumber(char number);
public setType(int type);
}
Interface Definition (Noun)
} Method Definitions (Verb)
Visibility (Public ONLY)
Parent Inherited Interface
Constant Definitions
Java Class
eLink Business Innovations
2002-2004 ©
Class Decomposition (File Representation)
class abstract CreditCardImpl
extends AccountImpl
implements CreditCard
{
private char name = 0;
private char number = 0;
private static int amount = 0;
Account(){};
public void finalize(){};
static
{
amount = 100;
}
public setName(char name)
{
this.name = name;
}
public void validate()
throws ValidationException
{
}
public abstract setNumber(char number)
{
this.number = number;
}
public abstract setType(int type);
}
} Data Declaration
Constructor
} Method Body
Internal Object Reference
(reserved word)
Visibility (Encapsulation)
Parent Inherited Base Class
} Virtual Method
Pure Virtual Method
Interface Definition
Static Initializer
Exception Declaration
Destructor Like
Class Definition (Noun)
Method Declaration (Verb)
Packages (Namespaces)
eLink Business Innovations
2002-2004 ©
Java Packages
Package Properties:
Naming - Package naming convention reads from left to right. Usually the internet domain name, then user
defined components
Default Package - One packages is imported into the class by default. That is javax.lang.* .This package doesn't have
to be imported explicitly like other packages.
Folders - The package name location has to match the directory structure on the file system so java compiler
can find the package.
Object
Account
Savings
Customer
import java.net.*;
import java.io.ByteArrayInputStream;
ByteArrayInputStream stream = new
ByteArrayInputStream();
Importing Packages
Declaring Packages
com.unitedbank.atm.Customer
package com.unitedbank.atm;
class Customer
{....}
----------------------------------------
maps to a file system directory
com/unitedbank/atm/Customer.java
Java Objects
eLink Business Innovations
2002-2004 ©
Java Objects
Casting Properties:
Allocate - Reserved work "new" to create an instance
De-Allocate - Set object to reserved word "null". Tells the garbage collector object is ready to be collected.
Object
Account
Savings
Customer
// Default Initialization
Account account = null;
// Instantiate new account object
account = new Account();
// Free object - hint to GC
account = null;
Java Casting
eLink Business Innovations
2002-2004 ©
Java Casting
Casting Properties:
Strong Types - Collection values are commonly cast in JDK 1.0-1.4, however in JDK 1.5 introduces strong types
to the Java language. Template like feature.
Object
Account
Savings
Customer
Customer customer = new Customer();
Savings savings = new Savings()
Account account = null;
// Cast Example 1
account = (Account)savings; // Good Cast
// Cast Example 2
Vector list = new Vector();
list.add( savings );
account = (Account)list.get(0); // Good Case
// Case Example3 - Bad Cast
// causes a ClassCastException
account = (Account)customer;
Java Exceptions
eLink Business Innovations
2002-2004 ©
Java Exceptions
Exception Properties:
Usage - Exceptions should be used in exceptional conditions but not as flow control flow for an application.
Catching an Exception
try
{
// Do work that throws the exception
}
catch( java.lang.NullPointerException npe )
{
// Catch the concrete exception type,
// you should not catch a generic Exception
}
finally
{
// Optional - good for cleanup code
// like database connections, etc
}
Custom Exceptions (Extending)
class MyNewException extends Exception
{
public String getReason()
{
return( "code is broken" );
}
}
Throwing Exceptions
class MyClass
{
public String checkData(String data) throws NullPointerException
{
if( data == null )
throw new NullPointerException();
}
}
Java Threads
eLink Business Innovations
2002-2004 ©
Java Threads
Exception Properties:
Usage - Provide multi-tasking support for java and are easy to implement and use
Starvation - A thread that abuses system resource and causes other threads to starve for time to run. Usually a bad loop.
Deadlock - Circular dependencies between two threads both end up waiting on each other to complete.
Race Condition - Two threads that go after the same resource that are not synchronized. It's random who receives the resource
first.
Creating a Thread
// Create a new Thread Instance
Thread myThread = new Thread("Worker Thread", new MyThread() );
// Start the thread
myThread.start();
// Dispatch thread to wake up
myThread.doSomething();
Declaring a Thread
class MyThread implements Runnable
{
private static boolean terminate = false;
private static Object lock = new Object();
public void doSomething()
{
synchronized(lock)
{
lock.notify();
}
}
// Entry point for the thread
public void run()
{
while(!terminate)
{
synchronized(lock)
{
lock.wait();
}
}
}
}
First Java Program!
eLink Business Innovations
2002-2004 ©
Perspective
eLink Business Innovations
2002-2004 ©
Projects
eLink Business Innovations
2002-2004 ©
Project Workspace
eLink Business Innovations
2002-2004 ©
Packages
eLink Business Innovations
2002-2004 ©
Classes
eLink Business Innovations
2002-2004 ©
Attributes
eLink Business Innovations
2002-2004 ©
Running Our Program
eLink Business Innovations
2002-2004 ©
Debugging
eLink Business Innovations
2002-2004 ©
Testing
eLink Business Innovations
2002-2004 ©
package com.unitedbank.atm.test;
import com.unitedbank.atm.service.ServiceImpl;
import com.unitedbank.atm.service.CustomerService;
import junit.framework.TestCase;
/**
*
*/
public class TestCustomerService extends TestCase
{
public void testGetCustomerAccounts()
{
CustomerService service = new ServiceImpl(); // fetch from repository
service.getAccounts("bob", "password");
}
}
Test - Executing
eLink Business Innovations
2002-2004 ©
Questions ?
eLink Business Innovations
2002-2004 ©

Weitere ähnliche Inhalte

Was ist angesagt?

Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesecosio GmbH
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise Group
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)ejlp12
 
Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Greg Szczotka
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepGuo Albert
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 
Application package
Application packageApplication package
Application packageJAYAARC
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentationJohn Slick
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Trainingsourabh aggarwal
 
Mark Jackson\'s Portfoilo
Mark Jackson\'s PortfoiloMark Jackson\'s Portfoilo
Mark Jackson\'s PortfoiloMark_Jackson
 

Was ist angesagt? (20)

JPA 2.0
JPA 2.0JPA 2.0
JPA 2.0
 
Deployment
DeploymentDeployment
Deployment
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 training
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
 
Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014
 
Hibernate III
Hibernate IIIHibernate III
Hibernate III
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Application package
Application packageApplication package
Application package
 
S313937 cdi dochez
S313937 cdi dochezS313937 cdi dochez
S313937 cdi dochez
 
JPA For Beginner's
JPA For Beginner'sJPA For Beginner's
JPA For Beginner's
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
Jpa
JpaJpa
Jpa
 
Spring Framework -I
Spring Framework -ISpring Framework -I
Spring Framework -I
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Training
 
Mark Jackson\'s Portfoilo
Mark Jackson\'s PortfoiloMark Jackson\'s Portfoilo
Mark Jackson\'s Portfoilo
 
Java persistence api 2.1
Java persistence api 2.1Java persistence api 2.1
Java persistence api 2.1
 

Andere mochten auch

Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaGlenn Guden
 
Design Pattern lecture 1
Design Pattern lecture 1Design Pattern lecture 1
Design Pattern lecture 1Julie Iskander
 
Object oriented fundamentals_in_java
Object oriented fundamentals_in_javaObject oriented fundamentals_in_java
Object oriented fundamentals_in_javaSelf
 
Unified modelling language (UML)
Unified modelling language (UML)Unified modelling language (UML)
Unified modelling language (UML)Hirra Sultan
 
OOP programming
OOP programmingOOP programming
OOP programminganhdbh
 
OO Development 3 - Models And UML
OO Development 3 - Models And UMLOO Development 3 - Models And UML
OO Development 3 - Models And UMLRandy Connolly
 
Module 3 Object Oriented Data Models Object Oriented notations
Module 3  Object Oriented Data Models Object Oriented notationsModule 3  Object Oriented Data Models Object Oriented notations
Module 3 Object Oriented Data Models Object Oriented notationsTaher Barodawala
 
Java Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceJava Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceOum Saokosal
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?Colin Riley
 
Java 103 intro to java data structures
Java 103   intro to java data structuresJava 103   intro to java data structures
Java 103 intro to java data structuresagorolabs
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Michelle Anne Meralpis
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Javabackdoor
 

Andere mochten auch (20)

Object Oriented Programming Concepts using Java
Object Oriented Programming Concepts using JavaObject Oriented Programming Concepts using Java
Object Oriented Programming Concepts using Java
 
Java OO Revisited
Java OO RevisitedJava OO Revisited
Java OO Revisited
 
Applying OO Concepts
Applying OO ConceptsApplying OO Concepts
Applying OO Concepts
 
Design Pattern lecture 1
Design Pattern lecture 1Design Pattern lecture 1
Design Pattern lecture 1
 
JavaYDL15
JavaYDL15JavaYDL15
JavaYDL15
 
Itt1 sd uml and oo
Itt1 sd uml and ooItt1 sd uml and oo
Itt1 sd uml and oo
 
Object oriented fundamentals_in_java
Object oriented fundamentals_in_javaObject oriented fundamentals_in_java
Object oriented fundamentals_in_java
 
OO & UML
OO & UMLOO & UML
OO & UML
 
Unified modelling language (UML)
Unified modelling language (UML)Unified modelling language (UML)
Unified modelling language (UML)
 
OOP programming
OOP programmingOOP programming
OOP programming
 
OO Development 3 - Models And UML
OO Development 3 - Models And UMLOO Development 3 - Models And UML
OO Development 3 - Models And UML
 
Module 3 Object Oriented Data Models Object Oriented notations
Module 3  Object Oriented Data Models Object Oriented notationsModule 3  Object Oriented Data Models Object Oriented notations
Module 3 Object Oriented Data Models Object Oriented notations
 
Packaes & interfaces
Packaes & interfacesPackaes & interfaces
Packaes & interfaces
 
Java Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceJava Programming - Abstract Class and Interface
Java Programming - Abstract Class and Interface
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?
 
Uml
UmlUml
Uml
 
Java 103 intro to java data structures
Java 103   intro to java data structuresJava 103   intro to java data structures
Java 103 intro to java data structures
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 

Ähnlich wie Introduction to OO, Java and Eclipse/WebSphere

Java Programming
Java ProgrammingJava Programming
Java ProgrammingTracy Clark
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsSalesforce Developers
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfoliocummings49
 
Multi-tenancy with Rails
Multi-tenancy with RailsMulti-tenancy with Rails
Multi-tenancy with RailsPaul Gallagher
 
Whidbey old
Whidbey old Whidbey old
Whidbey old grenaud
 
Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)Mohamed Saleh
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design patternchetankane
 
Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.Nelson Gomes
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net FundamentalsLiquidHub
 
Beyond MVC: from Model to Domain
Beyond MVC: from Model to DomainBeyond MVC: from Model to Domain
Beyond MVC: from Model to DomainJeremy Cook
 
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Sparkhound Inc.
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)guiwoda
 
Java programming concept
Java programming conceptJava programming concept
Java programming conceptSanjay Gunjal
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationMark Gu
 
Unit 1- OOAD ppt
Unit 1- OOAD  pptUnit 1- OOAD  ppt
Unit 1- OOAD pptPRIANKA R
 

Ähnlich wie Introduction to OO, Java and Eclipse/WebSphere (20)

Java Programming
Java ProgrammingJava Programming
Java Programming
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong Foundations
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
 
Foundations of programming
Foundations of programmingFoundations of programming
Foundations of programming
 
Multi-tenancy with Rails
Multi-tenancy with RailsMulti-tenancy with Rails
Multi-tenancy with Rails
 
Whidbey old
Whidbey old Whidbey old
Whidbey old
 
Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
 
Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.Codebits 2012 - Fast relational web site construction.
Codebits 2012 - Fast relational web site construction.
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
 
Beyond MVC: from Model to Domain
Beyond MVC: from Model to DomainBeyond MVC: from Model to Domain
Beyond MVC: from Model to Domain
 
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 
C#Portfolio
C#PortfolioC#Portfolio
C#Portfolio
 
Kasi Resume
Kasi ResumeKasi Resume
Kasi Resume
 
Silverlight & WCF RIA
Silverlight & WCF RIASilverlight & WCF RIA
Silverlight & WCF RIA
 
Unit 1- OOAD ppt
Unit 1- OOAD  pptUnit 1- OOAD  ppt
Unit 1- OOAD ppt
 

Kürzlich hochgeladen

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Kürzlich hochgeladen (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Introduction to OO, Java and Eclipse/WebSphere

  • 1. Introduction to Java and Object Oriented Programming eLink Business Innovations - ©2000-2004
  • 2. Overview of WebSphere & Eclipse Ready, Set, Start Your IDEs! eLink Business Innovations 2002-2004 ©
  • 3. WebSphere & Eclipse eLink Business Innovations 2002-2004 © Run a Wizard Open a New Perspective List of Opened Perspectives Open Additional Views Views Editor Pane
  • 4. Introduction to Object Oriented (OO) Concepts eLink Business Innovations 2002-2004 ©
  • 5. Programming Models eLink Business Innovations 2002-2004 © Unstructured Programming Main Program Global Data Unstructured programming. The main program directly operates on global data. Procedural Programming Main Program Procedural programming. The main program coordinates calls to procedures and hands over appropriate data as parameters. Still uses global data at times. Procedure 1 Procedure 2 Procedure 3 . . . Execution Path Modular Programming Procedure 1 . . . Module 1 Data (Global) + Data 1(Module 1) Procedure 2 Procedure 1 . . . Module 2 Data (Global) + Data 2(Module 2) Procedure 2 Main Program Data (Global) In Modular programming, the main program coordinates calls to procedures in separate modules (files) and passes appropriate data as parameters. Modular programs can still have access to global data. Object Oriented Programming Objects of the program interact by sending messages to each other and encapsulating data in the object or passed as a message.Object 1 Object 3 Object 2 Object 4 Evolution of Programming Models
  • 6. Object Instantiation eLink Business Innovations 2002-2004 © Program Execution File Definition In-Memory Instantiation CreditCardImpl (creditcard1) Instantiation class abstract CreditCardImpl extends Account { . . . } CreditCardImpl (creditcard3) CreditCardImpl (creditcard2) CreditCardImpl creditcard1 = new CreditCardImpl(); // Object Allocation creditcard1.doSomething(); Denotes Sending Message to Object Instantiation Properties: Construction - Objects are created at execution time with new operator or declaration on some systems Destruction - Objects are destroyed by delete operator, free call or garbage collectors // Invoke Method CreditCardImpl creditcard2 = new CreditCardImpl(); CreditCardImpl creditcard3 = new CreditCardImpl();
  • 7. Inheritance eLink Business Innovations 2002-2004 © Account Savings Checking Credit Card Money Market Visa AMEX Interitance "is-a" "is-a" Inheritance Properties: Definition - Derivation from a Parent Cass to add/extend functionality in the child Multipliciy - Language dependent, inheritance can have single (one) or multiple (more than one parent) parent
  • 8. Associations eLink Business Innovations 2002-2004 © Associations Multiplicity Customer Account 1-* Customer Account 0 1 Customer Account 1-* 1-* "has-a or use" Associations Properties: Definition - Defines usage relationship with other objects. Multiplicity - Associations can 0 or more relationship of other objects. Binary Associate "has-a or use" "has-a or use" Participating Class customer[]account[] Role Name
  • 9. Encapsulation eLink Business Innovations 2002-2004 © Encapsulation Account Credit Card "is-a" public static int TYPE_CC = 1; private String name = ""; private int account = 0; protected type = NONE; public void setName( String name ) { this.name = name; } CreditCard( int account ) { // Valid type = TYPE_CC; // Invalid - Private this.account = account; } Program Execution // Allocate a new Object CreditCard card = new CreditCard("MyCard"); // Invalid - account is private // and not using access // method to data. card.account = 12345; // Valid - Using access method card.setName("Changed My Mind"); Encapsulation Types: private - Restricted access only to the Class, no external access protected - Restricted to the inheritance hierarchy or namespace (classes in the namespace) public - Visible to the world.
  • 10. Polymorphism eLink Business Innovations 2002-2004 © Polymorphism Program Execution // Allocate a new Object CreditCard card = new CreditCard("MyCard"); // Name Account - Casting Example ((Account)card).getName(); // Name from Credit Card // Default card.getName(); // Virtual method card.getDescription(); Account Credit Card "is-a" // Abstract Method public abstract void getSummary() { return("Not summary for Account"); } // Pure Virtual Method - No Body public abstract void getDescription(); // Overloaded Method from Account public String getSummary() { return("Summary for Credit Card"); } // Required Implemented Method from Account public String getDescription() { return("Credit Card Description"); } Polymorphism Properties: Virtual - Replace or extend by overloading/overiding the functionality of a parent's class method Pure Virtual - Parent requires children to implement a specific method. Parent provides no implementation.
  • 11. Construction/ Destruction eLink Business Innovations 2002-2004 © Construction & Destruction Account Credit Card "is-a" Program Execution // Construction // Allocate a new Object CreditCard card = new CreditCard("MyCard"); // Java object destruction card = null; // GC will process // Destruction (Concept - C++) // NOT available in Java delete card; CreditCard() Account() Instantiation Order Destruction Order ~Account() ~CreditCard() Constructor Behavior: Default - Default constructor provided if not explicitly specified in class. Execution - Constructors are called only once for the creation of an object Return Types - Constructors DO NOT support return types. To report errors they throw Exceptions. Overloading - Constructors can be overloaded using various parameter types. Destructor Behavior: Default - Default constructor is provided if not explicity specified on systems that support destructors Execution - Destructors are called only once at destruction of an object Return Types - Destructors do NOT support return types. To report errors they throw exceptions. Overloading - Destructors can NOT be overloaded with multiple parameter types.
  • 12. Interface eLink Business Innovations 2002-2004 © Interfaces Program Execution // Allocate a new Customer Object CustomerAccount custAccount = new AccountImpl(); // Access Customer Role custAccount.getBalance(); // Allocate a new Teller Object TellerAccount tellerAccount = new TellerAccountImpl(); // Access Teller's Role tellerAccount.getAuditRecords(); AccountImpl (Class) CustomerAccount (Interface) // Interface Definition public int getBalance(); Interface Properties: No Code - Interfaces contain no code, just the interface definitions. No Statics - Interfaces cannot contain static interface definitions, because of the dependencies on classes for static initialization, excep static final for constants definitions. Multiplicity - Classes can implement multiple interfaces TellerAccount (Interface) Dependency class AccountImpl implements CustomerAccount, TellerAccount . . . // Implementation public int getBalance() { return( balance ); } // Implementation public AuditRecord[] getAuditRecords() { return( records ); } // Interface Definition public int getAuditRecords();
  • 13. Templates eLink Business Innovations 2002-2004 © Templates Customer (Source) Template Properties: Types - Templates allow strong typing of code Cookie Cutter - Allows creation of source that can be reused again and again (cookie cutter) Drawbacks - Causes considerable code growth in size, some compilers type to optimize this feature, but it's a macro type feature. Examples - C++ Standard Collections, Microsoft Foundation Classes, Corba IDL languages Customer (New Source) Account (Source) Account (New Source) Generated Generated Template Definition template <typename T> class List { private T list[]; public List<T []> list() { return(list); } } Program Execution // Account Using Template Account account = new Account(); Account alist[] = null; list = account.list(); // Customer Using Template Customer customer = new Customer(); Customer clist[] = null; list = customer.list(); Dependency (Utilizes) Dependency (Utilizes) Execution Path
  • 14. Namespace eLink Business Innovations 2002-2004 © Namespaces Namespace Properties: Resolution - Allows multiple names to exist in the same namespace with no conflicts. Company 1 (no namespace) Account Company 2 (no namespace) Account Problem (Resolving) Company 1 namespace: com.company1.accounting Account Solution (No Conflicts) Company21 namespace: com.company2.accounting Account Naming Conflict
  • 15. Exceptions eLink Business Innovations 2002-2004 © Exceptions Exception Properties: Usage - Should not be used for normal flow control (like return codes). Exceptions require additional system overhead on most systems. Extentions - User can inherit from exceptions to create their own exception classes. Program Execution try { // Allocate a new Object CreditCard card = new CreditCard(0); } catch( NoAccountException nae ) { // Process Exception // Log something } catch( Exception unknown ) { // Report Unknown Exception } finally { // Always do something } Credit Card // Constructor CreditCard( int account ) throws NoAccountException { if( account == 0 ) throw NoAccountException(); } Always called with/without Exception
  • 16. UML Diagram eLink Business Innovations 2002-2004 ©
  • 17. Introduction to the Java Model & History eLink Business Innovations 2002-2004 ©
  • 18. Java Objects eLink Business Innovations 2002-2004 © java.lang Java Object Hiarchy Object String Char Others java.awt Graphic Implied Inheritance by Language
  • 19. Security eLink Business Innovations 2002-2004 © Java Security Web Application User -------- -------- -------- -------- -------- 01010110 1010100 101010 101 01 Web Service 01010110 1010100 101010 101 01 Mobile Clients Service Layer Legacy Systems MQ CICS DB2 LDAP 1 1 1 2 2 2 3 3 3 2 2 2 4 5 2 2 2 2 Security Points: 1. Authentication - User,Device or Service is Authenticated to the system or service (JAAS) 2. Transmission - Communications data is transmitted in Secure Socket (SSL or TLS) (JSSE) 3. Authorization - User, Device or Services is Authorized to use services, roles, (e.g. read/write/etc) (JAAS) 4. Isolation - Protectecting bad users or applications from each other. Sandbox issolation. 5. Validation - System validation between systems using 6. Auditing & Credentials - Auditing of activites for non-repudiation purposes along with credential monitoring 7. Encryption - Protecting data stored in persistence layer by encryption, hashing or certificates 4 4 7 1 3 7 5 5 5 5 5 6 3 3 3
  • 20. Threads & Locks eLink Business Innovations 2002-2004 © Java Threading & Locking Thread Properties: Create/Destroy - Ability to create and destroy threads in application Suspend/Resume - Ability to suspend an resume threads Priority - Ability to set the execution priority of threads Synchronization/Locking - Create synchronized blocks of code that serialize data access between threads Events/Semaphores/IPC - Supports wait and notify on objects to synchronize activities between threads Main Program (main thread) Test 1 Thread Test 2 Thread Data Begin Process End Process Thread Loops Do work asynchronously Do work asynchronously Thread Ends Thread Ends Lock Data Unlock Data }Synchronization Block Wait Start Thread Start Thread Notify Thread Threads are known by name.
  • 21. Memory Management eLink Business Innovations 2002-2004 © Java Program Java Memory Management Memory Management Properties: Allocation - New allocation of objects is requested by the program and managed by the VM DeAllocaiton - Object destruction and collection is managed by the Garbage Collector Distributive GC - If working with distributive objects they are collected remotly then passed off the local GC Hints - It's always good to assign null to objects or clear collections when finished using them Java Virtual Machine Garbage Collector (GC) Object Request New Object (new) Object Memory Manager New Object Returned Destroy Object Object = null Garbage Collector Checks & Collects Unreference Objects Inform Memory Manager Object has been Collected
  • 22. Internationalization eLink Business Innovations 2002-2004 © Java Internationalization Internationalization Properties: Unicode - All Strings and Chars (2 bytes not 1) in Java are in Unicode Representation and UTF8 for ASCII Locale - Users international location. Includes country code and regional information Resources - Property names are used to fetch resource bundle based on User Locale User - English User - Spanish User - Chineese Application -------- -------- -------- -------- -------- English Resource Bundle Spanish Resource Bundle Chineese Resource Bundle Check User Locale get msg.hello returns "Hello" get msg.hello returns "Hola" get msg.hello returns "030d020e0f" // Unicode String Representation
  • 23. Serialization eLink Business Innovations 2002-2004 © Java Serialization Serialization Properties: Marshaling / Un-Marshaling - Enables "flattening" of objects in Java with minimal code changes Caution - Be careful the "deepness" of an object and it's dependencies (inheritance & associations) Externalization - Enables custom marshaling code like, encryption, compression, base64, etc. Stored/Retrieved to/from a Database Object Serialize 010101010101010101010101010 De-serialize Object Sent Across a Network Object 010101010101010101010101010 Object Sent Across a Network Use Custom Encoding Use Custom Decoding Externalization
  • 24. JDK Packages eLink Business Innovations 2002-2004 ©
  • 25. Collections eLink Business Innovations 2002-2004 © Java Collections Collection Properties: Framework - Common framework to standardize management of objects without writing custom code Caution - Remember to clear collections or set colleciton object to null so memory leaks don't appear Synchronization - Not all collections support synchronization for threading, check the documentation on collection. Vector Object Object Object Hashtable Object Object Object MyKey_1 = MyKey_2 = MyKey_3 = Collections Classes - AbstractCollection - AbstractList - AbstractSet - ArrayList, - BeanContextServicesSupport - BeanContextSupport, - HashSet - LinkedHashSet - LinkedList - TreeSet - Vector
  • 26. IO Streams eLink Business Innovations 2002-2004 © Java Streams Stream Properties: Framework - Common framework to standardize input/output management of data without writing custom code Object Input Stream Classes - AudioInputStream - ByteArrayInputStream - FileInputStream - FilterInputStream - InputStream - ObjectInputStream - PipedInputStream - SequenceInputStream - StringBufferInputStream - AbstractCollection Ouput Stream Classes - ByteArrayOutputStream - FileOutputStream - FilterOutputStream - ObjectOutputStream - OutputStream - PipedOutputStream ----- -- ---- File Socket Stream Reader/Writer Stream Collection Input Stream Output Stream
  • 27. Networking eLink Business Innovations 2002-2004 © Java Networking Network Properties: Framework - Common framework to standardize networking without writing custom code Network Classes (Some) UDP Layer - DatagramSocket - DatagramPackets - MulticastSockets - DatagramChannel (NIO) TCP Layer - Socket - SSLSocket - SocketChannel (NIO) - InetSocketAddress (NIO) Application Layer - URLConnection - HTTPURLConnection - JarURLConnection - ServerSocket - SSLServerSocket - RMIClientSocketFactory/Listener IP UDP Layer (Datagrams) TCP Layer Application Protocols TCP/IP Network Stack
  • 28. Graphical Interfaces (GUI) eLink Business Innovations 2002-2004 ©
  • 29. 2D Graphics eLink Business Innovations 2002-2004 ©
  • 30. Introduction to the Java Language (Syntax & Structure) eLink Business Innovations 2002-2004 ©
  • 31. Comments & JavaDocs eLink Business Innovations 2002-2004 © Single Line Comment // This is a Java Single Line Comment Comment Block /* * This is a mult-line block comment * Second line, so on. */ JavaDoc Comments to Generated Docs /** * @author Bubba Gump * @example <h1>test message</h2> * * @todo */
  • 32. JavaDoc Example eLink Business Innovations 2002-2004 ©
  • 33. Identifiers eLink Business Innovations 2002-2004 © /** * Example of Java Coding Syntax * */ class CustomerAccount // First letter of each phrase, including first { private String accountNumber = null; // Field name lower case start, then uppercase // for each phrase /** * Return an account number * @return accountName */ public String getAccountNumber() // First letter lowercase, getter matches Field { // in Uppercase of each Phrase return( accountNumber ); } /** * Set the account number * @return accountName */ public void setAccountNumber( String accountNumber ) // Setter structure same as getter { this.accountNumber = accountNumber; } }
  • 34. Literals eLink Business Innovations 2002-2004 © long count = 10; // 10 is the literal value char name = ’A’; // ‘A’ is a Unicode literal character String name = “test”; // “Test” is a Unicode literal String
  • 35. Java Logic Flow eLink Business Innovations 2002-2004 © Java Development Process Account.java class Account { public static void main( String args[]) { System.out.println("Hello World"); } } Java Compiler 01010101010101 00101010101010 10101010101010 101010101010 10101010 0101 Account.class Java Interpreter Java Interpreter Java Interpreter Windows Linux iSeries Names Need to Match Generated Byte-codes Hello World Hello World Hello World
  • 36. Java Interface eLink Business Innovations 2002-2004 © Interface Decomposition (File Representation) interface CreditCard extends Account { public static final TYPE_NONE = 0; public setName(char name); public setNumber(char number); public setType(int type); } Interface Definition (Noun) } Method Definitions (Verb) Visibility (Public ONLY) Parent Inherited Interface Constant Definitions
  • 37. Java Class eLink Business Innovations 2002-2004 © Class Decomposition (File Representation) class abstract CreditCardImpl extends AccountImpl implements CreditCard { private char name = 0; private char number = 0; private static int amount = 0; Account(){}; public void finalize(){}; static { amount = 100; } public setName(char name) { this.name = name; } public void validate() throws ValidationException { } public abstract setNumber(char number) { this.number = number; } public abstract setType(int type); } } Data Declaration Constructor } Method Body Internal Object Reference (reserved word) Visibility (Encapsulation) Parent Inherited Base Class } Virtual Method Pure Virtual Method Interface Definition Static Initializer Exception Declaration Destructor Like Class Definition (Noun) Method Declaration (Verb)
  • 38. Packages (Namespaces) eLink Business Innovations 2002-2004 © Java Packages Package Properties: Naming - Package naming convention reads from left to right. Usually the internet domain name, then user defined components Default Package - One packages is imported into the class by default. That is javax.lang.* .This package doesn't have to be imported explicitly like other packages. Folders - The package name location has to match the directory structure on the file system so java compiler can find the package. Object Account Savings Customer import java.net.*; import java.io.ByteArrayInputStream; ByteArrayInputStream stream = new ByteArrayInputStream(); Importing Packages Declaring Packages com.unitedbank.atm.Customer package com.unitedbank.atm; class Customer {....} ---------------------------------------- maps to a file system directory com/unitedbank/atm/Customer.java
  • 39. Java Objects eLink Business Innovations 2002-2004 © Java Objects Casting Properties: Allocate - Reserved work "new" to create an instance De-Allocate - Set object to reserved word "null". Tells the garbage collector object is ready to be collected. Object Account Savings Customer // Default Initialization Account account = null; // Instantiate new account object account = new Account(); // Free object - hint to GC account = null;
  • 40. Java Casting eLink Business Innovations 2002-2004 © Java Casting Casting Properties: Strong Types - Collection values are commonly cast in JDK 1.0-1.4, however in JDK 1.5 introduces strong types to the Java language. Template like feature. Object Account Savings Customer Customer customer = new Customer(); Savings savings = new Savings() Account account = null; // Cast Example 1 account = (Account)savings; // Good Cast // Cast Example 2 Vector list = new Vector(); list.add( savings ); account = (Account)list.get(0); // Good Case // Case Example3 - Bad Cast // causes a ClassCastException account = (Account)customer;
  • 41. Java Exceptions eLink Business Innovations 2002-2004 © Java Exceptions Exception Properties: Usage - Exceptions should be used in exceptional conditions but not as flow control flow for an application. Catching an Exception try { // Do work that throws the exception } catch( java.lang.NullPointerException npe ) { // Catch the concrete exception type, // you should not catch a generic Exception } finally { // Optional - good for cleanup code // like database connections, etc } Custom Exceptions (Extending) class MyNewException extends Exception { public String getReason() { return( "code is broken" ); } } Throwing Exceptions class MyClass { public String checkData(String data) throws NullPointerException { if( data == null ) throw new NullPointerException(); } }
  • 42. Java Threads eLink Business Innovations 2002-2004 © Java Threads Exception Properties: Usage - Provide multi-tasking support for java and are easy to implement and use Starvation - A thread that abuses system resource and causes other threads to starve for time to run. Usually a bad loop. Deadlock - Circular dependencies between two threads both end up waiting on each other to complete. Race Condition - Two threads that go after the same resource that are not synchronized. It's random who receives the resource first. Creating a Thread // Create a new Thread Instance Thread myThread = new Thread("Worker Thread", new MyThread() ); // Start the thread myThread.start(); // Dispatch thread to wake up myThread.doSomething(); Declaring a Thread class MyThread implements Runnable { private static boolean terminate = false; private static Object lock = new Object(); public void doSomething() { synchronized(lock) { lock.notify(); } } // Entry point for the thread public void run() { while(!terminate) { synchronized(lock) { lock.wait(); } } } }
  • 43. First Java Program! eLink Business Innovations 2002-2004 ©
  • 46. Project Workspace eLink Business Innovations 2002-2004 ©
  • 50. Running Our Program eLink Business Innovations 2002-2004 ©
  • 52. Testing eLink Business Innovations 2002-2004 © package com.unitedbank.atm.test; import com.unitedbank.atm.service.ServiceImpl; import com.unitedbank.atm.service.CustomerService; import junit.framework.TestCase; /** * */ public class TestCustomerService extends TestCase { public void testGetCustomerAccounts() { CustomerService service = new ServiceImpl(); // fetch from repository service.getAccounts("bob", "password"); } }
  • 53. Test - Executing eLink Business Innovations 2002-2004 ©
  • 54. Questions ? eLink Business Innovations 2002-2004 ©