Skip to content

btj/ogp-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object-Oriented Programming

Single-object abstractions

  • First steps in modular programming Part 1 Part 2
    • Example: squareroot
    • Example: max3
    • Example: timeofday
    • Concepts: Using Eclipse, creating JUnit test cases, creating classes, instance methods, encapsulation, private versus public, using Git, constructors, unit testing basics and best practices
  • Managing complexity through modularity and abstraction
    • Concepts: modularity, abstraction, API, client module, importance of documentation, information hiding, procedural abstraction, data abstraction, immutable versus mutable abstractions, abstract value/state of an object, Java's built-in datatypes and operators
  • Representation objects and representation exposure
    • Concepts: representation object, representation exposure
  • How to properly document single-object abstractions
    • Concepts: defensive programming, contractual programming, preconditions, postconditions, class representation invariants (= private class invariants), class abstract state invariants (= public class invariants), getters, mutators

Inheritance

  • Polymorphism
    • Concepts: abstract classes, polymorphism, subclassing, inheritance, instanceof, the static type checker, static/dynamic type of a variable or an expression, typecasts, pattern matching; class Object, autoboxing and -unboxing
  • Dynamic binding
    • Concepts: dynamic binding, abstract methods, method overriding, @Override; methods equals, hashCode, toString, getClass; record classes
  • Behavioral subtyping: modular reasoning about programs that use dynamic binding
    • Example: intlist_inheritance
    • Concepts: Non-modular reasoning, modular reasoning, method specifications, correctness of methods; method call resolution, resolved method vs called method, static versus dynamic method call binding; strenghtening of specifications, behavioral types, behavioral subtyping
  • Interfaces
    • Concepts: interfaces, multiple inheritance, static fields, the Singleton pattern
  • Implementation inheritance
    • Concepts: Inheritance of fields and methods, super constructor calls, super method calls
  • Closed types
    • Concepts: types with a closed set of instances, enum classes, types with a closed set of direct subtypes, sealed types, switch statements and expressions
  • Lists, sets, and maps
    • Concepts: the List, Set, and Map abstract datatypes (ADTs); the ArrayList, LinkedList, HashSet, and HashMap data structures; the Java Collections Framework

Multi-object abstractions (= entity-relationship abstractions)

Advanced topics

(Students of course H02C5A can ignore this material.)

  • Iterators
    • Concepts: (external) iterators, iterables, nested classes, inner classes, local classes, anonymous classes, enhanced for loop, internal iterators, lambda expressions, capturing outer variables, effectively final variables
  • Streams (on the web)
    • Concepts: streams, sources, map, filter, reduce, collect, parallel streams
  • Generics
    • Concepts: generic class, generic interface, type parameter, type argument, generic type instantiation, parameterized type, bounded type parameter, covariance, contravariance, invariance, upper-bounded wildcard, lower-bounded wildcard, generic method, erasure, unchecked cast warning