| CPSC 329 |
Software Development |
Fall 2026 |
CPSC 329 Review Information — Exam 2
Exam 2 is a written in-class (one hour) exam covering material from
approximately weeks 4-8: object-oriented design principles, UML
class diagrams, design patterns, event-driven programming and GUIs,
and user interface design. (The Observer pattern, architecture, and
MVC will be covered on exam 3.) Expect short answer questions
focusing on foundational knowledge and underlying concepts. Some
questions focus on definitions and recall while others may ask you
to apply that knowledge to a particular scenario — for
example, a short class design, code excerpt, or UML diagram to
evaluate or improve. For the event-driven programming and GUI
material, the focus is on principles, concepts, and patterns rather
than the JavaFX library itself — you will not be asked to
write JavaFX code or to recall specific JavaFX class or method
names.
Answers should be short — generally 1-3 sentences, or 1-2
sentences per part for a question with several parts. A list rather
than complete sentences is fine where appropriate. Time is limited,
so don't write more than necessary!
The topics covered on the exam are listed below. The items under
"Self check" are study goals — examples of the kinds of things
you should be able to do, rather than actual exam questions or a
complete list of what the exam might ask. As a starting point for
studying, try to explain each topic without notes (including an
example of your own where appropriate) and then answer the
associated self check items. Finally, formulate (and then answer) your
own questions about each topic. As a pacing guide, you should be
able to start writing answers for definition/recall questions right
away and "apply to a scenario" questions after a minute or two of
thinking.
Object-Oriented Design
Design principles topics:
- Why good design matters (correct vs. well-designed)
- Cohesion: kinds of cohesion, recognizing low cohesion
- Separation of concerns
- Information hiding and encapsulation
- Mutable vs. immutable classes; object identity
- Passing and returning mutable objects
- Coupling: where coupling occurs, recognizing coupling issues,
achieving loose coupling
- Code to the interface
- Law of Demeter
- Code smells associated with each principle
OOP foundations topics:
- Type hierarchies and "is-a" relationships
- Inheritance: what is inherited, what subclasses can and cannot
change, constructors, protected access
- Polymorphism: declared type vs. actual type
- Abstract classes vs. interfaces
SOLID topics:
- Single Responsibility Principle (SRP)
- Open/Closed Principle (OCP); polymorphic OCP
- Encapsulate what varies
- Liskov Substitution Principle (LSP)
- Favor composition over inheritance
- Interface Segregation Principle (ISP)
- Dependency Inversion Principle (DIP)
- OCP vs. DIP
- Comparing alternative designs
Self check:
- Explain why a program can be correct but still badly designed
and what a well-designed program makes easier.
- Define cohesion and distinguish communicational, procedural,
and logical cohesion.
- Explain separation of concerns and how it differs from
cohesion.
- Explain information hiding and encapsulation, how they differ,
and the advantages of encapsulation.
- Explain when a class should be mutable and when it should be
immutable.
- Explain how object identity relates to the choice of == vs.
equals().
- Explain the risks of passing or returning a mutable object and
describe alternatives.
- Define coupling, explain the advantages of loose coupling, and
explain how coupling and cohesion relate.
- Describe different ways one class can be coupled to another and rank
them from looser to tighter.
- Describe strategies for achieving loose coupling.
- Explain whether good design should aim to eliminate coupling
and why or why not.
- Explain what "code to the interface" means and its benefits.
- State the Law of Demeter, explain the problems violating it causes,
describe how to fix a violation, and describe the
drawbacks of following it too strictly.
- Describe the warning signs and code smells that indicate low
cohesion, information hiding problems, or coupling problems.
- Given a class design, identify a cohesion, information-hiding,
or coupling problem, explain why it is a problem, and describe how
to fix it.
- Explain what a type hierarchy captures and what "is-a" means
for inheritance.
- Describe what a subclass inherits, what it can add or change,
and what it cannot change.
- Explain how polymorphism works — why the code compiles
and what happens at runtime — and why it is useful.
- Explain the criteria for choosing an abstract class vs. an
interface and apply them to a given scenario.
- State each SOLID principle in your own words and explain the
problem it addresses.
- Given a flawed class design, identify which SOLID principle it
violates and describe how to fix it.
- Explain "encapsulate what varies", why it matters, and how it
supports OCP.
- Distinguish the original OCP from
the polymorphic OCP.
- Explain how inheritance can violate LSP and determine whether
a proposed subclass satisfies LSP.
- Distinguish an is-a relationship from a has-a relationship and
identify which a given pair of classes should have.
- Explain the trade-offs between inheritance and composition
and the situations in which each is preferred.
- Explain how DIP supports testability.
- Distinguish OCP from DIP.
- Given a scenario and alternative designs, evaluate the
trade-offs between them in terms of the design principles.
UML Class Diagrams
UML topics:
- Class notation: name, instance variables, methods; collections
- Relationships: association, aggregation, composition,
inheritance, interface realization
- Aggregation vs. composition
Self check:
- Explain the notation for each kind of relationship and what
each one means.
- Explain when to use association vs. aggregation or composition.
- Distinguish aggregation from composition and identify which
applies in a given scenario.
- Given a UML class diagram, describe the design it represents
— which classes know about which others, which inherit from
or implement which, and which hold collections of others.
Design Patterns
Design patterns topics:
- What design patterns are and why we use them
- Variations of behavior: Strategy, State, Template Method
- Factories: the problem factories address; simple factory (including
registry-based), Factory Method, Abstract Factory
- Decorator
- Comparing and combining patterns: Strategy vs. State vs. Template
Method, Decorator vs. Strategy vs. subclassing, Factory and Strategy
together
- Matching a pattern to a situation, including when no pattern
applies
Self check:
- Explain what a design pattern is and what using patterns offers.
- For each pattern, describe its intent and structure.
- Distinguish Strategy, State, and Template Method — how
much of the behavior varies, who chooses the variation, whether it
can change at runtime, and whether composition or inheritance is
used.
- Distinguish primitive operations from hooks in Template Method.
- Explain the problem that factories address.
- Compare simple factory, Factory Method, and Abstract Factory
— what each creates, who decides which variant, and the
mechanism used.
- Explain how a registry-based simple factory supports OCP and
describe its drawbacks.
- Explain the problem Decorator addresses and how it is solved.
- Compare Decorator, Strategy, and subclassing as ways of varying
behavior.
- Explain how Factory and Strategy can be used together.
- Given a scenario, identify which pattern applies (or that none
does) and explain why.
- Given a class design or code excerpt, recognize which pattern
(if any) it uses and identify the role each class plays.
- Explain how each pattern relates to and reflects the core OOP
design principles.
- Evaluate whether a pattern is warranted for a given scenario or
would be over-engineering.
Event-Driven Programming and GUIs
Event-driven programming topics:
- Program-controlled (top-to-bottom) vs. event-driven control flow
- Frameworks vs. libraries; inversion of control
- The event loop: its role; sources of events
- Terminology: source, event object, handler/listener,
registration, dispatcher
- Handlers as callbacks
- Stateless vs. stateful handlers; what a stateful handler must
keep track of
- Handler best practices: what a handler should and shouldn't do
- Event propagation: which element
receives an event; which other elements it reaches; stopping
propagation
- Keyboard focus: where key events are delivered
GUI construction topics:
- The scene graph as a containment hierarchy: stage, scene, and the
tree of nodes
- Choosing controls
- Constraining vs. validating input; validating text input; error
messages
- Labeling buttons; default and cancel buttons
- Disabling vs. hiding: when to use each
- Dialogs: modality and when to use dialogs
- Layout: kinds of layout containers; choosing and nesting
layouts
Self check:
- Contrast program-controlled (top-to-bottom) and event-driven
control flow.
- Distinguish a library from a framework and explain what
"inversion of control" means.
- Explain the role of the event loop and identify the sources
events can come from.
- Define each of the event terminology terms and identify each in
a given scenario or code excerpt.
- Explain what a callback is and how event handlers are
callbacks.
- Distinguish stateless from stateful handlers, identify which a
given interaction needs, and identify what a stateful handler must
keep track of for a given interaction.
- Describe what a handler's job is, identify what doesn't belong in a
handler, and explain the benefits of following these practices.
- Given a scene graph and a user action, identify which element
receives the event, which other elements it reaches and in what
order, and the effect of stopping propagation at a given point.
- Explain keyboard focus and how it determines where key events
are delivered.
- Explain the scene graph as a containment hierarchy, including
the roles of the stage and the scene, and sketch the scene graph
for a given window.
- Given an interaction need, choose an appropriate kind of
control and justify the choice.
- Compare constraining input with validating it and explain which
is preferred and why.
- Describe good practice for validating text input and
evaluate or improve a given error message.
- Explain how buttons should be labeled and evaluate the labels
in a given dialog or window.
- Explain the purpose of default and cancel buttons.
- Explain when to disable a control vs. hide it.
- Explain what a modal dialog is, when dialogs are appropriate,
and the drawbacks of overusing them.
- Describe how each of the common kinds of layout containers
arranges its contents and choose an appropriate one
for a given need.
- Given a sketch of a window, describe how to build it from
nested layout containers.
User Interface Design
UI design topics:
- "You are not the user"; hallway testing
- Visual hierarchy and grouping
- Consistency
- Feedback and visible state
- Handling user errors; confirmations; undo
- Affordances and signifiers
Accessibility topics:
- Who accessibility helps; accessibility as a professional
expectation
- Keyboard access: focus and tab order; mouse-based interactions
- Keyboard shortcuts: mnemonics vs. accelerators
- Screen readers; accessible text
- Color and contrast
- Accessibility of built-in controls vs. custom components
Self check:
- Explain what "you are not the user" means and why it matters.
- Describe how to conduct a hallway test and what it can reveal.
- Describe the guidelines that fall under visual hierarchy and
grouping, consistency, and feedback and visible state.
- Give examples of feedback and of visible state in an interface
and explain what each does for the user.
- Evaluate a given interface in terms of visual hierarchy and
grouping, consistency, and feedback and visible state, identifying
violations and suggesting fixes.
- Describe strategies for handling user errors and evaluate how a
given interface handles errors.
- Explain when an interface should ask for confirmation and the
role of undo.
- Distinguish affordances from signifiers.
- Identify missing or
false signifiers in a given interface.
- Explain who benefits from accessibility and why it is a
professional expectation.
- Explain how tab order works and what makes a
tab order sensible.
- Identify interactions in a given interface that depend on the
mouse and explain how to make them accessible.
- Compare the accessibility support of built-in controls with that
of custom components.
- Distinguish mnemonics from accelerators.
- Describe what a screen reader announces for an element and what
makes good accessible text.
- Explain the contrast guidelines and how to check an interface
against them, and identify other color-related accessibility
problems.
- Given a description or picture of an interface, identify
accessibility problems and suggest fixes.