# Software Engineering
# WS2020
## Question 1
A company is developing a web-based Auction Management System, allowing buyers and sellers to trade arbitrary items. The system allows registered users to propose new auctions, to place bids for buying items on auctions, to send messages to other users, and to automatically receive news via e-mail.
### a) Write a normal course scenario for the use case Create Auction (actor: Seller) of the Auction Management System.
- Seller logs into the Auction Management System.
- Seller selects the "Create Auction" option.
- System prompts Seller to enter the item details, such as item name, description, starting bid, and end date.
- Seller enters the required information and uploads images of the item.
- System confirms the information and displays a summary of the auction for the seller to review.
- Seller confirms and submits the auction.
- System creates the auction and adds it to the active auctions list.
- System sends an email notification to the seller to confirm the successful creation of the auction.
- Buyers can now start bidding on the auction.
- Seller can monitor the auction and receive notifications for updates such as new bids or messages.
### b) Define additional requirements for the Auction Management System by performing a scenario walkthrough on the normal course scenario. Find one example for each of the following types of requirements:
Performance:
- The system must handle multiple simultaneous auctions and bids without slowing down or crashing.
Attributes:
- The system must validate that the seller has entered all required information before creating the auction.
- The system must ensure that all images uploaded by the seller are in a supported format
Design Constraints:
- The system must allow only registered users to create auctions.
- The system must have a user-friendly interface for sellers to easily create auctions.
External Interfaces:
- The system must interface with email servers to send notifications to users.
- The system must interface with payment processors to handle transactions between buyers and sellers.
---
## Question 2
Explain typical models and tools used in these four quadrants of a feature-oriented product line. Use examples from the web-based Auction Management System to illustrate your explanations.

Full image:

### 1) Domain Analysis
Domain analysis is evaluating a subject area to understand key concepts and identify solutions. It involves research, data analysis, and understanding of the domain's challenges and opportunities. The goal is to inform product development to meet target audience needs.

Common Variability Modeling Notations
### 2) Domain Implementation
Domain implementation is putting domain analysis insights into action, such as developing new or refining existing products/solutions to meet audience needs. The goal is to turn analysis into positive outcomes.
### 3) Requirements Analysis
Requirements analysis is documenting stakeholders' needs to inform product development. It involves defining requirements, ensuring agreement, and using tools. The goal is to ensure the final solution meets stakeholders' needs.
### 4) Product derivation
Product derivation is creating new products from existing ones, to save time and costs. It involves analyzing existing products, understanding the target market, and defining requirements for the new product. The outcome is a well-suited new product.
## Question 3
### a) Explain the meaning of the following five terms in the COCOMO cost estimation report shown below:
**Precedentedness:**
Reflects the previous experience of the organisation with this type of
project. Very low means no previous experience, Extra high means that
the organisation is completely familiar with this application domain.
**Process Maturity:**
Reflects the process maturity of the organisation. The computation of
this value depends on the Capability Maturity Model (CMM). An estimate
can be achieved by subtracting the CMM process maturity level from 5.
**Effort:**
The total amount of time and resources required to complete a software development project. This includes all phases of the project, such as planning, design, coding, testing, and deployment.
**Schedule:**
The estimated length of time required to complete a software development project. The schedule takes into account the effort required, the availability of resources, and any other constraints.
**Development Flexibility:**
Refers to the ability of a software development project to accommodate changes or adjustments as the project progresses. A project with high development flexibility is more adaptable to change, while a project with low flexibility may be more rigid and resistant to change.
(See slides 9, 31)
---
## Question 4
Consider the following class diagram that represents part of an elevator system.

### a) Imagine this class diagram as part of a requirement description. Discuss the various kinds of elements you see in this diagram? Is this a domain-level, design-level, or implementation-level class diagram?
Elements:
- TODO
**Is this a domain-level, design-level, or implementation-level class diagram?** implementation-level
- Access Modifier (private, public)
- Aggregations
- Function Parameters
- Return types
### b) Does this class diagram represent the entire system or are parts missing? If yes, what parts are missing? What more would a design-level/implementation-level class diagram include?
- Fast open/close door
- Special modes (firefighter, sabbath, riot, ...)
- Emergency button
- Fire detection
- Manual override
- Sound ("Going down", "Going up", ...)
### c) What would a UML sequence diagram look like? For example, selecting a floor through the Floor Button assuming that the cage is on a floor below. As it is hard to draw in MOODLE, simply write the interactions – one interaction per line (e.g., instance c:Cage calls d:Door doorOpen; if there are multiple instances, use different instance names)

https://mermaid-js.github.io/
```mermaid
sequenceDiagram
participant Initiator
participant FloorButtonAllocation
participant FloorButton
participant Cage
participant motor
participant door
participant indicator
Initiator->>FloorButtonAllocation: FBAallocateRequest()
FloorButtonAllocation->> Cage: setDirection()
Cage->>Motor: Motorstart()
```

---
## Question 5
### a) Can you explain how software degrades over time?
Legacy code, no comments, no tests, code duplication, ...
### b) Explain fault tolerance. How do you engineer fault tolerant systems?
- Unit/Integration tests
- Security audits
- Backup systems
### c) How does a sequence diagram complement a class diagram?
**Sequence Diagram:**
- A sequence diagram provides a dynamic view of interactions and behaviors between objects in a system.
- Sequence diagrams model the flow of messages, method calls and events in the system.
**Class Diagram:**
- A class diagram provides a static view of classes, attributes and methods in a system.
- Class diagrams define the structure and relationships of objects in the system.
Together, they represent a complete picture of the design of a system.
### d) Why is modeling useful? What can you do with models that you cannot do with code?
Modeling is useful because it provides a high-level, abstract representation of a system or process that can be used for:
- Analyzing and validating system requirements
- Visualizing and communicating complex systems and processes to stakeholders
- Evaluating different design options and making trade-off decisions
- Exploring the behavior of a system and identifying potential issues
**What can you do with models that you can't do with code?**
- Test and refine the design of a system before writing code
- Gain a better understanding of complex systems and relationships between components
- Communicate the design of a system to stakeholders who may not be familiar with the technical details of the code
- Document the design of a system for future reference and maintenance
- Analyze and simulate the behavior of a system in different scenarios without having to write code
### e) List five non-functional requirements?
- Security: the level of protection required for the system and its data
- Performance: the speed, scalability, and responsiveness of the system
- Availability: the percentage of time the system is operational and accessible
- Usability: the ease of use and user experience for end-users
- Maintainability: the ease and cost of maintaining and updating the system over time
### f) Explain the difference between domain classes, design classes, and implementation classes?
- Domain classes: Represent the objects and entities in a specific problem domain or business area. These classes reflect the real-world concepts and relationships in the system being modeled.
- Design classes: Represent the abstract design of the system. They provide a blueprint for the implementation and capture the relationships between domain classes.
- Implementation classes: Represent the concrete implementation of the design classes. They contain the code and logic to perform specific tasks and operations
In summary, domain classes reflect the real-world, design classes capture the design abstractions(e.g. class diagamm,...), and implementation classes represent the code to realize the design.
### g) Give an example that makes software more maintainable?
- Automated Build Piplines
- Unit Test( best case Automated)
- Good comments
- Good Documetation
- Intuitive Structure(using Design Patterens)
- Clean Code
### h) What makes software more user friendly?
- Intuitive interface: The user interface should be easy to understand and navigate, with clearly labeled buttons and menu options.
- Consistency: The software should be consistent in its design and behavior, so users know what to expect and can quickly find what they need.
- Responsiveness: The software should respond quickly to user actions, with fast load times and minimal lag.
- Customization: Allowing users to customize the software to their specific needs, such as adjusting the font size or changing the color scheme, can make it more usable for a wider range of users.
- Help and documentation: Providing clear and accessible help resources, such as online guides, tutorials, and FAQs, can help users get the most out of the software and quickly resolve any issues they encounter.
- Feedback: Providing clear and useful feedback to users, such as error messages and confirmation messages, can help them understand what's happening and what they need to do next.
- Accessibility: Designing the software with accessibility in mind, such as making it usable by users with disabilities, can make it more usable for a wider range of users.
## Question 6
The figure shows the architecture of the KWIC system. Please answer the following questions: (3 points each)

### a) What is the meaning of the lines and boxes? What is such an architecture useful for?
Dotted Lines: System I/O
Bold Arrows: Abstract Pipes
Arrows: Pipes
Boxes: Components
### b) Could you model this architecture with a UML class diagram. Justify your answer!
YES! Because we have certain Components that are in relation to each other i.e. controll/invoke each other.
This kind of stucture can be modeled using the Unified Modelling Language. However, this KWIC architecture is rather abstract, therefore a Domain-/Design-Level UML would best describe the concept the diagram conveys.
**Theoretical argumentation:** Let $x$ be a random program, then there must exist a $y \in UML$ for this program. This is true, because every program can be represented as a class diagram and vice versa. Proof is left as an exercise for the reader.
### c) What would you need to do if you wanted to reuse component Alphabetizer in another project?
The Alphabetizer should have been created with a Modular approach with a perspective of genericity in mind in order to provide the level of abstraction that is required for reuse.
Slides 5 - Page 11

### d) What can you say about coupling and cohesion from this architecture?
Unfortunateley there is a significant amount of coupling due to the fact the components of the System mostly intertwined because it depents on shared data.
Consequently cohesion is rather low because the functionality of the system is scattered around the different Components not inside each Component.
### e) If the component Characters changes then which other components are affected and how are they affected?
Because the system uses shared data all Components dependant on the shared data the Changed component uses, are affected by the change.
----
# WS2019
## Question 1
### a) same
### b) same
### c) Draw two UML sequence diagrams: 1) Selecting a floor through the Floor Button assuming that the cage is on a floor below and 2) Someone causing CageButton state-off during the moving of a cage. Please note that the User (the person using the elevator) should be involved in these diagrams.
TODO
## Question 2
### a) Can you depict a class diagram that reflects the sequence diagrams? Please clearly indicate assumptions you are making and describe them.
TODO: Should be easy
### b) Why do we need two sequence diagrams? Could we have captured both sequences in a single sequence diagram? What is the benefit/drawback?
Each seqence diagram depicts **one** scenario. Which is a reasonable decision in order to assign a sequence diagram to the corresponding scenario.
Because they are 2 different scenarios which require diffrent classes/methods.
However the both diagrams could be fused using an alternate section.
Example: Merged scenarios ([source](https://knowhow.visual-paradigm.com/uml/seq-diagram-combined-fragment/))

### c) Show the implementation of TransactionCoordinator in a Java-like pseudocode. Describe benefits and drawbacks compared to the sequence diagrams
Benefits of SEQ-Diagram: Functionality is dynamically described.
Drawbacks: Structure of Classes is not completely recognizable. (Only used methods...)
```java
class TransactionCoordinator{
checkTransactions(T1,T2){
if(!T1.transactionValid){
return notValid;
}
if(!T2.tranactonValid){
return notValid;
}
return Valid;
}
}
```
## Question 3
### a) same
### b) same
### c) same
### d) same
### e) same
### d) How is re-engineering different from forward engineering?
Forward engineering is making a whole new software. re-engineering means that you re-structure or re-write a part or all of a legacy system(so reuse code).
(Source: Discord)
### g) same
### h) What are the basic messages of the Lehman "laws"?
- Law of Continuing Growth: The computational power of computer systems increases rapidly with time.
- Law of Increasing Connectivity: The number of connections between computational devices increases rapidly with time.
- Law of declining Cost per Instruction: The cost per instruction decreases rapidly with time.
**TLDR**: Lehman's laws of software evolution are principles that describe how software systems change over time. They state that:
1) software systems become increasingly complex over time,
2) the rate of change in software systems is constant,
3) the rate of change in the environment in which software operates is unpredictable, and
4) the maintenance costs of software systems grow over time.
Slides 8 - 49:



Wikipedia: https://en.wikipedia.org/wiki/Lehman's_laws_of_software_evolution?useskin=vector
---
## Question 4
### a) Write a normal course scenario for the use case Arrange Ride of the RSS.
- Log In
- Choose Arrange Ride Option
- Input end location
- Calculate route using current location
- Look for cars wich are near current location, have space and driving part-of or the complete route
- Notify the driver
- Show rider information to driver
- Let driver chose to accept rider
- Arrange pickup
### b) Define additional requirements for the RSS. Find one example for each of the following types:
Performance:
- It should be possible to compute many routes at the same time/ routes calcualtion should be fast
Attributes:
- the login data must be verified
- end locations mut be valid
Design constraints:
- the app should only allow verified drives and riders
- app should only work when logged in
External Interfaces:
- the app should read the correct information from the social media profiles
---
## Question 5
### a) Select 5 of the tests shown in the figure above. Explain the purpose of each test and give a characteristic example of a fault you might discover when performing this kind of test for the RSS.
**Unit Test:** Test a single internal
- Example: Test route calculation
**Integration Tests:** Test if the Components of the System work properly together.
- Example: Test arrange ride
**System Tests:** Tests the whole system as a blackbox.
- Example: Enter random data into the arrange ride view (fuzzing)
**Usability Testing:**
- Example: Give the test to users and track how they are using the app. Improve usability by redesigning the UI/adding additional help.
**Non-functional testing:** Non-functional testing is a type of testing to check non-functional aspects (performance, usability, reliability, etc.) of a software application.
- Example: A good example of non-functional test would be to check how many people can simultaneously login into a software.
- Example: Dashboard should load in 2 seconds
---
## Question 6
### a) same