Software Engineering Notes (2)
Software Engineering Notes (2)
Software
1. Complexity and Scale: Modern software systems are increasingly complex, requiring
larger teams to manage and develop. This complexity is evident in the size of the
codebase, which can be vast and intricate, supporting various functionalities.
● Examples: Chat servers, email clients, and Electronic Health Record (EHR)
Systems exemplify the complexity and the broad scope of modern software
applications.
2. Diversity of Programs: Software development encompasses a wide variety of
programs, each designed to meet specific needs or solve particular problems. This
diversity necessitates comprehensive associated documentation to ensure proper usage
and maintenance.
3. Wide Application Range: Software finds applications across numerous sectors,
including but not limited to business intelligence, healthcare, and education. This
widespread use underscores the importance of software in modern society and the
need for high-quality development practices.
Bad Software
1. Privacy Concerns: Poorly designed software can compromise user privacy,
exposing sensitive information to unauthorized parties.
2. Security Vulnerability: Vulnerabilities in software can be exploited by
attackers, leading to data breaches and other security incidents.
3. Performance Issues: Bad software can be a performance nightmare, with slow
response times and inefficient resource use affecting user experience.
4. Unwanted Features or Ads: The inclusion of unnecessary features or
invasive advertising can detract from the core functionality and user
satisfaction.
5. Lack of Support and Updates: Without regular updates and support, software
can quickly become obsolete, insecure, or incompatible with other systems.
Software Engineering
1. Definition: Software engineering is defined as the application of a systematic,
disciplined, and quantifiable approach to the development, operation, and
maintenance of software.
● Engineering Approach: This approach emphasizes clarity, predictability,
and quantifiable outcomes, utilizing theories, methodologies, frameworks,
and tools to produce a quality product in a cost-effective manner.
Software Engineering: Layered View
1. Process: The foundation of software engineering, focusing on activities that yield
predictable results.
2. Methods: Techniques employed to carry out specific activities within the
software development process, ensuring efficiency and effectiveness.
3. Tools: Support for both processes and methods, tools facilitate the application
of various techniques in software engineering, enhancing productivity and
quality.
Software Engineering Myths
1. Management Myths:
● Belief that existing standards and procedures are sufficient for all software
development needs.
● Misconception that adding more programmers to a delayed project can help
catch up.
●Outsourcing a project does not absolve the original management from
responsibility; oversight and engagement remain crucial.
2. Customer Myths:
● A general statement of objectives is not enough to commence
development; detailed planning and specifications are necessary.
● Software, while flexible, requires careful consideration and planning to
modify or extend.
3. Practitioner's Myths:
● Completing a program does not signify the end of the developer's job;
maintenance and quality assessment are ongoing requirements.
● Quality can and should be assessed before completion through various testing
and evaluation methodologies.
● The belief that software engineering leads to unnecessary documentation is a
misconception. Proper documentation is vital for maintenance, scalability,
and knowledge transfer, contributing to rather than detracting from efficiency.
Lecture 2
Flexible .
to
Changes:
Easy to
modify
based on
changing
requireme
nts.
Reduces
Risk: Early
prototypes
help
identify
potential
risks.
V-model(requires testing at Rigid & Inflexible: Hard to
each stage ,essential for Early implement changes once
highly test-centered product Defect development starts.
such as medical appliances) Detection: High Cost & Time-
Testing Consuming: Every stage
happens at requires corresponding test
every stage, plans.
reducing Requires Comprehensive
late-stage Documentation: Extensive
errors. documentation increases
workload
Testing Needs Extensive
Clear Resources: More resources
Structure are required for test case
: Well- creation and execution.
defined
phases
make it
easy to
manage.
Ensures
High
Quality:
Each
development
phase has a
correspondin
g validation
phase,
ensuring
reliability.
Easy to .
Track
Progress:
Verificatio
n at each
stage
provides
clear
checkpoint
s.
Works Well
for Mission-
Critical
Application
s: Used in
industries
where
failures can
have severe
consequence
s.
Design
● Architectural design, where you identify the overall structure of the system, the principal
components (subsystems or modules), their relationships and how they are distributed.
● Database design, where you design the system data structures and how these are to be
represented in a database.
● Interface design, where you define the interfaces between system components.
● Component selection and design
Testing:
component testing
● Individual components are tested independently;
● Components may be functions or objects or coherent groupings of these entities.
● System testing
● Testing of the system as a whole. Testing of emergent properties is particularly important.
● Customer testing
● Testing with customer data to check that the system meets the customer’s needs.
Evolution:
Process improvements:
● Process measurement
● You measure one or more attributes of the software process or product. These measurements
forms a baseline that helps you decide if process improvements have been effective.
● Process analysis
● The current process is assessed, and process weaknesses and bottlenecks are identified.
Process models (sometimes called process maps) that describe the process may be
developed.
● Process change
● Process changes are proposed to address some of the identified process weaknesses. These
are introduced and the cycle resumes to collect data about the effectiveness of the changes
Components of Software Development Process
1. Stakeholders:
● Include users, requirement engineers, designers, developers, testers, and
managers, each playing a critical role in the project's success.
2. Process:
● A structured set of activities designed to produce a software product,
with predefined pre and post conditions to guide each phase.
3. Product:
● The final software application, developed to meet the identified requirements
and specifications.
Umbrella Activities
1. User Experience: Ensuring the software is intuitive, accessible, and satisfying for the
user.
2. Quality Assurance: Systematic monitoring and evaluation of the various aspects of
a project to ensure standards of quality are met.
3. Configuration Management: Handling changes systematically to maintain the
integrity and traceability of the configuration throughout the project lifecycle.
4. Project Planning: Defining objectives, scope, procedures, and roles within the
project.
Detailed Software Development Process Activities
1. Planning:
● Identifies the purpose, end-user, key features, and UI/UX
design considerations of the application.
2. Requirement Analysis:
● Involves gathering, analyzing, verifying requirements, and creating a
Requirement Traceability Matrix and Software Requirement
Specification (SRS) document.
3. Design and Development:
● Translates requirements into a workable design, documented in the Design
Document Specification, followed by the actual software implementation.
4. Testing:
● Ensures the software is deployed in multiple test environments for bug
detection and stability before release.
5. Deployment and Maintenance:
● Involves software setup, user training, performance monitoring, and regular
debugging. Maintenance is categorized into:
● Perfective: Enhancements for improving performance or
maintainability.
● Adaptive: Adjusting the software to changes in the environment.
● Preventive: Modifications to prevent future problems.
● Corrective: Fixing identified faults.
Software development process models provide a framework for organizing the activities
involved in creating and maintaining software. These models can be broadly categorized into
plan-driven (traditional) and value-driven (Agile), with specific approaches like incremental
and iterative models offering different strategies for managing development.
Plan-Driven (Traditional) Models
1. Characteristics:
● Rigid Structure: Plan-driven models follow a rigid and linear sequence of
phases, including requirements, design, implementation, testing, and
maintenance.
● Invisibility of Progress: Due to the phase-wise approach, progress can be less
visible until later stages.
● Plan-Centered: Emphasis is placed on detailed planning and documentation
from the outset.
● Phase-Wise Outcome: Deliverables are produced at the end of each phase,
often resulting in a single major release.
● Well-Documented: Extensive documentation is produced throughout the
development process to guide development and ensure compliance with initial
plans.
2. Approach:
● Focus on thorough planning, sequential activities, and achieving a single,
comprehensive outcome.
● Reliance on documented knowledge, aiming to meet both current and future
requirements.
● Suited for larger teams and projects where requirements are well-understood
and changes are minimal.
1. Characteristics:
● Flexible: Agile models are adaptable to changes in project scope or direction.
● Visible Progress: Work is broken down into small, manageable
increments, making progress more visible and measurable.
● Customer-Centered: Prioritizes customer feedback and involvement in
the development process.
● Quick Solutions: Aims to deliver working software quickly and iteratively
to address customer needs.
2. Approach:
● Adopts a variable plan with a series of sprints or iterations, each delivering a
potentially shippable product increment.
● Emphasizes interpersonal knowledge and customer feedback over extensive
documentation.
● Architectured for current requirements, making it ideal for projects where
needs are expected to evolve.
● Generally involves smaller teams focused on rapid delivery and
responsiveness to change.
Incremental vs Iterative Models
● Iterative Model: Focuses on creating a complete project outline, then refining and
improving it through multiple iterations. Each iteration includes planning, design,
coding, and testing phases, allowing for gradual enhancement based on feedback and
evaluation.
● Incremental Model: Builds the final product piece by piece. Each increment is a
portion of the functionality or a working part of the product, delivered over time until
the complete system is finished.
Brief Examples :
● Waterfall Model: A linear and sequential approach where each phase must
be completed before the next begins.
● Scrum: An Agile framework for managing knowledge work, with an emphasis on
software development. It is designed for teams of three to nine members who break
their work into actions that can be completed within timeboxed iterations, called
sprints.
● Spiral Model: Combines elements of both design and prototyping in stages, in an
effort to combine advantages of top-down and bottom-up concept
SCRUM is widely adopted by leading companies due to its iterative and incremental nature,
offering scalable solutions for improved communication and cooperation. It utilizes time-
boxed iterations, known as sprints, typically lasting 1-4 weeks, to manage and complete work
efficiently.
Key Terms:
● Requirement: A statement outlining a need.
● Project: Comprises end-user requirements.
● Sprint: A time-boxed event for achieving specific work, usually 1-4 weeks.
● Project Backlog: The current list of project requirements.
● Sprint Backlog: A subset of the project backlog selected for development in a sprint.
● User Story: A simple description of a software feature from an end-user perspective.
● Tasks: Specific activities required to complete backlog items.
SCRUM Workflow:
● Begins with identifying features to develop, moving tasks through a queue, in
progress, and then to completion, culminating in the feature completion.
Scrum Roles:
● Product Owner: Defines and prioritizes features, decides release dates, and accepts
or rejects project results.
● Scrum Master: Manages the project, ensures adherence to SCRUM values, and
facilitates coordination.
● Scrum Team: Consists of 5-9 cross-functional, full-time members who are
self- organizing. Membership ideally changes only between sprints.
Scrum Meetings:
● Daily Scrum: A quick, stand-up meeting to discuss yesterday's achievements,
today's goals, and any obstacles.
● Sprint Review: An informal meeting to demonstrate new increments to
stakeholders and plan the next steps.
● Sprint Retrospective: A session to reflect on the sprint's successes and areas
for improvement, leading to actionable commitments for the next sprint.
Product Backlog: An ordered list of everything that might be needed in the product,
constantly evolving and serving as a source of requirements for any changes to be made to
the product.
Example of Product Backlog: Imagine a product backlog for a new social media
application, including tasks like "Implement user authentication", "Develop profile
customization features", "Code the news feed algorithm", and "Integrate messaging
functionality". Each item is prioritized based on business value and technical feasibility.
Sprint Backlog Example: A detailed plan for a sprint might include tasks such as coding
user interfaces, developing the middle tier, testing components, writing help documentation,
and implementing specific classes or functionalities. Tasks are assigned daily effort estimates
and adjusted as the sprint progresses.
User Stories
User stories are a fundamental component in Agile methodologies, particularly in Scrum and
XP (Extreme Programming), serving as a simple way to convey user requirements. Here's an
elaboration on the examples provided and an expanded template for writing user stories.
Examples Elaborated:
1. Release Burndown Chart: Tracks the remaining work across the time available for
a release. It helps teams understand how much work is left and whether they are on
track to complete it by the deadline.
2. Story Monitoring: Involves tracking the progress of individual user stories within a
sprint to ensure they are moving towards completion according to the plan.
3. Sprints: Short, time-boxed periods (usually 2-4 weeks) during which a team works to
complete a set amount of work. Monitoring progress within sprints involves daily
stand-ups and updating task boards to reflect current statuses.
Scope Creeping:
when product backlog increaes due to no of features making it tight for the software to be
established in the required time/duration8
Scalable Scrum: Scrum of Scrums
● This approach is used to coordinate multiple Scrum teams working on the same
project. It involves representatives from each team meeting regularly to discuss
progress, dependencies, and impediments, ensuring alignment and integration across
teams.
Kanban
Kanban, originating from Toyota, is a lean agile model that emphasizes visual management of
work through boards, representing the team's current work and workflow. Unlike Scrum, it
does not use time-boxed iterations but focuses on visualizing work, limiting work in progress
(WIP), and facilitating continuous, incremental changes.
Key Principles:
1. Visualize Your Work: Use boards to make work and workflow visible for
easy monitoring, adaptation, and improvement.
2. Limit Work in Progress (WIP): By limiting WIP, teams can reduce cycle times,
prioritize high-value tasks, and minimize multitasking, leading to more focused and
efficient work.
3. Push vs. Pull Work Allocations: In Kanban, work is pulled as capacity allows,
rather than being pushed onto teams, which helps in managing workload and
reducing bottlenecks.
4. Monitor and Improve: Continuous observation of the workflow allows teams to
identify and implement improvements, making the process more efficient over time.
Scrum vs. Kanban
● Scrum is structured around fixed-length sprints and roles, while Kanban is more
flexible, focusing on continuous delivery and not predefined roles.
● Kanban boards may show work selected upfront, to-do lists, and emphasize keeping
queues empty and prioritizing top-priority work, allowing for a flexible, ongoing list
with a focus on limiting WIP to ensure efficiency.
Team Structures
● Small Collocated Teams: Often use Scrum effectively, benefiting from
close communication and quick problem resolution.
● Large Distributed Teams: May find Kanban or a hybrid model more suitable due
to its flexibility and emphasis on visual management, which can help coordinate
complex workflows across different locations.
XP involves twelve key practices, extended in various ways to support its principles,
including:
● Iterative Development: Delivering new versions possibly several times a day to
ensure rapid feedback and continuous improvement.
● Increments: Working in increments with releases every two weeks, allowing
for regular review and adaptation.
● Test-Driven Development (TDD): Writing tests before code to ensure each feature
is tested and functions as expected.
Lecture 4
Waterfall Model
Overview:
● The Waterfall model is a sequential approach that divides the project into distinct
phases: specification, development, testing, and maintenance. Each phase must be
completed before moving to the next.
● It emphasizes a linear and plan-driven process, requiring thorough planning and
scheduling before project initiation.
Advantages:
● Inflexibility: Offers limited flexibility for accommodating changes once the project is
underway, which can lead to challenges if requirements evolve.
● Late Feedback Incorporation: Customer feedback is integrated only at the end,
potentially resulting in a final product that may not fully meet customer expectations.
SWOT Analysis:
● Strengths: Clear, well-documented requirements and a structured approach
aid effective management.
● Weaknesses: Limited flexibility for changes and late detection of defects.
● Opportunities: The methodical structure is advantageous for managing large-scale
or safety-critical projects where stability is paramount.
● Threats: Potential for late discovery of issues, leading to costly revisions.
Applicability:
● Suitable for projects where requirements are well-defined and unlikely to change,
such as large-scale, safety-critical applications, or when a high degree of oversight is
needed.
Prototype Model
Overview:
● Involves developing a working prototype early in the development process to gather
user feedback and refine requirements. This model is especially beneficial when
project requirements are unclear or expected to change.
Types:
1. Throw-away Prototype: A preliminary model built to understand
requirements, which is discarded once its purpose is fulfilled.
● Example: A simple mock-up of a new application's user interface to
gather initial feedback before full-scale development.
2. Evolutionary Prototype: Continuously developed and refined based on user
feedback until it becomes the final product.
● Example: Developing a web application's core functionality and enhancing it
iteratively based on user testing.
3. Incremental Prototype: Combines elements of the final system developed in
increments, allowing testing and refinement of each part before moving to the next.
● Example: A complex system where individual modules are prototyped
and then integrated to form the complete system.
4. Extreme Prototype: Used mainly for web development, where the process starts with
a static mock-up, evolves into a functional prototype, and ends with the
implementation of the final solution.
● Example: Creating a static website layout, followed by adding dynamic
elements and backend functionality in stages.
Advantages:
● User Involvement: Ensures early and continuous user feedback, leading to higher
satisfaction and a product that aligns with user needs.
● Understanding and Refinement: Facilitates a deeper understanding of user
requirements and allows for early identification and correction of design flaws.
● Design Flaw Identification: Early prototype testing helps uncover and address design
issues, reducing later rework.
Limitations:
● Documentation and Maintainability: Rapid development may neglect thorough
documentation and long-term maintainability.
● Scope Creep: The iterative nature risks expanding project scope and timelines if not
carefully managed.
SWOT Analysis:
● Strengths: Direct user feedback and the ability to refine the system based on that
feedback enhance user satisfaction.
● Weaknesses: Potential for poor maintainability due to the focus on rapid
prototype development.
● Opportunities: Prototyping offers a unique opportunity to refine the system
continually based on user input.
● Threats: The iterative development process may lead to project delays if scope creep
is not controlled.
Overview: The Spiral model is a sophisticated, risk-driven process model that integrates the
linear progression of the Waterfall model with the flexibility of iterative and incremental
development models. It's designed to accommodate complex projects by incorporating
thorough risk analysis and iterative enhancements within a structured framework.
Process:
1. Objective Determination: Identifying project goals and alternative solutions.
2. Risk Identification and Resolution: Analyzing potential risks at each phase
and developing strategies to mitigate them.
3. Development: Iteratively developing the next version of the product, incorporating
lessons learned from the risk analysis.
4. Review: Assessing the current phase's outcomes and planning for the next cycle.
Advantages:
● Risk Management: Proactively addresses risks throughout the development process,
allowing for timely adjustments.
● Adaptability: Capable of accommodating changes and refining the product based on
evolving customer feedback and project requirements.
Limitations:
● Cost: Potentially expensive due to the iterative nature and the need for ongoing risk
assessment.
SWOT Analysis:
V- model
Advantages:
● Quality Assurance: Ensures a high-quality product through systematic testing at
each phase.
● Early Defect Detection: Facilitates the identification and resolution of defects early
in the development process.
Limitations:
● Inflexibility: Struggles to adapt to changing requirements or project scope
adjustments.
● Potential Delays: The parallel development and testing phases can introduce delays if
issues are discovered late in the process.
SWOT Analysis:
● Strengths: High-quality deliverables due to integrated testing.
● Weaknesses: Lack of flexibility and potential for project delays.
● Opportunities: Early detection and resolution of defects.
● Threats: Delays and increased costs due to rigid structure and extensive testing
requirements.
Examples of Requirements
● User Requirement: The system shall accurately compute sale totals, print
receipts, and update inventory counts.
● System Requirement Examples:
● Sales transaction identification.
● Association of sales items with sales IDs.
● Rebate processing within sales transactions.
● Single receipt printing per sale.
Q1: What is a use case, and how does it help in requirement documentation?
➡ A use case is a structured description of how a user (actor) interacts with a system to
achieve a goal. It helps document functional requirements clearly, ensuring all stakeholders
understand system behavior.
Q2: How does use case-based requirement engineering assist in designing object-
oriented software?
➡ Use cases identify system interactions, which help in defining:
✔ Classes & objects needed.
✔ Methods & attributes for each class.
✔ System behavior & workflows.
Q5: List and explain three UML diagrams other than use case diagrams.
✔ Class Diagram – Represents system classes, attributes, and relationships.
✔ Sequence Diagram – Shows object interactions over time.
✔ State Diagram – Represents state transitions of an object.
Q6: How do use cases help in writing Software Requirements Specification (SRS)?
➡ Use cases serve as a foundation for functional requirements in an SRS by
defining:
✔ Actors, system behavior, and flows.
✔ Preconditions & postconditions.
✔ Exceptions & alternate scenarios.
Symbol Description
Arrow
Q8: What is the difference between primary actors and secondary actors in a use case
diagram?
➡ Primary Actor: Initiates interaction (e.g., Customer).
➡ Secondary Actor: Supports system operations (e.g., Payment Gateway).
Q10: How do actors in a use case relate to system functionalities? Give an example.
➡ Actors interact with use cases to achieve their goals.
✔ Example: Customer ➡ "Place Order" in an e-commerce system.
Q12: Differentiate between include and extend relationships with suitable examples.
Q13: Identify whether the following statements represent Include or Extend relationships:
Q15: Explain why the Extend relationship should be used sparingly in use case
diagrams.
➡ Extend relationships make diagrams complex and harder to maintain.
📌 Example:
👤 Hacker ➡ «threatens» Obtain Password ➡ Login System
Q28: Given the following security threats, create a misuse case for each:
✔ Hacker stealing user credentials
👤 Hacker ➡ «threatens» Brute Force Attack ➡ Login
Q32: When should an Agile team use user stories instead of use cases?
✔ When requirements are high-level & iterative.
Q37: Identify potential misuse cases for an ATM machine and provide mitigation
strategies.
✔ Misuse Case: Hacker attempts to steal PINs
✔ Mitigation: Implement Two-Factor Authentication
In place of include comes extends if the relationship is optional btw use cases like discount
stuff in the payment method.
Steps for Drawing a Sequence Diagram
○ Represent each actor & object with a vertical dashed line (lifeline).
○ Label each lifeline at the top.
3. Add Messages (Interactions)
○ Use solid arrows (→) for synchronous messages (caller waits for response).
○ Use dashed arrows (--> ) for asynchronous messages (no waiting).
○ Label each message with a verb (e.g., "Validate User").
4. Indicate Activation Bars
○ Use Alt (Alternative), Opt (Optional), or Loop boxes for conditions &
loops.
7. Review & Optimize
Perspective Description
📌 Diagram Mentioned:
✔ Mentcare System Context Model – Example of external system dependencies.
System Boundaries:
📌 Diagram Mentioned:
✔ Mentcare System Context Model (Defining boundaries & external systems).
5. Interaction Models
● Interaction models focus on system-user and system-system interactions.
● Helps in detecting communication issues & performance problems.
📌 Diagrams Mentioned:
✔ Use Case Diagrams (models how users interact with the system).
✔ Sequence Diagrams (visualizes event flow between components).
📌 Diagram Mentioned:
✔ Mentcare System Use Case Diagram (e.g., Transfer Data Use Case).
6. Sequence Diagrams
● Models event sequences & object interactions in a system.
● Helps understand workflow execution in detail.
📌 Diagrams Mentioned:
✔ View Patient Information Sequence Diagram
✔ Transfer Data Sequence Diagram
7. Structural Models
● Used to represent system architecture & relationships.
● Includes static (design-time) & dynamic (execution-time) models.
📌 Diagrams Mentioned:
✔ Class Diagrams – Shows objects & their relationships.
✔ MHC-PMS Class Diagram – Example from Medical Healthcare System.
8. Behavioral Models
● Shows how a system reacts to external/internal events.
● Includes:
1. Data-Driven Models – Focus on data processing & workflows.
2. Event-Driven Models – Models real-time event responses.
📌 Diagrams Mentioned:
✔ Insulin Pump Activity Diagram (Example of data-driven modeling).
✔ Microwave Oven State Diagram (Example of event-driven modeling).
📌 Diagrams Mentioned:
✔ MDA Transformations (Shows Model-Driven Architecture process).
✔ Multiple Platform-Specific Models (Mapping system models to platforms).
✔ Pros of MDE:
✔ Reduces manual coding effort.
✔ Allows higher-level system abstraction.
✔ Cons of MDE:
❌ Requires specialized tools.
❌ Not widely adopted due to complexity & high cost.
Class diagramms:
visibility notation:
○ + for public (visible to all classes)
same
benefits of class diagrams:
● Class diagrams represent the system’s classes, attributes,
architecture.
component connectivity.
Here's a summarized version of your readings for the System Modeling exam in a structured
bullet format:
● OOAD Process: Helps analyze project requirements and design an efficient system
before coding.
● UML (Unified Modeling Language): A widely accepted graphical language for
OOAD.
● Key Steps:
○ Define system requirements.
○ Identify system components (classes, objects).
○ Model interactions using UML diagrams.
● Use Case Diagram: Represents how external users (actors) interact with the system.
● Class Diagram: Shows system components (classes) and their relationships.
● State Machine Diagram: Models object states and transitions.
● Activity Diagram: Represents the sequence of operations performed by objects.
● Sequence Diagram: Shows interactions between objects in a specific sequence.
1. Layered Architecture
4. Architectural Decisions
● Two types of decisions:
○ High-Level Decisions (Overall structure, interaction model).
○ Low-Level Decisions (Technology stack, implementation details).
● Factors influencing decisions:
○ Scalability & Performance: Load balancing, caching.
○ Security Considerations: Authentication, encryption.
○ Maintainability & Modifiability: Ease of updates & extensions.
○ Reliability & Fault Tolerance: Redundancy, failover mechanisms.
● Definition: A class should be open for extension but closed for modification.
● Explanation:
○ You should be able to add new functionality without modifying existing
code.
● Example:
○ Bad Design: Adding new file formats requires modifying a FileParser
class.
○ Good Design: Use polymorphism with an abstract Parser class and extend
new formats.
● Benefits:
○ Reduces regression bugs.
○ Improves code maintainability.
● Definition: A class should not be forced to implement methods it does not use.
● Explanation:
○ Large interfaces should be split into smaller, specific ones.
● Example:
○ Bad Design: A Printer interface with print(), scan(), and fax(),
forcing simple printers to implement unnecessary methods.
○ Good Design: Separate Printable, Scannable, and Faxable
interfaces.
● Benefits:
○ Avoids unnecessary dependencies.
○ Improves code clarity.
Polymorphism
● Allows one interface, multiple implementations.
● Example: Different shapes (Circle, Square, Triangle) implementing a
common draw() method.
Flexibilit Less flexible (fixed method More flexible (polymorphism allows different
y calls) behaviors)
lecture 12:
DEsign principles:
1)Meangingful names:Use descriptive, intention-revealing names.
6)
7)
Avoid Duplication
● DRY (Don't Repeat Yourself)—avoid repeating the same logic in multiple places.
● Extract common logic into reusable methods or utility classes.
● Use constants instead of repeating hardcoded values.
lecture 13:
2⃣ UI Design Objectives
4⃣ Role of UI in Software
1. User Analysis
2. System Prototyping
3. Interface Evaluation
🔟 Key Takeaways
✅ A good UI = better user experience (UX).
✅ Simplicity and clarity improve usability.
✅ UI should be tested and refined iteratively.
✅ User-centered design ensures better adoption and satisfaction.
Definitio The visual and interactive The overall experience of a user while
n elements of a system. using a product.
Focus Looks and feel – Ensures the interface Usability and satisfaction – Ensures
is visually appealing and functional. users can achieve their goals smoothly.
Include Colors, typography, buttons, layouts, Navigation, user journey,
s animations, icons, and responsiveness. accessibility, efficiency, and
emotions.
Goal Make the interface intuitive and Make the product user-friendly,
aesthetically pleasing. efficient, and enjoyable.
lecture 14:
1. Factory Method – Defines an interface for object creation but lets subclasses decide
the concrete class.
13. Chain of Responsibility – Passes a request along a chain of handlers until one
processes it.
● Example: Logger passes logs to ConsoleLogger, FileLogger, or
EmailLogger.
14. Command – Encapsulates a request as an object, allowing undoable operations.
● Example: RemoteControl executes LightOnCommand or FanOffCommand.
15. Interpreter – Defines a language grammar and interprets sentences in that language.
● Example: ExpressionParser evaluates mathematical expressions like 3 + 5 *
2.
16. Iterator – Provides sequential access to elements of a collection without exposing its
structure.
● Example: TreeSet<Integer>.iterator() iterates through elements.
17. Mediator – Centralizes communication between multiple objects to reduce
dependencies.
● Example: ChatRoom mediates messages between users.
18. Memento – Captures and restores an object's state for undo functionality.
● Example: Game.saveState() stores progress and Game.loadState() restores
it.
19. Observer – Defines a dependency between objects so that when one changes, all
dependents are notified.
● Example: StockObserver updates when StockPrice changes.
20. State – Allows an object to change behavior based on its internal state.
● Example: CeilingFan switches between Off, Low, Medium, High states.
21. Strategy – Defines a family of interchangeable algorithms encapsulated in separate
classes.
● Example: SortContext switches between BubbleSort and QuickSort.
22. Template Method – Defines a skeleton algorithm in a base class, allowing subclasses
to override specific steps.
● Example: DataProcessor defines load(), process(), save() while
subclasses implement process().
23. Visitor – Adds operations to objects without modifying their classes.
● Example: TaxCalculator visits Product to compute tax.