Lecture 11 Flashcards

1
Q

When talking about software architecture, what are we talking about?

A

Non-functional requirements

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

What 2 choices do you have when talking about the your architecture diagram?

A
  1. facilitating a discussion about the system design
  2. documenting (precisely) an architecture
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain the different layers in layered architecture: pic

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

Architectural design is a creative process, some other connected concepts are:

A

Architectural styles: high-level abstractions, guiding the overall organisation of a system
(client/server, pipes and filters)

Architectural patterns: detailed solutions to recurring architectural problems within a specific style.
(model-view-controller)

Design patterns: specific solutions to recurring design problems at a lower level than architectural patterns
(adapter, compososite)

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

What are pipes and filters architecture?

A
  • Functional transformations process inputs to produce outputs.
  • Variants of this approach are very common.
  • Not really suitable for interactive systems.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is layered architecture?

A

Models the interface of sub-systems

Organises the system into a set of layers, each provide a set of services

If a layer is changes, only the adjacent layer is affected

It can be artifical to structure systems in this way

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

Pipes and filters architecture, describe each of these:
Description, example, when used, advantages, disadvantages

A

Description: The data flows (as in a pipe) from one component to another for processing. The processing of the data in a system is organized so that each processing component (filter) is discrete and carries out one type of data transformation.
Example: Pic
When used: Commonly used in data processing applications.
Advantages: Easy to understand and supports transformation reuse. Workflow style
matches the structure of many business processes.
Disadvantages: The format for data transfer has to be agreed upon between
communicating transformations. Each transformation must parse its
input and unparse its output to the agreed form.

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

Layered architecture, describe each of these:
Description, example, when used, advantages, disadvantages

A

Description: It sorts the system into layers, where each layer handles specific tasks and helps the one above it. The bottom layers offer essential services used across the whole system.

Example: A layered model of a system for sharing copyright documents held in different libraries

When used: Adding new features to existing systems, when multiple teams handle different parts of the project and there’s a need for strong security at various levels.

Advantages: Swapping out whole layers while keeping the interface intact. Allows for redundant features like authentication in each layer, boosting the system’s reliability.

Disadvantages: Cleanly separating layers can be tough. Sometimes, a higher layer must directly engage with lower layers instead of the immediate one below it. Impacts performance due to multiple interpretations of service requests across the layers.

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

MVC (Model-View-Controller), describe each of these:
Description, example, when used, advantages, disadvantages

A

Description: Separates presentation and interaction from the system data. The system is
structured into three logical components that interact with each other.
Example: Her
When used: Used when there are multiple ways to view and interact with data. Also used
when the future requirements for interaction and presentation of data are
unknown.
Advantages: Allows the data to change independently of its representation and vice versa. Supports presentation of the same data in different ways with changes made in one representation shown in all of them.
Disadvantages: Can involve additional code and code complexity when the data model andinteractions are simple.

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

Try to give an overview of Model-View-Controller

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

What are the purpose of the design pattern: Composite?

A
  • Compose objects in recursive tree structures to represent whole/part hierarchies
  • Allow clients to treat both complex as well as single/simple objects in the same uniform way
  • It is a nice pattern
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is MVC (model-view-controller)?

A

MVC is an architectural pattern. It separates an application into 3 components.
Model: models the data
View: views the data
Controller: Controls the data

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

Explain how this example demonstraites composite? here

A

What makes the Group class in your diagram a Composite is:

Hierarchical Structure: It can contain other Shape objects, including other Group objects, thus forming a tree structure. Each Group can be a node that has children, and those children can be leaf nodes (like Point, Line, Circle) or other composite nodes (other Groups).

Uniformity: The Group class implements the same Shape interface as its components, which means you can use the Group in the same way you use a single Shape. This is the essence of the Composite pattern - you don’t need to know whether you’re working with a simple shape or a complex composition of shapes; you interact with them through the same interface.

Recursive Composition: A Group can hold other Group objects, allowing for the recursive composition of shapes. This recursion is a hallmark of the Composite pattern and enables the creation of complex structures.

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

What are design patterns?

A

Describe the best practices, good design and capture experience so others can reuse this experience.

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

What is the recursion here? here

A

The recursion is:
* Group contains Figure,
* and because a Figure can be a Group (a Group is a subclass of Figure)
* a group can contain groups …

This recursive composition allows complex object hierarchies to be constructed and treated as if they were a single object, which is central to the power and utility of the Composite pattern in object-oriented design.

17
Q

What is structural patterns and what is behavioural patterns?

A

Structural patterns: Deals with the compostion of classes. (Simplify the composition of classes and objects to form larger structures)

Behavioural patterns: Deals with the communication and interaction between objects and classes, distributes responsibilities. (Addresses communication between objects by defining how objects interact and distribute responsibilities)

18
Q

How to spot composite?

A
19
Q

What are the two structural design patterns?

A

Adapter and composite

20
Q

Purpose of observer design pattern?

A

Purpose
* Have a set of objects “observing” the state of an object * … so that they will be notified and updated immediately when the state changes.

21
Q

Describe adapter (structural pattern).

A

Adapts the interface of an already existing class to the interface that a client is expecting (kind of fills out the gap)

22
Q

How does observer design pattern work?

A

When the state of the object changes, it
notifies all the observers (by calling a method)
When notified, the observers decide what to
do with the knowledge
* Nothing
* Request information about the state of the object

here

23
Q

What is the purpose of an adapter?

A

A client is expecting a class/object that provides some services with a given interface (name of the class, methods, and their signatures). But the interface is different than from the expected one. The adapter adapts the different interface to be the expected one.

24
Q

Give an example of using adapter.

A

Say we have a super class, Shape, it has the subclasses Point, Line and Square, and they alle have the same methods, display() and fill() (interface). If we want to add the subclass Circle, but it contains different methods (different interface) (we can’t modify Circle), we can make an adapter, MyCircle, that adapts the interface of Circle to the expected one. So MyCircle is now the subclass of Shape, and works as a bridge for the Circle class to match the expected interface.

25
Q

What is an object adapter and what is a class adapter?

A

Object adapter: Adapter implements the interface of one object and wraps the other one her

Class adapter: Uses inheritance, but since there’s no multiple inheritance in Java, the expected interface (the class) must be an interface, and not a class, so our class adapter can inherit from both the expected interface and the adapted interface
her

26
Q

What can an adapter be used for?

A
  • Can be used when a class needs to be reused, and the wrong interface was used.
  • Therefore, we can ignore if a class has an interface that doesn’t match our needs, we can just put an adapter in front
  • Adapter can be used for slight modifications of the adapated
  • An object adapter can adapt several classes
27
Q

What is the strategy design pattern?

A

It’s a behavioural design pattern. It will make a family of algorithms, put each of them into a separate class (encapsulate them), and make them interchangeable, using an interface where we make the changes. Strategy uses composition

28
Q

How does the strategy design pattern work?

A

Say we have the Wolt app. We need to implement a payment method. We make a PaymentService class that maintains reference to the concrete strategies, via the strategy interface. The concrete strategies are implemented for either PaymentByCreditCard or PaymentByPayPal, and the interface declares these methods that will be used by the PaymentService

29
Q

How to spot adapter

A
30
Q

How to spot strategy

A