This course [Java 面向对象程序设计] enables a student with little previous knowledge about programming to write programs in a productive environment using the Java programming language. This involves developing two sets of skills: A programmer must understand the programming language itself, its underlying paradigms, its utilities, syntax, and how to translate the specification of a task into program code. Since software is often developed in a team, a programmer also needs to know the basic tools predominantly used in the ecosystem centered around the programming language. She must not only know how to structure her code for maximum reuse and minimum maintenance requirements, but also how to use and create libraries, as well as how debug and document code. Our course tries to address both requirements in an integrated fashion.

This course has been designed by Prof. Weise from scratch. It does not just try to teach programming in a practical way, using many fully functional examples. It also introduces the tools that are needed to become an effective software engineer (and which usually are entirely ignored in academic courses) at didactically suitable points.

Prerequisites: None

Goals:

  1. Attain basic programming skills, including
    1. assignments, expressions, conditionals, loops, functions
    2. object-oriented programming, class hierarchies, inheritance, interfaces, encapsulation
    3. exception handling
    4. basic Java utilities such as collections and streams
  2. Learn how to use the most important tools for productive software development, including
    1. using an IDE (Eclipse)
    2. using a debugger
    3. documentation with Javadoc
    4. creating and using libraries (JAR)
    5. unit testing using JUnit
    6. build processes using Maven

Teacher: Prof. Dr. Thomas Weise

Course Material

As course material, a comprehensive set of slides and examples is provided. Each course unit targets one closed topic, only building on previously introduced topics, and provides a wide set of examples. Each example is a complete compile- and executable Java program. Each example is focused on exactly one phenomenon.

A tar.xz archive with all the teaching material (slides, examples, homework) of this course can be found here.

  1. Introduction
  2. Java
  3. Eclipse
  4. Types, Variables, and Assignments
  5. Operators and Expressions
  6. Console I/O
  7. Conditionals (if-then-else, switch-case)
  8. Loops (for, while, do)
  9. Arrays
  10. static Methods
  11. Command-Line Arguments
  12. static Variables
  13. Debugging
  14. Objects, Instance Variables, and new
  15. Instance Methods
  16. Inheritance and Overriding
  17. Packages and import
  18. Visibility, Encapsulation, final, and Inner Classes
  19. Documentation with Javadoc
  20. Type Casts
  21. Generics
  22. Collections, equals, and hashCode
  23. abstract Classes
  24. Interfaces
  25. Exceptions
  26. Libraries and Executables
  27. Testing with JUnit
  28. I/O and Streams
  29. Autoboxing
  30. Building with Maven

Practical Homework

The homework in this class is always a mixture of practical lab tasks combined with questions about the understanding of the topics. The homework follows two goals: On one hand, we want to build the basic ability to create computer programs with Java. On the other hand, we also want to sensitize the students for phenomena, border cases, and common errors in the corresponding topic. Training the ability to discover and fix errors will automatically train the abilities to solve problems and to write clean code.

  1. Homework 1: Expressions
  2. Homework 2: Arrays, I/O, and Loops
  3. Homework 3: Classes and Objects
  4. Homework 4: Documentation (with JavaDoc)
  5. Homework 5: Maven, Libraries, and JUnit