Ballworld Design
- Fundamental Design Principle: The Separation of the Variant from the Invariant
- What is an abstract ball?What is an abstract ball??
- The abstract ball, ABall
- What methods are invariant?
- An object is defined by its behaviors
- What about fields? Does anyone on the outside care??
- What is the process to update a ball?
- What needs to be done?
- Can the entire process be described in terms of concrete processes or not?
- Bouncing off walls
- The problem of discrete motion -- need to reset position back inside of animation canvas.
- Calculating the reflected position (See homework instructions).
- Design patterns (in approximate order of encounter):
- Concrete ABall implementations (Inheritance-based architecture)
- Animation technique
- "Flipbook" animations -- create motion by diplaying different images at regular time intervals :
- javax.swing.Timer -- creates the "tick" that drives the animation process
- Observer-observable -- Connects the timer tick to each ball via a "dispatching" process
- The rest of the code does not care how the balls are notified, that is, the rest of the code is "decoupled" from the dispatching process.
- ==> This means that the model code should delegate to something else to handle the dispatching process, i.e. delegate to a Dispatcher object to handle the updating of the balls.
- Delegation results from the decoupling of the parts of a system.
- Implementation
Ballworld Topics:
Ballworld Demos:
Recap Overview
The effects of refining the line between variant
and invariant behaviors:
- Inheritance ==> composition-based architecture
- Fixed semantics updating ==> command-based updating
- MVC architecture
- The 4 Pillars of Abstraction: -- A guide to abstract decomposition
- Abstracted Structure
- Polymorphic, inheritance-based structures
- Recursive, composite-based structures
- Abstracted Behavior
- Abstracted Construction
- Abstracted Environment
Techniques for building complex systems:
- Composite patterns for dynamic composing of behaviors
- Factories for abstracted, encapsulated construction
- Communications through closures
- Template pattern processing and utilizing services provided by
superclasses
- Abstract behaviors via strategies and commands
- Event-driven systems
- Prototype pattern
- Extensibility hooks
Misc. skills and topics
- Building GUIs
- Transformations as encapsulated processes
- Dynamic class loading, file loading from disks, etc.
© 2020 by Stephen Wong