Docsity

Software Development Best Practices and Design Patterns, Exams of Software Engineering

Toggle sidebar
bg1
Software Engineering Final Exam| Verified
Solution
Name some ways VCS systems help in software development.
- Keep records of changes
- Allow collaborative development
- Know who made changes to what
- Revert changes
- Build/release
management
Centralized VCS
- Commit directly to remote
- Server has main copy
- Ex:
Subversion
Distributed
VCS
- Commit locally, push and pull to remotes
- No one has main copy
- Ex: Git
What are the advantage of DVCS over Centralized VCS?
- Can commit locally and push once you're ready
- Don't need internet connection to
commit GitHub Workflow
(0. Fork if not part of
organization) 1. Clone
2. Branch
3. Commit
4. Pull in branch you want to
merge to 5. Push to origin
(GitHub)
6. Make pull request/get
feedback 7. Merge pull
request
8. Delete
branch Git
Branch
Split in commit history, lets you work in
parallel Git Fork
Copy of someone else's repo on
GitHub Git Clone
Get local copy of
repo Git Origin
Default remote (GitHub in our
case) test
bj ;P
Git Master
Main
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Software Development Best Practices and Design Patterns and more Exams Software Engineering in PDF only on Docsity!

Software Engineering Final Exam| Verified

Solution

Name some ways VCS systems help in software development.

  • Keep records of changes
  • Allow collaborative development
  • Know who made changes to what
  • Revert changes
  • Build/release management Centralized VCS
  • Commit directly to remote
  • Server has main copy
  • Ex: Subversion Distributed VCS
  • Commit locally, push and pull to remotes
  • No one has main copy
  • Ex: Git What are the advantage of DVCS over Centralized VCS?
  • Can commit locally and push once you're ready
  • Don't need internet connection to commit GitHub Workflow (0. Fork if not part of organization) 1. Clone
  1. Branch
  2. Commit
  3. Pull in branch you want to merge to 5. Push to origin (GitHub)
  4. Make pull request/get feedback 7. Merge pull request
  5. Delete branch Git Branch Split in commit history, lets you work in parallel Git Fork Copy of someone else's repo on GitHub Git Clone Get local copy of repo Git Origin Default remote (GitHub in our case) test bj ;P Git Master Main

branch Git HEAD

Requirements about the functionality of the product Non-Functional Requirement Relate to quality attributes (reliability, testability, efficiency, usability, etc.) What is INVEST? Good user stories are: Independe nt Negotiable Valuable Estimable Small Testable Epic Large feature/user story Why do we need requirements? Need to know what features to focus on, what we don't need to worry about Class Association Most generic kind of relationship. ie. "instructor class" Class Aggregation More specific kind of relationship. "has-a-relationship" or "is a part of relationship". The part can exist independent of the whole. Empty diamond Class Composition Even more specific relationship. "consists-of relationship" or "contains relationship". The part cannot exist independent of the whole. Filled diamond. Generalizatio n is more specific versions of the inherits attributes, associations, & operations from the can override an inherited aspect Be able to read, interpret, modify and create UML activity diagrams Used to model business process, or a single usage scenario or a business rule. Graphical representation of activities or workflow, where the different shapes have different meanings. Black circle represents the start. Rounded rectangles represents actions. Diamonds represent decisions. Black bars represent concurrent activities. 3 C's of a user story

  • Card
  • Conversation
  • Confirmation Be able to read, interpret, modify and create UML class diagrams

behind UI design

  • Users see what they expect to see
  • Users have difficulty focusing on more than 1 activity at a time
  • Easier to perceive a structured layout
  • Easier to recognize something than remember it Persona
  • A fictional character created to represent the different user types
  • Builds empathy with users for developers
  • Make and defend decisions on UI Paper prototyping
  • Hand drawn sketch of UI
  • Depict what system should look like
  • Good to quickly test prototypes with users Name one way of evaluating your paper prototype Have someone who didn't work on it go through the prototype Hi-Fidelity Looks like the real thing Low-Fidelity Keeps only the essence of the design Fault Incorrect portions of code that can lead to a failure instance. Bug Informal way to describe a failure or fault Debugging Process of finding faults Testing Process of finding failures Oracle A device or procedure for determining correctness of a output Error A mistake made by a developer that introduces a fault Why do we test? Demonstrate that software meets requirements Discover bugs in software Black Box Testing Testing without knowing what the code looks like White Box Testing Writing tests while looking at the code, for getting line coverage and stuff Failure Incorrect program behavior that is externally visible UML Behavior Diagrams Depicts the behavioral features of the system or process. i.e. activity, sequence, state machine, use case Be able to read, interpret, modify and create UML state diagrams A state diagram shows the states of an object. Similar to a other State Diagrams, e.g. State Machine.
  1. extract method
  2. extract class
  3. introduce parameter object, stored field, or whole object passed as parameter 4. extract superclass
  4. replace inheritance with delegation 6. inheritance hierarchy
  5. move method
  6. move field
  7. extract superclass 10.collapse hierarchy 11. move in-line class Be able to read, interpret, modify and create UML sequence diagrams A Sequence Diagram is an interaction diagram that shows how processes operate with one another and in what order. They typically model Usage scenarios, Logic of methods, and/or the logic of services. Helpful for understanding asynchronous code. Each actor is represented as a labeled vertical line Each message is a horizontal line, with message name written above line Open arrow heads represent async messages Dashed lines are responses Refactoring changing the code but not the behavior Name 2 characteristics of a good requirement
  • Correct
  • Complete
  • Consistent
  • Unambiguous
  • Relevant
  • Testable
  • Traceable How do you use user stories to make a class diagram? Take the nouns from the card and make them classes. Take the verbs and make those methods within the classes. What is technical debt?
  • a concept in programming that reflects the extra development work that arises when code that is easy to implement in the short run is used instead of applying the best overall solution
  • what refactoring attempts to get rid of The 5 types of code smells
  • Bloaters: oversized code, methods and classes that are difficult to work with
  • OO abusers: incomplete or incorrect application of object oriented programming
  • Change Preventers: changes that require you to make changes elsewhere too

Class-Responsibility-Collaborator, make cards for each class that specifies the responsibility of the class and other classes it collaborates with. Information Hiding The private keyword is used to keep all data hidden. But what if I want to access, or to change, the value outside of a class? We define special methods, getters and setters Only define getters and setters if you need them! SDLC Software Development Life Cycle Involves planning, defining, designing, building, testing, deployment Big Bang Model Develop code Understand requirements as you go ahead Basically, no planning, defining, or designing Waterfall Requirement Analysis System Design Implementation Testing Deploymen t Maintenan ce Pros: Well documented requirements & documentation. Easy to manage phases across teams. Cons: Rigid phases. No working s/w until late stage. Not much reflection or revision. Big Bang Integration at the end Spiral Model

Identification

  1. Design
  2. Construct or build
  3. Evaluation and Risk Analysis Pros: Used for medium - high risk projects, and complex and unclear requirements that need evaluation. Early involvement with system development & users Cons: Management & process is complex. Large number of cycles require lots of documentation. When is end of cycle not always clear Agile Iterations of this cycle for certain stretches of time:
  4. Planning
  5. Requirement Analysis
  6. Designing
  7. Building
  8. Testing Pros: Manage changing requirements. Minimal planning or documentation. Promotes team work & collaboration. Quickly change directions Cons: Overall plan/ agile manager. Cant handle complex dependencies. Iterations determine scope of project. Heavy reliance on personnel

(minimal documentation, newcomer onboarding, customer interaction)

  • Every resource has an individual URI
  • Uniform interface for all resources (GET, POST, PUT, DELETE)
  • The structure of a response is not specified Model View Controller Use when -
  • there are multiple ways to view and interact with the data
  • when future requirements for interaction and presentation of data are unknown Advantages
  • Clear separation of concerns
  • Allows data to change independently of its representation and vice versa
  • Multiple presentations to the same model
  • Single change to model updates all representations Disadvantages
  • Increased complexity, communication
  • Views & controllers are tightly bound Layered Architecture Organizes a system into a subtasks, where each group of subtasks is at a particular layer of abstraction Advantages
  • Layers can be developed independently (and incrementally)
  • Makes reuse easier
  • Makes individual layers interchangeable (as long as interface is same)
  • Layer interactions clearly defined (through interfaces)
  • When layer interface change, only adjacent layers affected Disadvantages
  • It's hard to achieve a clean separation
  • Layers sometimes introduce unnecessary work
  • Performance can be impacted since each layer needs to interpret the service request Event Driven Architecture perform services in reaction to external events generated by other components Advantages
  • Loose coupling
  • More responsive
  • Asynchrony built in
  • Events distributed leads to timeliness Disadvantages
  • Difficult debugging
  • Maintenance overhead (fewer build time validations)
  • Different understanding of events can lead to problems Pipe and Filter Architecture Style Run-time organization of the system. Each step (filter) transforms the data and passes is on to the next step Advantages
  • Easy to understand and matches business processes
  • Filters can be reused/ replaced
  • Ease of debugging
  • Can be sequential or concurrent Disadvantages
  • Format of data transfer has to be agreed a-priori
  • Each transformation must parse its input/ unparse its output in the agreed form
  • Cannot reuse functional transformations that use incompatible data structures
  • Cannot share state between filters
  • Cannot share state between filters Creational design pattern they abstract away the object instantiation (creation) Structural design pattern are concerned with how classes and objects are composed to form larger structures Behavioral design pattern are concerned with algorithms and the assignment of responsibilities between objects Singleton Creational design pattern Intent: ensure a class has only one instance, and provide a global point of access to it. Pros: Easy instance management Cons: It acts like a global variable and shares all the problems associated with them Breaks SRP, as the objects now has to control it's own lifetime cycle Composite Structural design pattern Intent: compose objects into tree structures to

Four elements describe the pattern: The name The purpose; what problem is solves How to solve the problem; the solution The constraints we have to consider in our solution We want them for shared knowledge and shared vocab