csci 387 quiz 3 Flashcards
software design and implementation is the stage in which
an executable software system is developed
you should identify software components and relationships based on
requirements
implementation is
realizing the design as a program
build vs buy: why is build problematic?
building to be used once
object-oriented design using UML: labels show
number of components (1..n means up to n)
how to identify objects
what shows behavior in different states?
scenario-based analysis
two kinds of design models
structural and dynamic
interface specification: want to be able to design objects and components
in parallel
objects may have ?
several interfaces
abstract class doesn’t have
objects
abstract classes are ?
extended; they implement the interface
interfaces define
how classes communicate
design pattern
a way of reusing abstract knowledge about a problem and its solution
pattern
description of the problem, essence of solution; should be sufficiently abstract to be reused
design patterns should make use of
object-oriented characteristics (i.e., inheritance, polymorphism)
can have multiple ? in one application
design patterns
observer pattern
separates display of object from state itself
when is the observer pattern used?
when multiple displays of state are needed
observer pattern: all displays must be update when?
the state is changed
observer pattern: object (does/does not) need to know about display formats
does not
enhancing display performance is (practical/impractical)
impractical
singleton falls under
creational
adapter falls under
structural
bridge falls under
structural
observer falls under
behavioral
strategy falls under
behavioral
design challenge of observer
observers need to know more
solutions to observer design challenge (observers needing to know more)
add parameters to notify method (problem with this is extra parameters and unused data), callbacks, new Observer interface
strategy design pattern
vary the algorithm independently of the clients who use it
observer design pattern has a ? dependency between objects
one-to-many
the point in the strategy design pattern is to
decrease compile time (if statements or multiple methods compile even if not called in run time)
strategy problem solution
strategy interface with different operations having their own classes that implement Strategy
examples of when we need the strategy pattern
for the group project, we could use multiple classes for which form or role to bring up
singleton
ensure a class has only one instance, and provide a global point of access to it
how to make singleton work
make the constructor private; new private method to generate instance; public get method
advantages to singleton
convenience, controlled access, flexible
issues with singleton
initialization, makes testing harder, synchronization, may reduce parallelism, memory leaks
adapter (wrapper) design pattern
convert the interface of a class into another interface clients expect (like dvd player for computer with no dvd slot - plug in external one to usb port)
bridge design pattern
decouple an abstraction from its implementation so that the two can vary independently (new classes with same methods, don’t change the interface b/c it would affect others that don’t need to be affected)
why is it bad practice to have a mutable singleton class?
mutable means it can change its internal state, thus essentially creating a new instance or at least varying the original
switching between different layouts using a context makes use of what design pattern?
assuming adapter?
program testing
shows a program does what it is intended to do; discover program defects
goals of program testing
- one test for every requirement in the requirements document
- tests for all system features
- defect testing is concerned with rooting out undesirable system behavior (crashes, interruptions, data corruption)
validation and defect testing
test for expected use then expose defects
verification asks
are we building this right
validation asks
are we building the right product
aim for verification and validation is to
establish confidence that the system is fit for its purpose
system purpose is composed of
software purpose, user expectations, and marketing environment
static verification
discover problems
dynamic verification
exercise/observe product behavior (more like unit testing)
stages of testing
development (unit testing), release (beta testing), user (test in own environment)
development testing is composed of
unit testing, component testing, and system testing
basic difference between unit and component testing
in unit testing, all the methods of other classes and modules are mocked; for component testing, all stubs and simulators are replaced with the real objects for all the classes (units) of that component, and mocking is used for classes of other components
system testing
a complete and integrated software is tested
cheaper and faster to (build/buy); only problem is
buy; how to modify the system to fit your requirements
object-oriented design involves developing a number of different software models, which is not cost-effective for ?
small systems
for large systems developed by different groups, ? are an important communication mechanism
design models
system context model
a structural model that demonstrates the other systems in the environment of the system being developed
interaction model
a dynamic model that shows how the system interacts with its environment as it is used
system context for the weather station
weather information system connected to control system, weather stations, satellite, etc.
interaction model for the weather station
use cases (e.g., weather information system can report weather or report status)
approaches to identification and differences
- grammatical: natural language (noun = object, verb = method)
- identify tangible things in the application domain
- behavioral approach: identify objects based on what participates in what behavior
- scenario-based analysis: objects, attributes, and methods in each scenario are identified
application domain objects
‘hardware’ objects related to the instruments in the system
examples of design models
subsystem (logical groupings), sequence (bars and arrows), state machine models, use-case, aggregation, generalization, etc.
consequences of the observer pattern
subject only knows the abstract observer and does not know details of the concrete class
software design and implementation are inter-leaved activities. the level of detail in the design depends on
the type of system and whether you are using a plan-driven or agile approach
process of object oriented design includes activities to
design the system architecture, identify objects in the system, describe the design using object models, and document the component interfaces
differences between adapter and bridge pattern
adapter allows the main class to function with other formats, while bridge creates different classes