Week 5: Frameworks and Pattern Introduction Flashcards

Learning about Frameworks and design patterns through JHotDraw.

1
Q

What is a framework?

A

A reusable skeleton of an application that can be customised and used by a developer to be the backbone for different applications.

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

What are the two types of Frameworks?

A

Black box and White box.

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

What is a black box framework?

A

A framework where it is parameterised and the application using it has little to no interaction with the actual framework source code.

These are designed with end users in mind.

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

What is a white box framework?

A

A framework that is reusable as the design of all or part of a system that is represented as a set of abstract classes and the way their instance interact.

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

What is a white box framework?

A

A framework that is reusable as the design of all or part of a system that is represented as a set of abstract classes and the way their instance interact.

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

What is the JHotDraw framework?

A

A framework for creating ‘semantic’ drawing editors. It provides tools for creating shapes, drawings, constrained connections between objects on screen and limited animation

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

What is the typical kind of program that might use the JHotDraw framework?

A

A UML diagram creation program.

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

What kind of architecture design does JHotDraw follow?

A

Model View Controller (MVC)

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

Explain the class that represents the Model in JHotDraw.

A
The drawing class
It's a container for the figure models. It listens for any figure changes on the View and updates the data. This is done via the observer design pattern.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain the class that represents the View in JHotDraw.

A

The DrawingView class.

It is responsible for creating and displaying the GUI. It makes use of the observer design pattern.

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

Explain the class that represents the Controller in JHotDraw.

A

The DrawingEditor class.
New applications that want to use JHotDraw should extend this controller. It is the backbone of JHD, including all its core functionality. It makes use of the factory method design pattern.

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

Explain the Figure class in JHotDraw.

A

It is a key class/interface of the framework. Every model that can be manipulated and drawn within JHD inherits from Figure, whether directly or indirectly.
Figures can be drawn/manipulated within the rectualer DisplayBox in the View.

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

Name and explain three things in JHotDraw that are associated with and can manipulate figures.

A
  1. Handles - can be used to effect the properties of figures e.g. Stretch, move, resize etc.
  2. Connectors - used to join figures together by their connection points (Connection points are points on figures that can be used to connect to other figures via a line or arrow etc.)
  3. Locators - used to locate points on a figure to position the handles (e.g. North East corner point)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What design pattern do both connectors and locators use?

A

Strategy design pattern.

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

What is the Painter in JHotDraw?

A

An algorithm used for drawing on screen.

It uses the strategy design pattern.

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

What are the Tools in JHotDraw?

A

It’s a panel that goes down the left hand side. It shows all the tools that can be used in the application. New applications can create their own tools for JHotDraw. Creating new tools uses the prototype design pattern.

17
Q

What design pattern is used when switching between tools in JHotDraw?

A

The state design pattern.

18
Q

Explain the Command in terms of JHotDraw.

A

It is used to encapsulate an action to be executed. It uses the command design pattern.

19
Q

Explain what PointConstrainer does in JHotDraw.

A

It is used to contrain points in the application view, like snapping figures to a grid layout.

20
Q

What is LineConnection in JHotDraw?

A

The on screen visual connection between figures. Normally resented by a line. It implements ConnectionFigure and is classed as a figure model itself. It uses the observer design pattern to listen for changes in the figures it is connected to.

21
Q

What makes Frameworks so flexible and reusable?

A

The use of Interfaces and Abstract classes.

22
Q

What is an interface?

A

A type that cannot ever be created as an instanced object. It has a name and a set of methods, which an not implemented. The can provide the backbone for classes that implement said interface.

23
Q

Name a couple fo interfaces used in JHotDraw.

A
Drawing
Figure
Connector
Handle
DrawingView
Painter
Etc.
24
Q

TRUE or FALSE: A class can implement many interfaces at once.

A

True

25
Q

TRUE or FALSE: A class can only extend one other class?

A

True

26
Q

TRUE or FALSE: A class can only extend one other class?

A

True

27
Q

What are abstract classes?

A
A class that has implemented/coded methods and variables, yet it still cannot be created as an instance variable.
Nornally used to be a superclass of many similar subclasses to provide shared functionality, or to flesh out interfaces by giving some concrete functionality.
28
Q

What is an abstract method?

A

A method that can be created in an abstract class that has no implementation in that class. Similar to methods in interfaces.

They are created using the method tag abstract, for example:

public abstract void MethodName(Parameters);

29
Q

What abstract class directly implements figure?

A

AttributeFigure.

30
Q

What is a design pattern?

A

A named pattern that that can provide the template to create a solution for a recurring problem within a certain context.
They may need to be adapted to solve different problems.

31
Q

Why are design patterns good?

A

Reuse - Their solution can be reused in many solutions.
Design communication - Provides a way to communicate about the architecture of software, makes it more standardised and descriptive.

32
Q

Where did design patterns come from?

A

Originated in building architecture with a man named Christopher Alexander. He noticed common patterns in the architecture of buildings that solved problems. He wrote a book on this describing these patterns, designs and practices. It was then later adapted for computing architecture.

33
Q

What was the first design pattern computing publication?

A

Design Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides.

34
Q

What are the 3 main classifications for design patterns?

A

Creatiobal
Structural
Behavioural

35
Q

How are deidgn patterns described? What properties and fields?

A
BASE INFO
Pattern name
Pattern classification
Intent - The problem addressed
Motivation - example 
Applicability - situations used/poor designs

DETAILS OF THE PATTERNS
Structure
Participants
Collaborations

Consequences - trade offs of pattern
Implementation - how to implement
Sample code - shows for only a particular instance/problem
Known uses
Realted patterns
36
Q

Name some patterns in the creational classification.

A

Factory Method

Prototype

37
Q

Name some patterns in the structural classification.

A

Adapter

Composite

38
Q

Name some patterns in the behavioural classification.

A

Template Method
Observer
State
Strategy