Swing Design Patterns Flashcards
What is a design pattern?
- an example of ideal design
- halfway between architecture and code
WHat is the idea of the composite pattern?
allows you to bild recursive trees by composition whose nodes all behave in the same way
What is the suggested approach we building a GUI?
- Create JFrame with construction method
- Create JPanel subclasses each with specific construciton method
What are the 4 main strategies to deal with event handlers?
- Main JFrame handles everything
- Each JPanel handles evetns of own widgets
- Each JButton is its own handler
- Separate handler class
What is the main idea of the Observer pattern?
2 Halves; subject & observer
When event happens to subject, observers are notified
Describe each part of Model-View-Controller architecture
Model; models business domain
View; contains all GUI objects
COntroller; event handlers to synchronise view with model data
What are the 3 parts of the model delegate architecture?
How can it be simplified?
Frame (view)
Listener (Controller)
Application (model)
Can combine frame and listener into one object