slanted W3C logo

Day 36 — The Concepts

Highlighting the main concepts from each chapter of the textbook.

Chapter 1

A type defines what values a variable can take and the operations that can be performed with the variable.

Chapter 2: Delegation

Delegate.

In Java, you can delegate to a class by using static methods and attributes.

In Java, you can delegate to an object by invoking methods on the object.

Every method has a contract that specifies the preconditions and postconditions of a method invocation.

Chapter 3: Using APIs

The compiler determines if a method can be invoked on an object by using early binding.

Chapter 4: Objects

An object has state (its attributes).

An object has an identity (its location in memory).

An object has behaviour (its methods).

Objects (and classes) can be represented using a memory diagram.

Chapter 5: Control Flow

A loop invariant is a condition that is always true at the bottom of the loop (after the last line of code in the loop body).

Chapter 6: Strings

Strings are objects that masquerade as primitives in certain ways.

Strings are immutable.

Strings can be compared (implement Comparable).

Strings can be matched using patterns called regular expressions.

Chapter 7: Software Engineering

Waterfall and iterative development.

Testing.

A UML class diagram describes the structure of a software system by showing the classes used in the system, details of the classes (their attributes and methods), and the relationships between the classes.

Chapter 8: Aggregation

Aggregation means has-a.

Composition is aggregation with shared lifetime.

Aliasing, shallow copying, and deep copying.

Computational complexity.

Chapter 9: Inheritance

Inheritance means is-a, or is-substitutable-for.

Child classes can specialize behaviour by overriding methods inherited from the parent class.

Java uses late binding to resolve which method to invoke (the parent version or the child version) at runtime.

Chapter 10: Collections

Collections and maps are interfaces.

Lists are useful when you have a collection that you want to treat as a (numbered) sequence.

Sets are useful when you want only unique elements.

Maps are useful when you want to access elements using a key.

An iterator is an object that supports traversal through a collection.

Chapter 11: Exceptions

An exception is an object that represents an exceptional event.

An exception object is thrown when an exceptional event occurs.

Exception objects can be caught by an exceptional handler.

Exceptions are implemented as an inheritance hierarchy.