CS 2340 Midterm 1
Singleton Pattern
Ensures a class has only one instance, and provides a global point of access to it
What is the difference between failure, fault, and error?
Failure Observable incorrect behavior of a program. Conceptually related to the behavior of the program, rather than its code. Fault (bug) Related to the code. Necessary (not sufficient!) condition for the occurrence of a failure. Error Cause of a fault. Usually a human error (conceptual, typo, etc.)
difference between error and fault
Fault (Bug): Related to the code. Necessary (not sufficient) condition for the occurence of a failure Error: Cause of a fault. Usually a human error
What are the benefits to Agile?
Flat cost, adaptability
What are the principles of Agile development?
Focus on the code/product rather than design Value people you work wiith over adhering to specific development process Use an iterative approach to quickly deliver a working product, then evolve it as needed Involve customer in development process and value their feedback Expect that requirements will change and be prepared to adapt, aka stay agile Have a simple but functional product that meets all requirements, documentation is lower priority
What type of requirements do Use Cases usually constitute
Functional requirements
How do you merge a feature branch into the main branch?
Git checkout main -> git merge feature
What are the differences between Git and GitHub?
Github is a git repository hosting service that allows users to use git for version control and collaboration/web gui, Git is a command line tool that you use to interface between local and remote repositories
What are some benefits to the Waterfall method?
Good for a large team with specialized roles, strict constraints, and deadlines
What is the Agile methodology?
Highly iterative and incremental development process that takes place over a series of time-constrained sprints
Integration testing
How do units interact
Why are Customer Tests so important?
Humanistic feature of xp Tests the customer's requirements & functionality
What makes a successful test?
If it fails!!
How does an SD differ from an SSD? What does an SD show that an SSD does not?
In SD the system is not a black box!!!
What are some key activities for iterative development?
In iterative development, feature code is designed, developed and tested in repeated cycles.
When are use case relationships of <<include>> and <<extend>> used?
Include: when one use case uses another use case, dotted line pointing to child use case Extend: when use case can take an alternate path, depict with dotted line pointing to base use case
What are some of XP's practices?
Incremental planning, small releases, simple design, test frst, refactoring, pair programming, continuous integration, on-site customer
DCD lines: interface generalization
Interface: dashed line, white arrow (also called realization relationship) often omit trivial / obvious generalization relationships, such as drawing the Object class as a parent
What is the format of a User Story?
"As a website user, I want to able to search on the webpage so that I can find necessary information" title should be some action you can demo, tells the who/what/why
What tests can be used to determine the validity of use cases?
"How can using the system provide observable value to the user, or fulfill their goals?" elementary business process test boss test size test
DCD lines: composition
"is entirely made of" stronger version of aggregation the parts live and die with the whole child cannot exist independent of the parent symbolized by a black diamond The relationship between the whole and the part, but the whole and the part cannot be separated .
DCD lines: aggregation
"is part of" child can exist independently of the parent The relationship between the whole and the part, but the whole and the part can be separated
DCD lines: dependency
"uses temporarily" symbolized by dotted line often is an implementation detail, not an intrinsic part of that object's state X uses Y methods of a class that use another class's object as a parameter .
Alt
(alternative path) If-then-else, use brackets for conditions
Loop
(iteration) Specify guard/condition in brackets
Opt
(optional path) Specify guard/condition in brackets
Ref
(reference to other ssd) Reference an interaction or entire other diagram to manage size
Why use an object-oriented approach?
- Reduces maintenance costs by limiting the effects of changes to code - Improves development process by favoring reuse of code and design - Enforces good design principles with high cohesion and low coupling
drawing DCDs: Comments
A note symbol attached to the appropriate class by a dashed line may represent several things: UML note or comment •UML constraint •Method body
Elementary Business Process Test
A task performed by one person in one place at one time, in response to a business event, which adds measurable business value and leaves the data in a consistent state Use case shouldn't be too big
What are two characteristics of Stories?*
A task the user would complete on the software Story is all on one card without specific instructions
What is an object-oriented approach?
A technique used by dissecting our solutions into pieces called classes and objects
What does a Domain Model show? Does it show software classes?
It represents the concept/problem, not the software solution Does not show classes
What is "iteration" in software development?
Iterative development is a way of breaking down the software development of a large application into smaller chunks. You deliver working software quickly and evolve it quickly
sde acronyms: KISS ;)
Keep It Simple Stupid •Keeping it simple is surprisingly hard •Avoid trying to overengineer a solution to a simple problem
How do we decide the order of implementation of classes in DCD?
Least to Highest Coupled (look at outgoing relationship arrows) aka start with classes that are only connected to 1 other class, then 2, etc possible first classes to implement? next are classes only dependent on the prior implementations
What are the characteristics of XP?
Lightweight Disciplined and has a set practice for developers to follow humanistic , places customer/developers at center of process Focus on good software development principles Values: communication, simplicity, feedback, courage Mentality of sufficiency: what is good enough?? Write tests, restructure often, discuss Flexible with timelines, emphasis on strong engineering practices, lots of customer involvement
What are the differences between local and remote repositories?
Local is on your machine and no one can see the changes except you Remote is on github/the cloud and is the version of code that everyone can access
sde acronyms: LGTM
Looks Good To Me Term often used in code reviews when there is too much code to review and you just want to move on with your life
dcd Constraints formatting
Marked as {postcondition: object = condition}
UML keywords: {ordered}
Means a set of objects have some imposed order Could be used in class diagrams, at an association end
UML keywords: {abstract}
Means abstract element; can't be instantiated Could be used in class diagrams, after classifier name or operation name
UML keywords: «actor»
Means classifier is an actor Could be used in class diagram, above classifier name
UML keywords: «interface»
Means classifier is an interface Could be used in class diagram, above classifier name
What is a Domain Model?
Model that displays the domain or most important concepts of the problem
What is a Sequence Diagram? How does it relate to use cases?
Models the interactions between objects in a system and the order in which they are processed, showing the flow of messages between objects in a system. Shows how objects interact with each other over the course of a single event. A sequence diagram is commonly created for each use case or for each scenario.
How do we create a new branch?
New branch command is git checkout -b name
What are some downsides to the Waterfall method?
Offers no flexibility and is inconvenient/time consuming to change requirements
When should we create DCDs?
Once the interaction (dynamic) diagrams have been completed it is possible to identify the specification for the software classes and interfaces.
What are the pros and cons of pair programming?
Pros: productivity is similar to that of 2 people working independently, humanistic Cons: time consuming? Must be in person?
diagramming SDs: Asynchronous Message
Represented by Line Arrowhead used when the message caller does not wait for the receiver to process the message and return before sending other messages to other objects within the system.
diagramming SDs: Synchronous Message
Represented by solid arrowhead used when the sender waits for the receiver to process the message and return before carrying on with another message.
What are some of the phases / activities when developing software?
Requirements Engineering Design Implementation Verification & Validation Maintenance
Scrum pros and cons
Scrum is good for delivering product etc quickly and regularly to clients, but is not flexible with timelines
sde acronyms: SoC
Separation of Concerns •Design principle for separating a computer program into distinct sections; each section addresses a separate concern •Concern is a set of information that affects the code of a computer program •High Cohesion, Low Coupling
What is a Use Case Model?
Set of all written use cases
What goes into a commit message?
Short and descriptive, what changes you made in simple present/past tense
Boss test
Show something of value
Unit test
Small individual pieces tested individually
How long do each of the Sprint Ceremonies last?
Sprint planning: 6 hours at start of sprint for team to move items form product backlog to sprint backlog Daily scrum: 15 minutes for team to answer the 3 questions Sprint review: 3 hour demo at the end of sprint Sprint retrospective: 2 hour discussion/evaluation of process at the end of sprint
What is the syntax of representing objects in SD?
Squares with object type, optionally preceded by object name and colon write object's name if it clarifies the diagram object's "life line" represented by dashed vert. line
Where do requirements come from?
Stakeholders, application domain, existing documentation
What is the difference between static and dynamic diagrams? What is an example of each?
Static diagrams describe the state of a system from a variety of perspectives. A static diagram describes what a piece of the system is. A dynamic diagram describes what a portion of the system is doing.
How do we switch branches?
Switch to a branch using git checkout name
What is Version Control?
System that tracks changes in computer files, like a google doc for your code so that changes occurring simultaneously don't impact each other
In an SSD, what are systems treated as?
System viewed as a "black box", Internal objects not shown
What is the Waterfall method?
Team develops software in an orderly sequence of steps which allows for early error detection and works well for software with a stable product definition and requirements that will not change
Developer testing
Testing done by developers within an organization
Beta testing
Testing done with a selected group of clients outside the organization
Alpha testing
Testing performed within the organization
What goes in a Use Case Diagram?
Actors as stick figures with their names (primary on left side, supporting on right side) Use cases as ellipses with their names Line associations connecting an actor to the use case where they participate System boundary represented by rectangle
What is the 3-stage process for making a commit (and pushing to the remote repository)?
Add, commit, push
How do we map DCD aggregation relationship to code?*
Aggregation is one type of association between two objects that is also describing the "have a" relationship. Composition is a specific type of Aggregation which implies ownership. Aggregation is indicated using a straight line with an empty arrowhead at one end. For example, your car consists of wheels, engine, gearbox, steering, and the main body, etc. It is an assembly, and the other parts are its constituents. Here, car to the wheel is one Aggregation, car to the engine is another aggregation, car to gearbox another, and so on.
Optimistic approximation testing
The program under test is exercised with a (very small) subset of all the possible input data- We assume that the behavior with any other input is consistent with the behavior shown for the selected subset of input data
How do you find conceptual classes?
Underline the nouns in your user stories
What are the different testing granularity levels?
Unit testing Integration System Acceptance testing Regression testing
Size test
Use cases contain many steps, as opposed to a single step within a series Shouldnt be too small
when to use Attribute Text Notation
Used for data type objects
when to use association line notation
Used for non-data type objects
What are the steps to analyzing requirements?
Verification & validation
What are some differences between Waterfall and Agile?
Waterfall allows you to discover errors early and adapt, but Agile allows you to address errors as they come up which reduces the cost of development over time
What questions are asked during the Daily Scrum?
What did you do yesterday? What will you do today? What obstacles are you facing?
diagramming SDs: Reflexive message
When an object sends a message to itself indicated with a message arrow that starts and ends at the same lifeline
What are the benefits of using iterative development?
Working software from the start. Delivers business value with each iteration. Adaptable to changes in requirements throughout development. Design effort is expended only for what will be built next. Ability to course correct with every iteration.
What is TDD Cycle? Define each part of the cycle
Write test code (make it fail) •Code that fulfills requirements •Write functional code (make it work) •Working code that fulfills requirements •Refactor (make it better) Clean working code that fulfills requirements
DCD lines: Associations
X and Y are related (has) Can be dependency, aggregation, or composition association, can be unidirectional
DCD lines: Generalization
X is a Y Inheritance between classes or interface implementation Realization is also part of this hierarchies drawn top-down arrows point upward to parent line/arrow styles indicate whether parent is:
DCD lines: Realization
X is a Y interface implementation
sde acronyms: YAGNI
You Aren't Gonna Need It •A programmer should not add functionality until deemed necessary •The principle behind XP practice: "do the simplest thing that could possibly work". Also relevant to TDD. •Must be used in combination with several other practices, such as continuous refactoring, unit testing and continuous integration
How does it relate to a Domain Model? How does it differ?
a Design Class Diagram differs from a Domain Model in the sense that it shows software entities rather than actual concepts.
User stories
a subset of use cases and are a simpler/more informal way to describe user needs
git add
add changes that you want to make to the "staging area", you either say git add (filename) or you can say git add . to add all changes that youve made across your local repo
git clone
adds the remote repo to your machine making it a local repo
git merge
allows you to put the changes that you have made in one branch into another branch without committing to main branch. This is two steps, git checkout (name of the branch you want to merge into) then git merge (name of the branch you are merging)
What fragments can be used in an SSD?
alt, loop, opt, ref
diagramming SDs: Deletion
an X at bottom of object's lifeline Java doesn't explicitly delete objects; they fall out of scope and are garbage-collected
What is an activation bar?
an interaction between two objects occurs when one object sends a message to another. the box placed on the lifeline to indicate that an object is active (or instantiated) during an interaction. Length of the rectangle indicates the duration of the objects staying active.
Object oriented design
applies constraints of technology and implementation to the analysis model, strives to describe how the system will work using these objects
diagramming SDs: Creation
arrow with 'new' written above it Indicates object being created an object created after the start of the scenario appears lower than the others
What are the 4 types of visibility between objects?
attribute, parameter, local, & global
git fetch
check if you need to update your local repo to match the most recent remote repo (if there have been recent changes)
git status
check status of local changes you have made (if they are added/committed/etc)
drawing DCDs: Classes, Abstract Classes, Interfaces
class name in top of box write <<interface>> on top of interfaces' names use italics for an abstract class name
Use case
collection of related success and failure scenarios to describe actors using a system to accomplish a goal
git commit
commit the changes that are added in the staging area. Use -m to add a message explaining what you are doing
Associations
connected with a straight line: ex each car has one make (aggregation would be car maker has multiple models) x has 1 y Librarian has 1 library that they work at
Object-oriented analysis
create a model of the system without considering constraints, strives to describe what the system should do in terms of key objects in the problem domain Uses use case diagram and domain model to map out system
Offstage actor
has an interest in the behavior of the use case, but isnt directly involved (ex government funds company)
Primary actor
has user goals fulfilled through using SuD (ex user looks at data analysis)
Static verification/analysis
identify (specific) problems statically, that is, considering all possible executions
assuming visibility in DCDs
if not mentioned, attributes are assumed to be private and methods are assumed to be public by default.
Concrete style use case
includes ui decisions and is not used for early requirement analysis
diagramming SDs: message (method call)
indicated by horizontal arrow to other object write message name and arguments above arrow
Scenarios
interactions between actors and the SuD
Product backlog
list of all tasks that need to be done
Sprint backlog
list of product backlog tasks that need to completed in the current sprint
drawing DCDs: operations / methods (optional)
may omit trivial (get/set) methods but don't omit any methods from an interface! should not include inherited methods Visibility + public (public) # protected - private Underline static methods parameter types listed as (name: type) omit return_type on constructors and when return type is void method example: + distance(p1: Point, p2: Point): double
Verification
means the software fulfills system requirements aka meets specifications aka fulfills every necessary requirement
Validation
means the software fulfills user requirements aka the expectations of the end user, aka all the requirements achieve the intended goals
git checkout
move to an existing branch using git checkout (branch name), create a new branch and move to it using git checkout -b (branch name)
Casual use case
multiple paragraphs covering multiple scenarios
drawing DCDs: other*
o Line/Arrow notations o Operations/Methods o Relationships ??????
Brief use case
one paragraph summary of functionality
Local visibility
B is a (non-parameter) local object in a method of A Local visibility from A to B exists when B is declared as a local object within a method of A. • Relatively temporary visibility because it persists only within the scope of the method • Two common means by which local visibility is achieved are: • Create a new local instance and assign it to a local variable. • Assign the returning object from a method invocation to a local variable. • As with parameter visibility, it is common to transform locally declared visibility into attribute visibility. • Creating an object of type B in a method in class A
Regression testing
Back checking the system to make sure the backing infrastructure is okay after any changes
Activation bar
Bar on lifeline of object to represent when it is active
What testing is done outside the organization?
Beta testing: testing by sample of real users (acceptance testing)
difference between sprint review and sprint retrospective
Both occur at the end of each sprint, but stakeholders attend the more formal review while the retrospective is internal for the team
Conceptual classes, attributes and derived attributes
Conceptual classes go in a box Attributes and Derived Attributes go in the box with the conceptual classes they are related to Derived attributes have a slash
DCD vs Domain Model
DCD specifies software class interactions, DM does not
How do DCDs translate into workable code?
DCDs are essentially a graphical depiction of the static state of the system. It shows you what methods and attributes each class has.
How do we represent the lifeline of objects in SD?
Dashed vertical line descending from object box Lifeline boxes represent the participants in an interaction
Roles and multiplicities
Dependencies: x uses y Library member uses their library account to check out a book Associations: x has 1 y Librarian has 1 library that they work at Aggregations: x has many ys Library has several librarians Directed association: x has y but y does not have x Library member is linked to the book they checked out, but the book is not linked to them Generalization: x is a y Librarian is a library member
What is Extreme Programming (XP)?
Design process that makes waterfall iterative Product is released/built piece by piece over time Assumes rapidly changing requirements
What occurs during Sprint Planning?
Determine which items from the product backlog need to be completed for current sprint
What testing is done within the organization?
Developers' testing: testing by you and your teammates (unit testing, integration testing, system testing) Alpha testing: testing by who in the same company with you (acceptance testing)
Where do Sequence Diagrams lie in the overall project design process?*
Domain model > use case diagrams > system sequence diagrams > sequence diagram > design class diagram
sde acronyms: DRY
Don't Repeat Yourself. If you are copying/pasting, there is probably a problem
Is testing dynamic or static verification?
Dynamic!!
Is an SSD a static or dynamic diagram
Dynamic? Shows interactions with external environment
Supporting actor
provides a service to the SuD (ex Salesforce gives SuD data)
Formal verification (proof of correctness)
proving that the program implements the program specifications
git pull
retrieve updated remote repo
Scrum master
scrum actor who manages scrum process and facilitates
Product owner/customer
scrum actor who prioritizes tasks/user stories in backlog
Team
scrum actors who complete backlog items and deliver increments
What is a Design Class Diagram?
seeks to represent how a system will be implemented in an object-oriented programming language. All of the necessary objects are modeled to help design the architecture of the software classes before programming starts.
drawing DCDs: attributes (optional)
should include all fields of the object attributes (fields, instance variables) visibility name : type [count] = default_value Underline static attributes derived attribute: not stored, but can be computed from other attribute values attribute example: - balance : double = 0.00 + public # protected - private (default) / derived
git branch
show all local branches
Actors
something that interacts with the system like a user, another computer, and organization
sprint ceremonies
sprint planning, daily scrum, sprint review, sprint retrospective
Is a DCD a static or dynamic diagram?
static
Fully dressed use case
structured, detailed description of scenarios
•Inspections/reviews/walkthroughs:
systematic group review of program text to detect faults
Sprint review
team demos this iteration of the product to stakeholders and revises backlog
Sprint retrospective
team reflects on their process and what they can improve
What determines the direction and order of messages in SSD?
the only interactions that are included are those between the actor and the system. statements are chronologically ordered
How do SDs translate into workable code?
they show how classes interact with each other in certain use cases. It shows method calls, which class calls methods, and the order they are called in
Functional Requirements
things that the product must be able to do (ex. Take username and password as input, keep track of player's score), the activities that the system must perform
Non-functional requirements
things that the product still needs, but that won't actually impact how it functions (ex. security, cost, accuracy, efficiency etc), Constraints on the services or functions offered by the system such as timing constraints, constraints on the development process, standards, etc.
What is a pull request? What are the advantages of using a pull request?
tool where you aggregate branch changes and request that the changes be merged to another branch Allows for control by team leader etc
git push
update the remote repo with all the changes youve added and committed
diagramming SDs: Return message
used to indicate that the message receiver is done processing the message and is returning control over to the message caller.
unit tests
validate the smallest components of system, ensuring that they handle known input and output correctly
Aggregations
x has many ys Library has several librarians
Directed association
x has y but y does not have x Library member is linked to the book they checked out, but the book is not linked to them
Generalization
x is a y Librarian is a library member
Dependencies
x uses y Library member uses their library account to check out a book
Essential style use case
focused on intent and avoids making ui decisions
What are the 4 pillars of OOPS?
1. Abstraction 2. Encapsulation 3. Inheritance 4. Polymorphism
Constraints in UML*
???
Parameter visibility
B is a parameter of a method in A Parameter visibility from A to B exists when B is passed as a parameter to a method in class A. • When the makeLineItem message is sent to a Sale instance, a ProductDescription instance is passed as a parameter. Within the scope of the makeLineItem method, the Sale has parameter visibility to a ProductDescription. • Relatively temporary visibility because it persists only within the scope of the method. • Second most common form of visibility in OO systems • It is common to transform parameter visibility into attribute visibility.
Attribute Visibility
B is an attribute of A Attribute visibility from A to B exists when B is an attribute of A. • in a Java class definition for Register, a Register instance has attribute visibility to a ProductCatalog, since it ProductCatalog is an attribute (Java instance variable) of the Register. • Relatively permanent visibility because it persists as long as A and B exist • Most common form of visibility in OO systems
Global Visibility
B is globally visible Global visibility from A to B exists when B is global to A. • B is visible to anyone all the time • ex. static final MY_GLOBAL • Least common form of visibility bc of issues with encapsulation and data integrity in OOP • The preferred method to achieve global visibility is to use the Singleton pattern.
DCD lines: class generalization
Class: solid line, black arrow
Why should we use Version Control?
Coordinates work between multiple developers, allows you to track and revert changes
Acceptance testing
Customer validated tests
What is Test Driven Development (TDD)?
begin by writing a test that fails, then move on to creating the actual production code, and see the test pass, and continue on to either add functionality, refactor your code, or to create another failing test.
What are the differences between Object-Oriented Analysis and Object-Oriented Design?
design considers the specific constraints of technology but analysis is more abstract
What is a System Sequence Diagram? How does it relate to use cases, actors, and system events?
displays the interaction of a system with an external user or actor for a particular scenario of a use case. Models the interactions between objects in a system and the order in which they are processed, showing the flow of messages between objects in a system
When are Sequence scenario diagrams created?
during elaboration phase
Is an SD a static or dynamic diagram?
dynamic
Dynamic verification
exercising software to try and generate failures aka testing!
Use cases
explain how the system interacts with the end user
What is the structure of a Use Case?
ext stories to record functional requirements by describing interactions between users and the system under development (SuD) Characters: actor/user, SuD, user goal, preconditions, main success scenario, alternate scenario, postconditions