Design For maintainability Flashcards

1
Q

Applying law of maintenance to design, 3 ideas

A

► Software industry laws: Second law of Lehman’s laws
 Change->complexity->takes resources
► Idea 1: To create separate modules and with a good modularity
 Well-defined
 Conceptually simple
 Independent upon partitioning
► low coupling
► high cohesion
 With well-defined interfaces
►Idea 2: Via decisions ensuring encapsulation
► Idea 3: Pattern

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

Patterns in Software

A

► A pattern is a model proposed for imitation for solving a software design problem
► Used at different levels of abstraction of design problems
 Architectural Patterns for entire systems
 Design Patterns for collaborations between several classes
 Data Structures and Algorithms

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

Defining Design Patterns

A

► A design pattern is a way of reusing abstract knowledge about a problem and its solution.
► A pattern is a description of the problem and the essence of its solution.
► It should be sufficiently abstract to be reused in different settings.
► Patterns often rely on object characteristics such as inheritance and
polymorphism.

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

Pattern Elements

A

► Name
 A meaningful pattern identifier
► Problem description
► Solution description
 Not a concrete design but a template for a design solution that can be
instantiated in different ways
► Consequences
 The results and trade-offs of applying the pattern

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

What are the different architectural patterns

A

MVC,
events driven
shared data (blackboard, repository)
pipe-and-filter
layered
peer-to-peer
client-server

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

Defining Design Patterns

A

► Layered pattern
This pattern can be used to structure programs that can be decomposed into groups of subtasks, each of which is at a particular level of abstraction. Each layer provides services to the next higher layer.
The most commonly found 4 layers of a general information system are as follows:
*Presentation layer (also known as UI layer)
*Application layer (also known as service layer)
*Business logic layer (also known as domain layer)
*Data access layer (also known as persistence layer)
Usage
*General desktop applications.
*E commerce web applications.

I mean it looks like lego blocks, layer N at the top, Layer 0 at the bottom bruh

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

Client-server pattern

A

This pattern consists of two parties; a server and multiple clients. The server
component will provide services to multiple client components. Clients request
services from the server and the server provides relevant services to those
clients. Furthermore, the server continues to listen to client requests.
Usage
*Online applications such as email, document sharing and banking.

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

Defining Design Patterns

A

► Pipe-filter pattern
This pattern can be used to structure systems which produce and process a stream of data. Each processing step is enclosed within a filter component. Data to be processed is passed through pipes. These pipes can be used for buffering or for synchronization purposes.
Usage
*Compilers. The consecutive filters perform lexical analysis, parsing, semantic analysis, and code generation.
*Workflows in bioinformatics

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

Peer-to-peer pattern

A

In this pattern, individual components are known as peers. Peers may function both as a client, requesting services from other peers, and as a server, providing services to other peers. A peer may act as a client or as a server or as both, and it can change its role dynamically with time.
Usage
*File-sharing networks
*Cryptocurrency-based products such as Blockchain

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

Event pattern

A

This pattern primarily deals with events and has 4 major components; event
source, event listener, channel and event bus. Sources publish messages to
particular channels on an event bus. Listeners subscribe to particular channels.
Listeners are notified of messages that are published to a channel to which they
have subscribed before.
Usage
*Android development
*Notification services

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

Model-view-controller pattern

A

This pattern, also known as MVC pattern, divides an interactive application into
3 parts:
1.model — contains the core functionality and data
2.view — displays the information to the user (more than one view may be
defined)
3.controller — handles the input from the user
This is done to separate internal representations of information from the ways information is presented to, and accepted from, the user. It decouples components and allows efficient code reuse.
Usage
*Architecture for World Wide Web applications in major programming languages.
*Web framework

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

Blackboard pattern

A

This pattern is useful for problems for which no deterministic solution strategies
are known. The blackboard pattern consists of 3 main components:
*blackboard — a structured global memory containing objects from the solution space
*knowledge source — specialized modules with their own representation
*control component — selects, configures and executes modules.
All the components have access to the blackboard. Components may produce new data objects that are added to the blackboard. Components look for particular kinds of data on the blackboard, and may find these by pattern matching with the existing knowledge source.

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

Blackboard pattern
Usage

A

*Speech recognition
*Vehicle identification and tracking
*Sonar signals interpretation.

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

Broker pattern

A

This pattern is used to structure distributed systems with decoupled components.
These components can interact with each other by remote service invocations.
A broker component is responsible for the coordination of communication among components.
Servers publish their capabilities (services and characteristics) to a broker. Clients request a service from the broker, and the broker then redirects the client to a suitable service from its registry.
Usage
*Message broker software such as Apache

look at images

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

Mid-Level Design Patterns

A

Broker Design Patterns
Generator Design Patterns
Reactor

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

Broker Design Patterns

A
  • Façade, Mediator
  • Adaptor
  • Proxy
17
Q

Generator Design Patterns

A
  • Factory
  • Singleton
  • Prototype
18
Q

Reactor

A
  • Command
  • Observer
19
Q

Façade pattern

A

The Facade design pattern provides a unified interface to a set of interfaces in a
subsystem. This pattern defines a higher-level interface that makes the
subsystem easier to use.
see images

20
Q

Adaptor pattern

A

The adapter design pattern is a structural design pattern that allows two
unrelated/uncommon interfaces to work together. In other words, the adapter pattern makes two incompatible interfaces compatible without changing their existing code. Interfaces may be incompatible, but the inner functionality should match the requirement

See images

21
Q

Proxy pattern

A

In computer programming, the proxy pattern is a software design pattern. A proxy, in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. In short, a proxy is a wrapper or agent object that is being called by the client to access the real serving object behind the scenes.
Use of the proxy can simply be forwarding to the real object, or can provide additional logic. In the proxy, extra functionality can be provided, for example caching when operations on the real object are resource intensive, or checking preconditions before operations on the real object are invoked. For the client, usage of a proxy object is similar to using the real object, because both
implement the same interface.

22
Q

Factory pattern

A

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.
The factory design pattern is a very common design pattern, used in most of the software development projects. Factory Design Pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created

23
Q

Singleton pattern

A

In software engineering, the singleton
pattern is a software design pattern that
restricts the instantiation of a class to one
“single” instance. This is useful when exactly
one object is needed to coordinate actions
across the system

See images

24
Q

Prototype pattern

A

The prototype pattern is a creational design pattern in software development. It
is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. This pattern is used to avoid subclasses of an object creator in the client application, like the factory method pattern does and to avoid the inherent cost of creating a new object in the
standard way (e.g., using the ‘new’ keyword) when it is prohibitively expensive for a given application
See images

25
Q

Command pattern

A

Command pattern is a behavioral design pattern which is useful to abstract
business logic into discrete actions which we call commands. This command
object helps in loose coupling between two classes where one class (invoker)
shall call a method on other class (receiver) to perform a business operation.

26
Q

Dude, just study what’s on here and then look at the lecture notes man