Object-oriented programming with Java

Lecture handouts with code samples

Concepts of Object-oriented programming and Java basics

  1. Course overview. Concepts of abstraction and encapsulation. PDF.
  2. Live and death of a software object. Reference variables. Lost references and garbage collector. Properties and methods. Class and instance. Creating an instance of an existing class in Java. Client programming. PDF. Code Example
  3. Defining your own class of objects. Adding properties. Coding methods. Concepts of composition and association. First UML diagrams. PDF.
  4. Practice: Designing objects and tests. Compiling and running Java programs. Java packages. Console input and output. Java primitives and wrappers. Static fields and methods.Arrays of Strings. Planning our first program: Route Finder. PDF
  5. Object fields: initialization. Method parameters and return values. Method overloading. PDF
  6. Java operators. Flow control. Loops. String concatenation. Casting and promotion. PDF
  7. Class hierarchies. Inheritance. (Chapters 9, 10). PDF
  8. Practice:JUnit introduction. Designing Battleship game. PDF. Subtraction game code. Simple Battleship game code
  9. Abstract classes and methods. Polymorphism. Upcasting and downcasting. Interfaces. Multiple inheritance with interfaces. Single-rooted class hierarchy. Java Object class. PDF
  10. Design principles of object-oriented applications. PDF
  11. Software design patterns: Strategy design pattern. PDF
  12. Practice: Object-Oriented system design. Guitar store case study. PDF

Using libraries: client programming

  1. Java collections: lists. Strategy design pattern and sorting in Java. PDF
  2. Java collection framework: Lists and Sets. PDF. Code
  3. Java Strings: immutable objects. PDF
  4. Hash maps and hash code. PDF. Code
  5. Creating generic classes and methods in Java. PDF. Code
  6. Java GUI. Part 1: drawing and animation. Practice: Designing library of smart shapes. PDF. Code
  7. Java GUI. Part II: Swing. Component layouts. Event-driven programming. Event handlers. (Chapter 17). PDF. GUI Examples Code. Start and stop animation example
  8. Exception handling in Java. (Chapter 15). PDF
  9. Java I/O. Part I. Files and streams (Chapter 16). PDF. Code
  10. Java I/O. Part II. Object serialization. PDF

Object-oriented system design

  1. Modeling with objects. Part I. Structural (static) models. PDF
  2. Modeling with objects. Part II. Dynamic models. PDF
  3. Separation of concerns. The Model-View-Controller pattern (Chapter 18). PDF. Code
  4. Leftovers: Javadoc. Programming by contract. Java WEB start. PDF