Midterm Flashcards
(36 cards)
What are design patterns, and how do they improve software development?
Reusable solutions to common problems.
KEY: reusability, maintainability and scalability.
Explain the difference between creational, structural, and behavioral design
patterns. Provide an example of how to use them in software architecture.
Creational: object creation (singleton, factory)
Structural: relationship between entities (adapter, bridge, composite)
Behavioral:how objects interact and communicate (iterator, observer)
Provide examples of at least five different design patterns, specifying whether they
belong to creational, structural, or behavioral categories.
Creational: Singleton, Factory
Structural: Adapter, Bridge, Composite
Behavioral: Iterator, Observer
What are some common violations of the MVC architecture? Provide an example
of how an application could break the MVC pattern
MVC: separate concerns of data management, user interface, an app logic
- fat controller: controller does way too much handling logic and data
- model handling UI
- controller updating view directly
Case Study: Online Food Delivery. A company is building an online food delivery
system. The system needs to:
* Allow customers to browse restaurants and place orders.
* Notify restaurants when a new order is placed.
* Provide real-time order tracking for customers.
Based on this scenario, answer the following questions related to MVC:
a) How would you structure this system using the MVC pattern?
b) Identify the Model, View, and Controller components and describe their roles.
c) How does the MVC pattern help in decomposition, cohesion and coupling in
this system?
a) Model → manages data (menu, orders, tracking)
View → display restaurant list, order details
Controller → handle customer actions (browsing, ordering, tracking)
c) Decomposition: separate features into layers
Cohesion: each layer has a dedicated role
Coupling: loose coupling
What are the SOLID principles, and why are they important in software design?
S: Single Responsibility → 1 class 1 responsibility
O: Open-Close Principle → extend without modifying
L: Liskov Substitution → subtypes should be suitable for their base types
I: Interface Segragation → avoid unwanted dependencies
D: Dependency Inversion: High-level modules are independent on low-level details
Explain the Single Responsibility Principle and provide an example of a violation
and its refactored solution.
- Class should be well defined / specific. Easier to understand and maintain.
Ex: Vehicle class is separate from the navigation class.
How does the Open-Closed Principle contribute to software evolution? Provide an
example.
Open for extension. Closed for Modification.
Prevents breaking old functionality. Reduces bugs and makes future updates smoother.
What is the Liskov Substitution Principle? Why is it important for maintaining
correct software behavior?
Subclasses should be replaceable for their base classes without altering program behavior.
Prevents unexpected bugs by ensuring derived classes maintain expected behavior.
Explain the Interface Segregation Principle and the Dependency Inversion
Principle. How do these two principles complement each other in software design?
ISP → split large interfaces into smaller specific ones
Dependency Inversion → Depend on ABSTRACTIONS not CONCRETE IMPLEMENTATION
They reduce coupling and increase flexibility.
How does violating SOLID principles impact software maintainability?
Leads to tightly coupled, rigid, and hard-to maintain code.
What is software quality, and how is it different from software testing?
Quality: degree to which a product meets requirements / expectations
Testing: identifying defects
What is collaborative quality, and how does teamwork help improve software
quality?
Multiple individuals/teams work together to create and maintain products.
Look at each other’s blind spots and support each other.
What are the differences between black box, white box, and grey box testing?
Provide an example for each.
Black: Test without knowing internal structure
White: tests internal structure
Grey: leverage both black and white
Describe the four primary levels of testing (Unit, Integration, System, and
Acceptance Testing)
Unit → individual code components
Integration → interaction between components like data exchange
System → test ENTIRE system as a whole
Acceptance → validating from a USER’s perspective
What is the difference between system testing and acceptance testing?
System → tests ENTIRE system
Acceptance → ensuring the system meets business/user requirements
What is the difference between regression testing and retesting?
Regression → new changes don’t break existing functionality
Retesting → checking if a specific bug has been fixed
Case Study: Verification vs. Validation. A company is developing a fitness tracking
mobile app. The app must:
* Allow users to log workouts and track calories burned.
* Provide personalized fitness recommendations.
* Work seamlessly on both iOS and Android.
a) What is the difference between verification and validation?
b) Which activities in the software development lifecycle would fall under
verification?
c) Which activities would fall under validation?
a) Verification → ensures software is built correctly
Validation → ensuring software meets user needs
b) Requirement reviews, design reviews, code reviews, unit testing
c) User acceptance testing, beta testing
What is the difference between load testing and stress testing? Provide an
example for each
Load → how system performs under expected user traffic
Stress → Pushes system BEYOND its limits for extreme conditions
What are the key differences between beta testing and A/B testing?
Beta → release entire product to a small group of real users before launch
A/B → compare 2 different versions to see which performs better
What is the difference between usability, accessibility and fairness testing?
Usability → ensure software is easy to user, intuitive
Accessibility → ensure software is usable by people with disabilities
Fairness → Ensure software doesn’t discriminate
What is the role of fairness testing in detecting bias and discrimination in software
Fairness testing ensures software treats all users equally. By detecting bias and discrimination.
When is manual testing preferred over automated testing? Provide examples.
- Usability and UI testing
- cost effective
- When it requires human judgement and intuition
What are the key advantages of automated testing in large-scale software
projects?
- testing efficiency, accuracy and coverage
- faster and reliable for repetitive tasks