Introduction to Java
and
Object Oriented Programming
for
Web Applications
Alvin J. Alexander
[Link]
Copyright 2009 Alvin Alexander, [Link].
All Rights Reserved.
1. Day 1: Object-Oriented Software Development
o 1.1 Credits and Other Material
o 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
o 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
o 1.4 UML summary
1.4.1 Standard diagrams
[Link] Use Case diagram
[Link] Class diagram
[Link] Sequence diagram
[Link] Collaboration diagram
[Link] Package diagram
[Link] State diagram
[Link] Activity diagram
[Link] Component diagram
[Link] Deployment diagram
o 1.5 Object Oriented Software Development
1.5.1 Why have a process?
o 1.6 The Rational Unified Process (RUP)
1.6.1 Inception phase
[Link] Objectives
[Link] Activities
[Link] Artifacts
1.6.2 Elaboration
[Link] Purpose
[Link] Objectives
[Link] Activities
[Link] Outcome/Deliverables
[Link] Other artifacts
1.6.3 Construction phase
[Link] Objectives
[Link] Activities
[Link] Deliverables
1.6.4 Transition
[Link] Purpose
[Link] Objectives
[Link] Activities
o 1.7 A sample process
1.7.1 Domain modeling
[Link] What is a class?
[Link] Discover classes
[Link] Build generalization relationships
[Link] Build associations between classes
[Link] Mine legacy documentation for domain classes
[Link] Wrapping up domain modeling
1.7.2 Use case modeling
[Link] Actors
1.7.3 Robustness analysis
[Link] Definitions
[Link] Key roles of robustness analysis
[Link] Closer look at object types
[Link] Performing robustness analysis
1.7.4 Interaction modeling
[Link] Introduction
[Link] Goals of Interaction Modeling
[Link] Sequence Diagrams
[Link] Getting Started
[Link] Putting Methods on Classes
[Link] Completing Interaction Modeling
1.7.5 Collaboration and State Modeling
[Link] Introduction
[Link] Collaboration diagrams
[Link] State diagrams
[Link] Activity diagrams
1.7.6 Addressing Requirements
[Link] Introduction
[Link] Objectives
[Link] What is a Requirement?
[Link] Use Cases and Requirements
[Link] Requirements Traceability
1.7.7 Survey of Design Patterns
[Link] Factory pattern example
o 1.8 Agile Methods
o 1.9 The Agile Alliance
o 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
o 1.11 OO Summary
1.11.1 OO Concepts
1.11.2 UML
2. Day 2: The Java Programming Language
o 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
o 2.2 First Steps with Java
2.2.1 Java Commands and Utilities
2.2.2 A first application
2.2.3 main
o 2.3 Variables, constants, and keywords
2.3.1 Primitive data types
2.3.2 Literals
[Link] boolean literals
[Link] char literals
[Link] Floating-point literals
[Link] String literals
2.3.3 Constants
2.3.4 Reserved keywords
o 2.4 Arrays
o 2.5 Strings
2.5.1 String objects
2.5.2 StringBuffer class
[Link] Exercise
[Link] Exercise
o 2.6 Comments and Javadoc
2.6.1 Types of comments
2.6.2 Javadoc comment tags
[Link] @see
[Link] @param
[Link] @return
[Link] @exception
[Link] @deprecated
[Link] @author
[Link] @version
[Link] @since
2.6.3 A comment example
2.6.4 Notes on Usage
o 2.7 Flow control and loops
2.7.1 Introduction
2.7.2 Objectives
2.7.3 Statements and blocks
[Link] Expressions that can be made into statements
[Link] 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
o 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
[Link] Constructor example
2.8.8 Methods
[Link] Parameter values
[Link] 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
[Link] finalize
2.8.15 The toString() Method
2.8.16 Native Methods
o 2.9 Methods and parameters
2.9.1 Methods
[Link] Invoking a Method
[Link] The this Reference
o 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
[Link] Constructor order dependencies
[Link] Constructor phases
[Link] Constructor phase example
2.10.7 Overriding methods, hiding fields, and nested classes
[Link] Overriding
[Link] The super keyword
2.10.8 Marking methods and classes final
2.10.9 The object class
[Link] Object's utility methods
2.10.10 Anonymous classes
2.10.11 Abstract Classes and methods
2.10.12 Cloning objects
[Link] Three major considerations in writing a clone
method
[Link] 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
[Link] Bad effects of public fields
[Link] Non-final classes have two interfaces
o 2.11 Interfaces
2.11.1 Introduction
2.11.2 Objectives
2.11.3 An example interface
[Link] Nested classes and interfaces
2.11.4 Single inheritance versus multiple inheritance
2.11.5 Extending Interfaces
[Link] 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
[Link] Two Important Differences Between Interfaces and
Abstract Classes
[Link] Interface or Abstract Class
o 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
[Link] Choices when invoking a method that has a throws
clause
2.12.6 try, catch, and finally
[Link] finally
2.12.7 When to use exceptions
o 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
o 3.1 Objectives
o 3.2 IO: Streams and readers
o 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
o 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
o 3.5 JavaBeans
o 3.6 Remote Method Invocation (RMI)
o 3.7 Java Native Interface (JNI)
o 3.8 Collections framework
3.8.1 Lists
3.8.2 Maps
3.8.3 Collection Utilities
o 3.9 Internationalization, localization, and formatting
o 3.10 HTTP protocol
3.10.1 Request and Response
3.10.2 Cookies
o 3.11 Servlets and JSPs
3.11.1 Objectives
3.11.2 Introduction/Background
o 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
o 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
[Link] page directive
[Link] taglib directive
[Link] include directive
3.13.8 Implicit objects
3.13.9 Exception handling
o 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
o 4.1 Databases and JDBC
4.1.1 Getting things set up
4.1.2 Connecting to the database
[Link] Load the driver
[Link] Create the connection
4.1.3 Statements
4.1.4 getXXX methods
4.1.5 Updating the database
4.1.6 PreparedStatements
4.1.7 A real method
o 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
[Link] Definitions of unit testing
4.2.6 Goals of unit testing?
4.2.7 Unit Testing with JUnit
[Link] How to create unit tests with JUnit
4.2.8 A sample JUnit session
4.2.9 Recap
o 4.3 Best practices
o 4.4 Refactoring
o 4.5 Final project
Bibliography
[Link]