Software Engineering[1]
Software Engineering[1]
Software Engineering[1]
. كل شي هنا من الساليدات خاصة االمثله و الرسمات2024 ملخص مرتب لمادة هندسه برمجيات جزئيه الفاينل
(2, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19)
.دعواتكم لي بالتوفيق
ch2 intro
Topics:
Web-Based Systems:
Accessed via browsers, reducing the need for local installation.
Instant worldwide accessibility.
Advantages (developer perspective on web software):
Faster software delivery, cost reduction, and easy upgrades.
Encourages incremental development methods to deliver software.
Constraints:
Limited by browser capabilities.
Benefits: Pay-as-you-go model, accessible anywhere, and no need for expensive devices.
Principles:
1. Public: Act in the public's interest (e.g., ensure safety and fairness).
2. Client and Employer: Serve clients ethically and protect confidentiality + public interest.
3. Product: Maintain professional standards for quality and testing of their product.
4. Judgment: Ensure integrity and independence in their professional judgment.
5. Management: Promote ethical practices in project management by managers/leaders.
6. Profession: Enhance the reputation and integrity of software engineering+public interest.
7. Colleagues: Support and encourage ethical behavior among colleagues.
8. Self: Commit to lifelong learning and ethical growth.
1. PUBLIC: Software engineers shall act consistently with the public interest.
Examples:
2. CLIENT AND EMPLOYER: Software engineers shall act in a manner that is in the best
interests of their client and employer, consistent with the public interest.
Examples:
3. PRODUCT: Software engineers shall ensure that their products and related modifications
meet the highest professional standards possible.
Examples:
Examples:
Temper all technical judgments by the need to support and maintain human values.
Only endorse documents if prepared under supervision.
Maintain professional objectivity with respect to any software.
Not engage in deceptive financial practices such as bribery, double billing, or other
improper financial practices.
Disclose to all concerned parties those conflicts of interest that cannot reasonably be
avoided or escaped.
Examples:
6. PROFESSION: Software engineers shall advance the integrity and reputation of the
Examples:
Examples:
8. SELF: Software engineers shall participate in lifelong learning regarding the practice of
their profession and shall promote an ethical approach to the practice of the profession.
Examples:
Types of Requirements:
Requirements should be written at different level of details because people who are
interested in reading them have different background (e.g. users, developers).
User requirements: Focus on what the system should do, not how.
System requirements: Want to know exactly what the system will do.
How it will support business processes
Or they are involved in the system development/implementation
Classification of Requirements:
1. Functional Requirements
Define services and functions the system provides.
May include constraints like what the system must or must not do.
it can be:
Vague, unreasonable, contradictory, simply impossible.
Clients may not present what they want technically.
SW engineers need meetings to understand what clients want/need.
Requirements at least need to be complete and consistent when documented.
2. Non-Functional Requirements
Define overall system properties and constraints (all functions ).
Important: The system may not operate if they are absent.
including:
Product Requirements: Specify the constraints on system behaviours.
e.g., timing, efficiency, performance.
Organizational Requirements: Policies, development practices.
External Requirements: Standards, legal, ethical considerations.
the standards they oppose on us.
a university public computer Public access computers are located across university
campuses, and they have access to the internet. The computer should allow users to access
these computers and provide a decent and acceptable internet connection. Each user is
allowed to access the computer for 10 minutes from the start of the session. At the end of
the session, the user is allowed to renew the session for another 10 minutes or exit. Access
renewals should only be allowed three times in a row. The content to which the user can
access should not violate regulations put forward by the government.
functional:
a. The computer should allow users to access the internet.
b. Each user is allowed 10 minutes of access per session.
c. Users can renew their session for another 10 minutes.
d. Access renewals are limited to three consecutive times.
e. The content accessed by users must not violate government regulations.
non-functional:
a. The internet connection should be decent and acceptable.
b. The system must comply with government regulations regarding content access.
c.
Purpose: To document user and system requirements in detail, including (non/fun req).
methods of writing:
1. Natural language.
2. Structured Natural language (preferred).
3. Design description language. (e.g. using programming language )
4. Graphical notations: using models to define functional requirements. (e.g., UML).
5. Mathematical specifications.
Standard Format:
Description, Rationale statement, inputs, outputs, actions, pre-conditions, and post-
conditions.
notes:
use highlight for keyword or important sentences.
Use shall for mandatory
Use should for desirable
clarity when documenting.
SRS Outline:
Requirements Management:
Key Questions:
Outcome: If the answer to any of these questions is "no," it is advisable not to proceed with
the project.
Technical staff works with clients to find services that the system should provide. The stages
include:
1. Unclear Needs:
Stakeholders often provide only general ideas about what they want.
2. Personal Terminology:
Requirements are expressed in terms that reflect the stakeholders' knowledge and
experience.
3. Varied Perspectives:
Different stakeholders have unique and sometimes conflicting requirements.
Engineers must identify all requirement sources, resolve conflicts, and find
commonalities.
4. Political Influences:
Managers may push for specific requirements to increase their influence within the
organization.
5. Dynamic Environment:
Economic and business changes can lead to new requirements.
Additional stakeholders, not initially involved, may introduce new needs.
1.Interviewing Stakeholders
2.Scenarios
Definition: Simulated real-life interactions that describe how the system will be used.
Components:
Expectations at the start of the scenario.
Normal flow of events.
Possible issues or deviations.
Related activities and final system state after completion.
3.Use Cases
Definition: A use case is a method for capturing the functional requirements of a system
through textual or graphical representations of interactions, describing the typical
interactions between actors (users or external systems) and the system using UML diagrams.
Key Characteristics
Captures Functional Requirements: Helps define what the system should do.
Challenges:
Clients may not fully understand or articulate what they need.
Developers may lack context or detailed understanding of system requirements.
Narrative Format: Provides a clear narrative of how the system is used, including:
The basic flow of events in a use case.
Variations or alternative paths where exceptions occur.
System Design Utility: Useful for:
Designing user interfaces.
Clarifying user goals and expectations.
Diagram Elements:
Actors: Represented as stick figures or labeled entities.
Use Cases: Represented as ovals, showing the actions or functions.
Relationships: Use arrows or lines to depict associations, dependencies, or extensions
, include, generalization, between actors and use cases.
System Boundary: Defines the scope of the system within the diagram.
A customer accesses a list of bank services via an ATM connected to a bank. The services
provided are checking balance, withdrawing cash, paying bills, etc. Doing the operation must
be approved by the bank. The ATM handles authentication processes according to bank
authentication. There is a person that must observe any transaction (observer).
4.Ethnography
Requirements Validation
Validation Techniques:
Levels of Architecture:
Architectural Patterns
Draw a software architectural design that shows the main components of the given
description above.
ch10 Software Architecture II
Service-Oriented Architecture (SOA):
SOA Lifecycle:
1. Analysis:
Define stakeholder requirements (new systems) or functionality and infrastructure
(existing systems).
Identify scope of service, likely clients, performance, and availability.
Determine candidate service operations and relevant data structures.
identify candidates input, output, potential faults (informally).
2. Design:
Refine candidates into formal service operations following principles:
Statelessness: Independent transactions for each request.
Abstraction: Hide implementation details from client.
Reusability/Composability: Organize and reuse behavior across operations.
3. Development.
4. Testing:
Assess performance under:
normal conditions: good service performance.
peak conditions: acceptable service performance.
overload conditions: services remains operational (do not crash).
Evaluate performance:
response time.
throughput (e.g. requests per second).
resource usage (CPU, memory).
5. Deployment:
Identify issues not seen in standalone systems.
Distribution and replication of services.
E.g. Fail-over, load balancing behaviour.
Co-existence of multiple versions of the same service.
E.g support clients who have different version that the latest interface.
Run performance tests on deployed services Handle distribution, replication, and
multiple service versions.
6. Administration:
Monitor performance.
dynamically allocate resources.
detect bottlenecks: the capacity of the system under monitoring is limited to a lowest
throughput possible.
Communication/Integration scenario:
1. File-Based Communication:
Data exchanged via files (e.g., postcodes.text).
Issues:
Lag “not real-time”.
file locking: Only one action is allowed in a file.
client scaling challenges
ad-hoc file formats: A and B must agree upon a file format to use.
Housekeeping: clean (big / not needed/ corrupted) files.
2. Common Database:
Shared database allows synchronization and access by multiple clients, Ad-hoc file
format.
Requires housekeeping for maintenance.
3. Sockets:
Enables real-time communication via unique IP and port numbers.
Both client and provider can read/write through sockets.
Features:
Support for different structured data, platform/machine-independent, machine-
readable, text-based format.
Extensible for various applications.
ch11 Software Design I
System Modeling
Definition: A standard graphical notation with 13 diagram types for modeling software
systems.
Common Diagram Types: ()االنواع الي بتجي باالختبار
1. Activity Diagrams: Model activities in a processes or data flows.
2. Use Case Diagrams: model interactions between a system and its environment. Used
for requirements.
3. Sequence Diagrams: model interactions between a system and its environment. Used
for requirements.
4. Class Diagrams: Represent object classes, properties, and relationships between them
in the system..
5. State Diagrams: Show system reactions to events (internal/external).
Context model:
Interaction models:
Sequence Diagrams
Purpose: Illustrate behavior for specific scenarios with time-based object interactions.
Structure:
X-Axis: Objects or actors.
Y-Axis: Time sequence “time frame”.
Arrows show messages, processes, and responses.
Sequence Diagram Guidelines
In the city library, a student can search and pick a book then go to the self-service loaning
machine, which is connected to students’ records. The student must pass the book QR code
over the scanner of the machine. If the student has exceeded 3 books loans, then the system
refuses the request. Otherwise, the book is lent to the student, and the library tracker is
updated with the loaning information (student and book).
ch12 Software Design II
Behavior Models
Data-Driven Modeling
Models the sequence of actions for processing data and generating output “info/ data”.
Key Tools:
Data-Flow Diagrams (DFDs): Represent system processes and their data flows.
Activity Diagrams: Show the control flow between activities.
level 0: Visualize high-level system processes and their interactions with data stores and
external entities.
all external entities must be visible at level 0
Decomposition: Break processes into smaller sub-processes while maintaining integrity
(e.g., consistent inputs/outputs).
The numbering of process must follow parent model
EX: if process 3.2 decomposed, sub process ,use be 3.2.1 , 3.2.2 , ....
levels: context diagram, level 0, level 1, ...
DFD symbols:
Process: a unique name (verb phase), a number and a description for a process.
Data flow, data store, and external entity: a unique name and a description for it.
DFD Rules:
Example of DFD:
Autonomous taxi car is hired by travelers within strictly predefined zones within the city.
Upon hiring, users must provide credentials of all passengers for security check with
database, a single destination address, and payment information. The taxi has limited
availability.
Activity Diagrams
Purpose: Describe processes of systems and its subsystems, Show workflows and control
flows between system activities.
Components:
Nodes: Represent activities (can be composite or elementary actions).
Edges: Represent control flow.
Branching: Conditional paths based on decisions.
Forking/Joining: Synchronize concurrent activities.
Swimlanes: Organize activities by actor or role.
Rules:
has only one income and one outcome arc/edge.
may be composite and it can be further decomposed into sub-activities.
may be elementary and it is referred to as actions.
1. Branching
Simple Flow: The completion of one activity directly starts the next.
Branching Flow: Conditional logic determines which activity is executed next.
2. Forking and Joining
Synchronizes the start or end of activities with others.
Example: Certain tasks in a project cannot begin until others are completed.
3. Swimlanes
Organize activities by actors or roles involved in the process.
Useful for visualizing responsibilities and interactions.
Context: an oven microwave heats or defrost items while its door is closed and the start
button is pressed. A user needs to select/choose desire type and duration of service. Based
on the selection the microwave starts working and displays a countdown on the screen. Draw
an activity diagram that describes the activity above in one perspective: user.
ch13 Software Design “behavioral modeling”
Event-Driven Models
Modeling Tools:
State Diagrams
Provide a state diagram that models a centralized air system according to the following
actions:
Fan model: triggered whenever the user presses the turn on while the system is in
standby mode or called by Cooling and Heating modes
Cooling mode: starts when the room temperature is above the room temperature set up
by customer. Once the temperature reaches or goes below the user temperature the
system goes to fan mode.
Heating mode: starts when the room temperature is less than the user temperature.
Once the temperature reaches or goes above the user temperature the system goes to
fan mode.
Standby mode: initial state of the system, triggered whenever the user presses the turn
off button from any state.
ch14 Software Design “Structural Modeling”
Structural Modeling
1. Class Diagrams:
Represent entities (classes), their properties, and relationships.
Classes are fundamental to object-oriented languages and programs.
they capture the abstract structure of the classes in the system.
they capture the relationships/associations between the classes.
Components “entities” ()فيه رسمه توضيحيه تحت:
Attributes: Define data types (e.g., Integer, Boolean).
Operations: Define functions with parameters and return types.
Relationships: Associations, aggregations, compositions, dependencies, and
generalizations.
Key Features “properties”:
Visibility: + public, - private, # protected.
Non-instantiatable classes:
Abstract Classes: Inherited by other classes, can implement operations.
Interfaces: Provide prototypes for operations only,(can not be gerelized
“inherit”, but can realized “implemented”).
Stereotype of class:
<<interface>> , <<abstract>> , before/above the name of class.
A class can generalize a class or abstract class. But, it can realize an interface.
If a class has a superclass or implements an interface, then:
graphical representation must illustrate that, or textually representation is used
inside of the class.
2. Object Diagrams:
Used to illustrate specific instances of a class diagram during execution.
Object names are underlined, and unnamed instances must have a type.
UML Relationships
UML Generalization:
Definition: Represents inheritance relationships.
Superclass: Parent class.
Subclass: Child class or specifications.
UML allows multiple inheritance (a class can inherit from multiple parents).
represented by: solid line with a hollow triangle.
UML Association:
Definition: Represents a bidirectional relationship between classes.
Multiplicity:
Defines the number of objects participating in the relationship.
Properties in Association:
Associations can have attributes or operations, represented as association classes.
Transformation:
An association class can be converted into an independent class with two
relationships.
Represented by:
Bidirectional: No arrowheads on either side.
Create a class diagram that describes the structure of a store (with name and address)
that contains INF but at least one item (with details name, information, and price). The
store also contains INF order with basic details like list of items and their quantities.
Items can be categorized into three types: appliance, device, and cloth.
All attributes must all be specified as private attributes
Benefits of MDE: Models are easy to be manipulated and transformed and therefore enable:
MDE Concepts:
Models are transformed from independent model to specific models that works
underline systems.
MDE Tasks
2. Model Validation:
3. Model Comparison:
4. Metamodel creation:
5. Model Generation:
1. Duplicated Code
Issue: The same code appears in multiple places.
Solution: Use Extract Method and invoke the method where needed.
2. Long Method
Issue: Difficult to understand and maintain.
Solution: Use Extract Method to simplify and distribute responsibility.
3. Large Class
Issue: A class is handling too many responsibilities or has many variables.
Solution:
Use Extract Class or Extract Subclass.
Remove duplication using Extract Method.
4. Long Parameter List
Issue: Hard to understand and manage.
Solution:
Replace parameters with methods.
Use Introduce Parameter Object.
5. Divergent Change
Issue: A class changes in multiple ways for different reasons.
Solution: Identify related changes and group them using Extract Class.
6. Data Clumps
Issue: Data groups repeatedly appear together in multiple places.
Solution:
Use Extract Class to group them into an object.
Use Introduce Parameter Object to simplify method signatures.
7. Switch Statements
Issue: Duplication and difficulty maintaining multiple switches.
Solution:
Use Extract Method for the switch statement.
Use Move Method with polymorphism when needed.
8. Comments
Issue: Excessive comments may indicate poorly written code.
Solution:
If explaining a block of code, use Extract Method.
If a method still needs a comment, use Rename Method for clarity.
Use comments to explain why something was done, not what.
ch18 Software Testing I
What is Software Testing?
Testing involves executing a program against input data to reveal hidden errors and ensure
correctness.
Goals:
Aim of testing: is to establish confidence that the system is ‘fit for purpose
Software purpose: the level of confidence depends on how critical the software is to an
organisation.
User expectations: Users may have low expectations of certain kinds of software.
Marketing environment: getting a product to market early may be more important than
finding defects in the program
Software Verification
Testing Strategies
1. Automated Testing
2.Component Testing:
3.System Testing
Purpose: Integrate components to create a version of the system and then testing the
integrated system.
Focus:
1. Test interactions between components.
2. Verify compatibility and correct data transfer across interfaces.
3. Assess emergent behavior of the system.
Specialized Testing
1. Release Testing:
Ensures the system is ready for external use.
Focus: Functionality, performance, dependability.
Black-box testing derived from specifications.
2. Regression Testing:
Ensures updates don’t break existing functionality.
it requires automated testing.
test must run successfully before committing any change.
3. Test-Driven Development (TDD) “”فيه رسمه توضيحيه:
An approach to software development in which you interleave (merge) testing and
code development.
Write tests before code.
tests and code are developed incrementally
You don’t move to next increment until the code passes its pre-developed tests.
TDD is essential element in agile methodologies, can be in plan-driven development.
Benefits:
Full code coverage: every code written will have at least one test.
Incremental regression test suite.
Simplified debugging: when a test fail; easy to know where the problem.
Tests double as documentation: describe what the code should be doing.
User Testing:
1. Black-Box Testing:
developers do not necessary know about implementation details to do the testing.
Example: Testing a reused component.
2. White-Box Testing:
developers have access to the code and able to track the execution of a test.
Example: testing to compute code coverage.
3. Grey-Box Testing:
developers have partial access to the code and able to track part of the execution of a
test.
1. Specification-Based Testing:
Tests software against its specifications.
Advantages: Systematic, simpler than implementation.
Drawbacks: Not all specification (like informal ones) can be converted to tests.
2. Model-Based Testing:
Uses behavioral models to generate test cases that can be used to find discrepancies
“ ”التناقضاتbetween actual program behaviour and the model.
4. Boundary Testing:
Testing by choosing inputs that are on semantically-significant (extreme) boundaries
(ends).
Boundary values for: Boolean, Character, Numeric (integer, float, double, ... ), String.
5. Coverage-Based Testing: *
Goal: Achieve pre-agreed coverage levels for class, methods, statements, and paths.
Types:
Statement Coverage: Ensures each statement executes at least once.
Branch Coverage: Tests all decision branches at least once.
Path Coverage: a test suite (collection of test cases), Verifies every execution path
is tested at least once.
Path Coverage > Branch Coverage > Statement Coverage.