chapter 6 Flashcards
What is design methodology?
logical and systematic steps to progress the design process.
also a set of guidelines for decision making.
What is refactoring (design methodology)?
Design decisions are revisited and revised.
What are design principles? Name the 6 principles.
Characteristics of good design.
Guidelines for decomposing a system.
- Modularity
- Interfaces
- Information hiding (public, protected, private)
- Incremental development
- Abstraction
- Generality
What is modularity in design principles?
A well organized system. Unrelated aspects are kept separate.
Each component has a single purpose.
Use coupling and cohesion to accomplish modularity.
What is coupling in design principles?
Degree by which software components are dependent on each other. Low coupling is better.
Tightly coupled: depend greatly on each other.
Loosely coupled: some dependencies.
Uncoupled: no dependencies.
What is content coupling?
Tightly coupled. A module that modifies the internal elements of another module. (internal access not public or protected methods).
What is common coupling?
Data is duplicated and kept in different modules. A change to the data needs to be changed in all duplicated locations.
What is control coupling?
When a module passes parameters or return code to control another module.
What is data coupling?
Data coupling is where modules are connected by unstructured data.
What is stamp coupling?
When two modules are connected by structured data (JSON format, csv, etc).
What is cohesion? What are the 7 types of cohesion?
Degree to which the elements inside a module belong together. High cohesion is better (think MVC).
- coincidental
- logical
- temporal
- procedural
- communicational
- functional
- informational
What is coincidental cohesion?
A module containing unrelated elements; low cohesion.
What is logical cohesion?
Parts are related only by the logic structure not functionally; low cohesion.
What is temporal cohesion?
Elements of a component are related by timing.
What is procedural cohesion?
Ensures the order of the execution; algorithms.
What is communication cohesion?
Multiple modules operates on the same data set (input or output). Place each dataset in its own module.
What is functional cohesion?
All elements essential to a function are contained in one module, and all of the elements are essential to the performance of the function.
The ideal solution.
What is informational cohesion?
Adaptation of functional cohesion to data-abstraction and object-based design.
Parts of a module are grouped together as they are suppose to operate on the same data or information.
What is an interface (design principle)?
defines the services of a system,
defines how units access the services; public methods.
A module can have several interfaces.
What is the specification of a software unit’s interface?
A description of the externally visible properties of a software system.
- purpose: description of the function.
- preconditions: requirements of the function (variables, libraries, etc.).
- protocols: sequence of function calls.
- postconditions: return values, exceptions, modified variables.
- quality attributes: no description given…
What is information hiding?
Public, private, protected; only necessary information is shown. Good use of information hiding allows units to be loosely coupled.
What is incremental development?
Software is developed in phases.
Dependencies are used to design a development schedule for scrum.
What do “uses graphs” help a system do?
Helps to identify progressively larger subsets of our system that can be implemented and tested incrementally.
Fan-in: number of higher level modules that call this module. Fan-out: number of lower level modules that this module uses.
What is sandwiching in incremental development?
A technique to break cycles in the “use graph,” It involves decomposing one unit so that the cycle ends.
What is abstraction (design principle)?
A general model that omits details.
Super class, sub class.
What is generality (design principle)? How is it done?
Making software as universally applicable as possible to increase the chance it will be useful in some future system.
Done by:
- Parameterizing context-specific info.
- Removing preconditions.
- Simplifying postconditions.
What is OO design?
A decomposition of a system into runtime components called objects that encapsulate data and functionality.
- objects are uniquely “identifiable” runtime entities.
- objects can be “composed”; object’s variables can be objects themselves.
- OO code can be polymorphic, generic code that works with objects of related types.
What is a class (OO design)?
Software module that partially or fully implements an abstract data type.
It is essentially a custom data type.
What is an abstract class (OO design)?
A class with missing implementations for some of its methods.
What is a constructor (OO design)?
A function that runs when a new instance of an object is created.
What is an instance of a class (OO design)?
A specific example of a class.
What are attributes in a class (OO design)?
object’s data attributes.
What are methods in a class (OO design)?
object’s functions.
What is dynamic binding (OO design)?
Method overloading.
The compiler cannot determine the binding at compile time.
When the program runs then the binding is determined.
What is multiplicity (OO design)?
Used in diagrams. Represents the relationship between objects. (1 to many).
What is object composition (OO design)?
New classes built by combining component classes.
What is inheritance (OO design)?
Creating a new class by extending an existing one.
What is polymorphism (OO design)?
Code that interacts with an interface.
The actual bindings are figured out during run-time.
What are the two techniques for constructing large objects (OO design)?
inheritance: subclass’s implementation is determined at design time.
composition: better to preserve encapsulation and code reuse.
What is the Law of Demeter (OO design)?
Communicate to immediate closest friends.
A -> B -> C
If A wanted to execute a method in C, it should tell B to do it.
What is dependency inversion principle (OO design)?
High level code must not depend on low level code.
Store -> Payment Class -> Paypal API, Visa API
Store just needs to run a pay event. It doesn’t need to know how to do it.
Define the types of relationships in an ER-diagram. (6 types)
association: relationship. A married to B. (straight line)
composition: cannot exist on its own. a person has a heart. (closed diamond)
aggregation: can exist on its own. a company has employees. (open diamond)
generalization (inheritance): sub class -> super class (open triangle)
dependency: one module depends on another (dashed arrow)
navigation: can access another without them knowing? (solid arrow)
What is class description template?
A template that looks like python code.
What is a package diagram?
Shows the system as a collection of packages and their dependencies.
Each package can contain many classes.
Useful for testing.
What is a sequence diagram?
A diagram that shows a sequence of activities or behaviors.
What is a communication diagram?
A sequence of messages between objects.
What is a state diagram?
The possible states an object can take and the events that trigger transitions.
What is an activity diagram?
Flow of procedures or activities in a class.
Define OO design patterns?
A template of a solution based on design principles. It is not a library, rather a concept. MVC.
What is template model pattern (design patterns)?
The use of inheritance to create sub-classes. The abstract class implements common steps. The sub-classes implement specific steps.
What is the factory method pattern?
Encapsulates code that creates objects.
Useful for creating a class at run-time (subclass type cannot be determined at compile time).
EnemyShip -> UFO or ROCKET.
What is the strategy pattern?
Allows algorithms to be selected at runtime.
Animals (super class), Dog + Bird (sub classes).
Algorithm = fly();
What is the decorator pattern?
Extends an object’s functionality at runtime. Adding more toppings to a pizza at runtime.
What is the observer pattern?
Application of the publish-subscribe architecture.
What is the composite pattern?
Promotes the use of a single uniform interface.
What are some tips for designing user interfaces? (6 things)
- identify the audience
- what ways can a system perform a task?
- hierarchy of user commands
- refine the sequence of user interaction w/ system
- designing relevant classes for the UI
- integrating ui into the overall system.
What is a framework?
A large reusable design for a specific application domain.
GUI editors, web applications, accounting systems.
What is a uses relation?
a dependency relation of each software unit.