Swing Design Patterns Flashcards

1
Q

What is a design pattern?

A
  • an example of ideal design

- halfway between architecture and code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

WHat is the idea of the composite pattern?

A

allows you to bild recursive trees by composition whose nodes all behave in the same way

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the suggested approach we building a GUI?

A
  • Create JFrame with construction method

- Create JPanel subclasses each with specific construciton method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 4 main strategies to deal with event handlers?

A
  • Main JFrame handles everything
  • Each JPanel handles evetns of own widgets
  • Each JButton is its own handler
  • Separate handler class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the main idea of the Observer pattern?

A

2 Halves; subject & observer

When event happens to subject, observers are notified

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe each part of Model-View-Controller architecture

A

Model; models business domain
View; contains all GUI objects
COntroller; event handlers to synchronise view with model data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 3 parts of the model delegate architecture?

How can it be simplified?

A

Frame (view)
Listener (Controller)
Application (model)

Can combine frame and listener into one object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly