Software Design Flashcards
What are the GRASP principles and patterns?
The GRASP principles and patterns are
High cohesion and low coupling
Controller
Creator
What is dependency injection?
Dependency injection is a technique whereby one object (or static method) supplies the dependencies of another object. A dependency is an object that can be used (a service)
What is the common problem that RTTI and dependency inversion attempt to address?
RTTI and dependency inversion define methods that characterize common functionality of related objects
What specific maintainability-related concern do the Laws of Demeter attempt to address?
The Laws of Demeter addresses the concern of avoiding designs that reach “through” one object to another. It does so by limiting the use of inherited and reeferenced content from and classes.
How do the strong and weak laws of Demeter differ?
Strong Demeter limits the use of inherited content. Weak Demeter allows inheritance of any superclass attributes
What is variation inheritance?
Variation inheritance is describing a class in terms of difference with another class. It can be useful for defining a package in terms of an existing version
What is the relationship between tiered computing and the client-server architectural style?
Tiered computing is a multi-layered client server, where an immediate layer preprocesses clients request and or post process the server response
What do the broker and proxy architectural styles have in common and how do they differ?
Broker and Proxy are both forms of tiered computing.
- A broker(host) intercepts an initial request then puts a client in direct contact with a server.
- In a proxy, the proxy handles ALL communication between the client and server
In what ways are the deployment strategies for MVC and MVP the same? How do they differ?
Model View Controller and Model View Presenter are both forms of tiered computing. In MVC, the immediate layer(controller) resides on the server and handles all communication between views and models.
On the other hand, a presenter is used instead of a controller which resided on the client side.
What does it mean for a request to be idempotent?
Simply put, an operation is idempotent if it produces the same result when called over and over. An identical request should return an identical result when done twice, two thousand, or two million times
What is RPC?
RPC stands for Remote Procedural Call. RPC makes a programs modules easy to deploy in a network by making location of a server completely transparent.
What is REST?
REST stands for Represental state transfer. REST decouples UI and datasource which allows for cross-platform.
What is a key difference between REST and RPC?
RPC directs request to procedures / API’s while REST directs request to resources.
What is a key difference between REST and RPC?
RPC directs request to procedures / API’s while REST directs request to resources.
What purpose(s) does an ORM serve in client-server implementation?
An object relational mapper is used to interchange data between code or underlying database.
ORC handles two issues:
1) Creation and realization of schema
2) Creating logic for interchanging data between class and database
What is meant by the term “marshalling” in context of RPC?
Marshalling is the packing of procedure parameters into a message packet.
What is PUT?
PUT creates a new resource
What is POST?
POST updates an existing resource
What is data-first development?
Data-first development affords more control over detail and performance at a cost of additional coding and more expertise. You would want to use data-first when you are expecting a long lifetime of a database.
What is code-first development?
Code-first offers the opposite set of advantages and disadvantages of data first. You would use code first if the database has a short expected life.
Name the six types of cohesion in the Constantine hierarchy
Furry Soft Cats Prefer Tender Love Care
Functional Sequential Communicative Procedural Tempural Logical Coincidental
Describe Coupling
Data Stamp Control External Common Global
What is Hybrid Coupling?
A subset of data used as control
Example: account numbers 00001 to 99999
If 90000 - 90999, send mail to area code of last 3 digit (000 - 999)
Define the principles of common use and common closure as they pertain to components?
The Common Closure Principle (CCP) states: ”The classes in a component should be closed together against the same kind of changes. A change that affects a component affects all the classes in that component and no other components.”
How can content coupling occur?
Content coupling can occur if a function in one module can control a function in another such as modifying.
What is the principle of single choice?
Whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.
What is the DRY principle?
Don’t repeat yourself (DRY). You should only need to specify intent in one place. For example, in terms of application design, specific functionality should be implemented in only one component; the functionality should not be duplicated in any other component
What is the separation of concerns?
Divide the application into distinct features with as little overlap in functionality as possible. The important factor is minimization of interaction points to achieve high cohesion and low coupling. However, separating functionality at the wrong boundaries can result in high coupling and complexity between features even though the contained functionality within a feature does not significantly overlap
What is the single responsibility principle?
Each component or module should be responsible for only a specific feature or functionality, or aggregation of cohesive functionality
What is abstraction?
Layered architecture abstracts the view of the system as whole while providing enough detail to understand the roles and responsibilities of individual layers and the relationship between them
What is encapsulation?
No assumptions need to be made about data types, methods and properties, or implementation during design, as these features are not exposed at layer boundaries.
What is cohesion?
Cohesion is the degree to which the elements of a program unit belong together. High cohesion is desirable since it promotes encapsulation.
What are the 7 Structural Design Patterns?
The seven structural design patterns are:
adapter bridge composite decorator facade flyweight proxy
What is the Adapter pattern?
The adapter pattern allows objects with incompatible interfaces to collaborate
What are structural design patterns?
Structural patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.
What is the bridge pattern?
The bridge pattern lets you split a large class or a set of closely related classes into two separate hierarchies -abstraction and implementation - which can be developed independently of each other.
What is the composite pattern?
The composite pattern lets you compose objects into tree structures and then work with these structures as if they were individual object
What is the decorator pattern?
The decorator pattern lets you attach new behaviors to objects inside special wrapper objects that contain the behaviors
What is a facade?
A facade provides a simplified interface to a library, a framework, or any other complex set of classes
What is a flyweight?
A flyweight lets you fit more objects into the available amount of RAM by sharing common parts of state between multiple objects instead of keeping all of the data in each object.
What is a proxy?
A proxy lets you provide a substitute or placeholder for another object. A proxy controls access to the original object, allowing you to perform something either before or after the request gets through to the original object.
What are creational design patterns?
Creational Design Patterns provide various object creation mechanisms, which increase flexibility and reuse of existing code
What is the factory method?
The factory method provides an interface for creating objects in a superclass to alter the type of objects that will be create
What is an abstract factory?
An abstract factory lets you produce families of related objects without specifying their concrete classes
What is the builder pattern?
The builder pattern lets you construct complex objects step by step. This allows you to produce different types and representations of an object using the same construction code.
What is the prototype pattern?
The prototype pattern lets you copy existing objects without making your code dependent on their classes
What is the singleton pattern?
The singleton pattern ensures that class has only one instance, while providing a global access point to this instance
What are behavioral design patterns?
Behavioral Design patterns are concerned with algorithms and the assignment of responsibilities between objects
Describe the chain of responsibility
The chain of responsibility lets you pass request along a chain of handlers. Upon receiving a request, each handler decides either to process the request or to pass it to the next handler in the chain.
Describe the command pattern
The command pattern turns a request into a stand-alone object that contains all Information about the request. This transformation lets you parameterize methods with different request, delay or queue a request execution, and support undoable operations
What is the iterator pattern?
The iterator pattern lets you traverse elements of a collection without exposing its underlying representation which may be a list, stack, tree, etc.
Describe the mediator pattern
The mediator pattern lets you reduce chaotic dependencies between objects.
It restricts direct communications between the objects and forces them to collaborate only via a mediator object
Describe the memento pattern
The memento pattern lets you save and restore the previous state of an object without revealing the details of its implementation
Describe the observer pattern
The observer pattern lets you define a subscription mechanism to notify multiple objects about any events that happen to the objects they are observing
Describe the state pattern
The state pattern lets an object alter its behavior when its internal state changes.
It appears as if the object changed its class
Describe the template method
The template method defines the skeleton of an algorithm in the superclass but lets subclasses override specific steps of the algorithm without changing its structure.
What is the visitor pattern?
The visitor pattern lets you separate algorithms from the objects on which they operate