Object Oriented Programming (DIEF, UNIMORE)

This is an intermediate programming course about the Object Oriented methodology and Java. We recommend this course to learners who have previous experience in software development or a background in computer science. At the end of this course, learners will be empowered to create a real-world Java program. In achieving this goal, students will learn the fundamentals of Object Oriented Programming, how to leverage the power of existing libraries, how to build graphical user interfaces, how to use some core algorithms for searching and sorting data and how to read and write data both locally and from the network.

How to use it

The whole material, comprising slides and code examples, can be downloaded using git:

Both slides and code examples might be updated or bug-fixed during the course. At any time, for downloading the latest version, go the course material directory (on your pc) and use:

  • $ git pull

Code examples can be directly imported and run in Eclipse with:

  • File -> Import -> General -> Existing Projects into Workspace

Java Modules

[M1] From C to Java

  • The software crisis
  • Classes, objects and code modularization
  • Encapsulation, Inheritance, Polymorphism

[M2] OOP Basics

  • The Java environment
  • Primitive types
  • Control statements
  • Scope, Visibility, Overloading
  • Classes and Packages
  • Methods and attributes
  • Getters and Setters
  • Constructors

[M3] OOP Inheritance

  • Overriding
  • Polymorphism
  • Upcasting and Downcasting
  • Abstract Classes and Interfaces

[M4] The Collections Framework

  • Iterable, Collection (Set, Queue, List) and Map interfaces
  • HashSet, PriorityQueue, ArrayList, LinkedList, HashMap classes
  • Iterators (definition and use)
  • Sorting (Comparable Interface and Collections static methods)

[M5] Java Generics

  • Array Sub-typing
  • Object Sub-typing
  • Collection Sub-typing
  • Bounded Wildcards Types
  • Code Erasure

[M6] Exceptions

  • Motivations and basic concepts
  • Catching Exceptions (try/catch/finally)
  • Throwing Exceptions (throw)
  • Complete and partial delegation (throws)
  • Exceptions (checked and unchecked) and Errors

[M7] Swing Framework

  • Graphical event-based programming
  • Containers and Components
  • Layout managers
  • Event delegation model

[M8] Java Database Access (JDBC)

  • Database connection architecture
  • Connection, Statement and Resultset classes
  • Scrollable, Updateable Resultsets
  • Accessing Metadata

[M9] Remote Data Access (REST)

  • Motivations and basic concepts
  • Resources, Representations, Operations
  • GET/POST requests

[M10] Java I/O Framework

  • Stream concept
  • Reader/Writer interfaces and their implementations
  • InputStream/OutputStream interfaces and their implementations
  • Serialization (Deep/Shallow)
  • Tokenizers (Scanner/StringTokeniser classes)
  • Filesystem manipulation (File/Files classes)
  • Random Access Files

[M11] Threads

  • Motivations and basic concepts
  • Thread states
  • Creating, running and stopping threads
  • Basic synchronisation (synchronised/sleep/yield/join)

[M12] Threads Synchronisation

  • Race conditions
  • Deadlock, Livelock, Starvation
  • Advanced synchronisation (wait/notify)

Course Rules

The final exam of this course is a discussion about a project to be developed at home. It is worth noticing that the project is not supposed to be developed without supervision, but mostly during the course. The whole development process and related discussions with Prof. Bicocchi will be evaluated. The general idea of the project must be defined before mid-term.

At the final discussion, it is expected:

  • to pass an oral examination about OOP and the Java language (short written exercises might be used, see topics above)

  • to successfully discuss about the structure, the internals and engineering choices of the project

Course Books

In the following there is list of good books to be used during the development, ordered by difficulty. At the end of the course students are expected to understand and use concepts of intermediate level. Advanced level is only for students with a remarkable programming background.

  • Programmazione a oggetti in Java; Giacomo Cabri, Franco Zambonelli (beginner)

  • Thinking in Java; Bruce Eckel (intermediate)

  • Effective Java; Joshua Bloch (advanced)

  • Design Patterns; Eric and Elisabeth Freeman (advanced)

Web Resources