Introduction to Java
and
Object Oriented Programming
for
Web Applications
Alvin J. Alexander
devdaily.com
Copyright 2009 Alvin Alexander, devdaily.com.
All Rights Reserved.
1. Day 1: Object-Oriented Software Development
1.1 Credits and Other Material
1.2 Why OO?
1.2.1 Benefits of object-oriented programming
1.2.2 Symptoms of software development problems
1.2.3 Root causes of project failure
1.2.4 Software development best practices
1.3 Introduction to OO concepts
1.3.1 Encapsulation
1.3.2 Inheritance
1.3.3 Polymorphism
1.3.4 Abstraction with objects
1.3.5 Message passing
1.4 UML summary
1.4.1 Standard diagrams
1.4.1.1 Use Case diagram
1.4.1.2 Class diagram
1.4.1.3 Sequence diagram
1.4.1.4 Collaboration diagram
1.4.1.5 Package diagram
1.4.1.6 State diagram
1.4.1.7 Activity diagram
1.4.1.8 Component diagram
1.4.1.9 Deployment diagram
1.5 Object Oriented Software Development
1.5.1 Why have a process?
1.6 The Rational Unified Process (RUP)
1.6.1 Inception phase
1.6.1.1 Objectives
1.6.1.2 Activities
1.6.1.3 Artifacts
1.6.2 Elaboration
1.6.2.1 Purpose
1.6.2.2 Objectives
1.6.2.3 Activities
1.6.2.4 Outcome/Deliverables
1.6.2.5 Other artifacts
1.6.3 Construction phase
1.6.3.1 Objectives
1.6.3.2 Activities
1.6.3.3 Deliverables
1.6.4 Transition
1.6.4.1 Purpose
1.6.4.2 Objectives
1.6.4.3 Activities
1.7 A sample process
1.7.1 Domain modeling
1.7.1.1 What is a class?
1.7.1.2 Discover classes
1.7.1.3 Build generalization relationships
1.7.1.4 Build associations between classes
1.7.1.5 Mine legacy documentation for domain classes
1.7.1.6 Wrapping up domain modeling
1.7.2 Use case modeling
1.7.2.1 Actors
1.7.3 Robustness analysis
1.7.3.1 Definitions
1.7.3.2 Key roles of robustness analysis
1.7.3.3 Closer look at object types
1.7.3.4 Performing robustness analysis
1.7.4 Interaction modeling
1.7.4.1 Introduction
1.7.4.2 Goals of Interaction Modeling
1.7.4.3 Sequence Diagrams
1.7.4.4 Getting Started
1.7.4.5 Putting Methods on Classes
1.7.4.6 Completing Interaction Modeling
1.7.5 Collaboration and State Modeling
1.7.5.1 Introduction
1.7.5.2 Collaboration diagrams
1.7.5.3 State diagrams
1.7.5.4 Activity diagrams
1.7.6 Addressing Requirements
1.7.6.1 Introduction
1.7.6.2 Objectives
1.7.6.3 What is a Requirement?
1.7.6.4 Use Cases and Requirements
1.7.6.5 Requirements Traceability
1.7.7 Survey of Design Patterns
1.7.7.1 Factory pattern example
1.8 Agile Methods
1.9 The Agile Alliance
1.10 Introduction to Extreme Programming
1.10.1 Risk: The Basic Problem
1.10.2 Four Variables
1.10.3 The Cost of Change
1.10.4 Four Values
1.10.5 Basic Principles
1.10.6 Back to Basics
1.10.7 The Solution
1.11 OO Summary
1.11.1 OO Concepts
1.11.2 UML
2. Day 2: The Java Programming Language
2.1 Introduction
2.1.1 Chapter objectives
2.1.2 Java design goals
2.1.3 What is Java?
2.1.4 How/where to get Java
2.2 First Steps with Java
2.2.1 Java Commands and Utilities
2.2.2 A first application
2.2.3 main
2.3 Variables, constants, and keywords
2.3.1 Primitive data types
2.3.2 Literals
2.3.2.1
boolean
literals
2.3.2.2
char
literals
2.3.2.3
Floating-point
literals
2.3.2.4
String
literals
2.3.3 Constants
2.3.4 Reserved keywords
2.4 Arrays
2.5 Strings
2.5.1 String objects
2.5.2
StringBuffer
class
2.5.2.1 Exercise
2.5.2.2 Exercise
2.6 Comments and Javadoc
2.6.1 Types of comments
2.6.2 Javadoc comment tags
2.6.2.1 @see
2.6.2.2 @param
2.6.2.3 @return
2.6.2.4 @exception
2.6.2.5 @deprecated
2.6.2.6 @author
2.6.2.7 @version
2.6.2.8 @since
2.6.3 A comment example
2.6.4 Notes on Usage
2.7 Flow control and loops
2.7.1 Introduction
2.7.2 Objectives
2.7.3 Statements and blocks
2.7.3.1 Expressions that can be made into statements
2.7.3.2 Declaration statements
2.7.4 if-else
2.7.5 switch
2.7.6 while and do-while
2.7.7 for
2.7.8 Labels
2.7.9 break
2.7.10 continue
2.7.11 return
2.7.12 No
goto
Statement
2.8 Classes and objects
2.8.1 Introduction
2.8.2 Objectives
2.8.3 A Simple Class
2.8.4 Fields
2.8.5 Access Control and Inheritance
2.8.6 Creating Objects
2.8.7 Constructors
2.8.7.1 Constructor example
2.8.8 Methods
2.8.8.1 Parameter values
2.8.8.2 Using methods to control access
2.8.9 this
2.8.10 Overloading methods
2.8.11 Overriding methods
2.8.12 Static members
2.8.13 Initialization Blocks
2.8.14 Garbage collection and finalize
2.8.14.1 finalize
2.8.15 The
toString()
Method
2.8.16 Native Methods
2.9 Methods and parameters
2.9.1 Methods
2.9.1.1 Invoking a Method
2.9.1.2 The this Reference
2.10 Extending Classes
2.10.1 Introduction
2.10.2 Objectives
2.10.3 An extended class
2.10.4 A simple example
2.10.5 What protected really means
2.10.6 Constructors in extended classes
2.10.6.1 Constructor order dependencies
2.10.6.2 Constructor phases
2.10.6.3 Constructor phase example
2.10.7 Overriding methods, hiding fields, and nested classes
2.10.7.1 Overriding
2.10.7.2 The
super
keyword
2.10.8 Marking methods and classes
final
2.10.9 The
object
class
2.10.9.1 Object's utility methods
2.10.10 Anonymous classes
2.10.11 Abstract Classes and methods
2.10.12 Cloning objects
2.10.12.1 Three major considerations in writing a clone method
2.10.12.2 Four different attitudes a class can have towards clone
2.10.13 Extending classes: how and when
2.10.14 Designing a class to be extended
2.10.14.1 Bad effects of public fields
2.10.14.2 Non-final classes have two interfaces
2.11 Interfaces
2.11.1 Introduction
2.11.2 Objectives
2.11.3 An example interface
2.11.3.1 Nested classes and interfaces
2.11.4 Single inheritance versus multiple inheritance
2.11.5 Extending Interfaces
2.11.5.1 Name Conflicts
2.11.6 Implementing Interfaces
2.11.7 Using an Implementation
2.11.8 Marker Interfaces
2.11.9 When to Use Interfaces
2.11.9.1 Two Important Differences Between Interfaces and Abstract Classes
2.11.9.2 Interface or Abstract Class
2.12 Exceptions
2.12.1 Introduction
2.12.2 Objectives
2.12.3 Creating exception types
2.12.4 throw
2.12.5 The throws clause
2.12.5.1 Choices when invoking a method that has a throws clause
2.12.6 try, catch, and finally
2.12.6.1 finally
2.12.7 When to use exceptions
2.13 Packages
2.13.1 Introduction
2.13.2 Package Naming
2.13.3 Package Access
2.13.4 Package Contents
2.13.5 Examples
3. Day 3: Standard Libraries & Server-side Programming
3.1 Objectives
3.2 IO: Streams and readers
3.3 Java networking
3.3.1 Introduction
3.3.2 Socket
3.3.3 ServerSocket
3.3.4 ServerSocket lifecycle
3.3.5 URL
3.3.6 URLConnection
3.4 Threads
3.4.1 Objectives
3.4.2 Applications without multiple threads
3.4.3 Thread states
3.4.4 Creating a threaded class with
thread
3.4.5 Creating a threaded class with the
runnable
interface
3.4.6 Thread methods
3.4.7 Thread references
3.5 JavaBeans
3.6 Remote Method Invocation (RMI)
3.7 Java Native Interface (JNI)
3.8 Collections framework
3.8.1 Lists
3.8.2 Maps
3.8.3 Collection Utilities
3.9 Internationalization, localization, and formatting
3.10 HTTP protocol
3.10.1 Request and Response
3.10.2 Cookies
3.11 Servlets and JSPs
3.11.1 Objectives
3.11.2 Introduction/Background
3.12 Servlets
3.12.1 Objectives
3.12.2 Servlet basics
3.12.3 HelloWorldServlet
3.12.4 Servlet lifecycle
3.12.5
HTTPServlet
3.12.6
HTTPServletRequest
3.12.7
HTTPServletResponse
3.13 JavaServer Pages
3.13.1 What is a JSP?
3.13.2 JSP engine/container:
3.13.3 Translation time and request time
3.13.4 Scriptlets
3.13.5 Expressions
3.13.6 Declarations
3.13.7 Directives
3.13.7.1
page
directive
3.13.7.2
taglib
directive
3.13.7.3
include
directive
3.13.8 Implicit objects
3.13.9 Exception handling
3.14 Survey of other server-side Java technologies
3.14.1 XML
3.14.2 XSLT
3.14.3 Enterprise Java Beans
3.14.4 Java Messaging Service
4. Day 4: Databases, Best Practices, and Final Project
4.1 Databases and JDBC
4.1.1 Getting things set up
4.1.2 Connecting to the database
4.1.2.1 Load the driver
4.1.2.2 Create the connection
4.1.3 Statements
4.1.4
getXXX
methods
4.1.5 Updating the database
4.1.6
PreparedStatement
s
4.1.7 A real method
4.2 JUnit
4.2.1 Is Testing Important?
4.2.2 Mars Orbiter
4.2.3 USS Yorktown
4.2.4 Types of tests
4.2.5 Unit Testing 101
4.2.5.1 Definitions of unit testing
4.2.6 Goals of unit testing?
4.2.7 Unit Testing with JUnit
4.2.7.1 How to create unit tests with JUnit
4.2.8 A sample JUnit session
4.2.9 Recap
4.3 Best practices
4.4 Refactoring
4.5 Final project
Bibliography