SWE Sheet7 NaguiMostafa 20012069
SWE Sheet7 NaguiMostafa 20012069
SHEET 7
1.Using the UML graphical notation for object classes, design the following
object classes, identifying attributes and operations. Use your own experience to
decide on the attributes and operations that should be
associated with these objects.
a) File in a File System
b) Load Job in a Loader that loads CSV files into memory.
c) Playing Track in a MP3 Player
2. Using the tabular notation shown in Figure 7.3 (reference), specify the
weather station uses cases for Report status and reconfigure. You should
make reasonable assumptions about the functionality that is required here.
Use Case: Report Status
1. System:
• Weather Station.
2. Use Case:
• Report Status.
3. Actors:
• Weather Information System.
• Weather Station.
4. Data:
• The weather station sends an announcement to the weather data
framework, providing information about the status of its instruments,
computers, and power supply.
• The main system is the weather station, which sends updated status to the
weather data framework. This information includes the status of equipment,
computer systems, and power supply.
5. Stimulus:
• Establish the connection between the weather data framework and weather
station using satellite communication.
• The weather data framework requests the status information from the
weather station.
6. Response:
• Summarize the information.
• Upload the summarized information to the weather information system.
7. Comments:
• System status is typically requested simultaneously with a weather report.
• Both weather report and system status requests occur simultaneously.
Use Case: Reconfigure
1. System:
• Weather Station.
2. Use Case:
• Reconfigure.
3. Actors:
• Weather Information System.
• Weather Station.
4. Data:
• The weather station receives a specific command from the weather
information system.
• The weather station is placed into remote control mode, where additional
commands are expected from the remote system.
• The remote system updates the weather station system application.
5. Stimulus:
• The specific command is received from the weather information system.
6. Response:
• Ensure that the system is in remote control mode.
7. Comments:
• Used frequently during system updates or installations.
2
3. Draw a sequence diagram showing the interactions of objects in a software
ticketing system. Ticketing systems are used by customers to submit tickets
for bug reports, modification suggestions, or features requests.
3
4. Identify possible objects in an Inventory Management System. As discussed
in lectures, there is no magical way to get the possible objects first time.
You usually perform a few iterations of design. Provide at least two
iterations of your design.
First Iteration:
1. Product:
• Attributes: Product ID, Name, Description, Price, Quantity in Stock, Supplier,
• Operations: UpdateStock(), GetDetails(), SetPrice()
2. Order:
• Attributes: Order ID, Date, Customer Details, Products, Total Cost, Status
• Operations: AddProduct(), RemoveProduct(), CalculateTotal(), ShipOrder()
3. Supplier:
• Attributes: Supplier ID, Name, Contact Information, Products Supplied
• Operations: ViewProducts(), UpdateContactInfo(), TrackDelivery()
4. User:
• Attributes: User ID, Username, Password, Role, etc.
• Operations: Authenticate(), ChangePassword(), AssignRole()
5. InventoryManager:
• Attributes: Manager ID, Name, Contact Information, Managed Products,
• Operations: AddProductToInventory(), UpdateStock(), GenerateReports()
Second Iteration:
1. ProductCategory:
• Attributes: Category ID, Name, Description, TaxRate,
• Operations: AddProduct(), GetProducts(), SetTaxRate()
2. InventoryTransaction:
• Attributes: Transaction ID, Date, Product, Quantity, Type
• Operations: RecordTransaction(), GetTransactionHistory(),
CalculateInventoryValue().
3. Warehouse:
• Attributes: Warehouse ID, Location, Capacity, ProductsStored
• Operations: AddProductToWarehouse(),
MoveProductBetweenWarehouses(), CheckCapacity()
4. Customer:
• Attributes: Customer ID, Name, Contact Information, OrdersPlaced
• Operations: PlaceOrder(), ViewOrderHistory(), UpdateContactInfo()
5. NotificationSystem:
• Attributes: Notification ID, Message, Recipient, Date, Status
• Operations: SendNotification(), ViewNotifications(), MarkAsRead()
4
5. Discuss the advantages and disadvantages of open-source development
projects.
Advantages of Open Source Development:
1. Community Involvement:
• Open source projects can benefit from a large and diverse community of
contributors. This community involvement can lead to rapid bug
identification and fixes, as well as the development of new features.
2. Cost-Effective:
• Open source software is usually cheap or free to acquire. This can
significantly reduce costs for organizations, especially in comparison to
proprietary software.
3. Reliability:
• Widely used open source systems tend to be very reliable. The large user
base often leads to quicker bug discovery and resolution, making the
software robust and stable.
Disadvantages of Open Source Development:
1. Confidentiality Concerns:
• Some companies are hesitant to adopt open source development due to
concerns about revealing confidential business knowledge to competitors.
2. Lack of Formal Support:
• While open source software can be acquired for free, formal documentation and
support may require payment. Some organizations may find this challenging if
they rely on extensive support services.
5
6. Discuss best practices and clean code principles when
implementing/designing the following:
a) Classes
b) Methods
c) Variables
This question was answered based on references :
1. "Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C. Martin
2. "Design Patterns: Elements of Reusable Object-Oriented Software" by Erich
Gamma, Richard Helm, Ralph Johnson, John Vlissides (Gang of Four)
a) Classes:
1. Single Responsibility Principle (SRP):
• Each class should have only one reason to change. It should encapsulate a
single responsibility or functionality.
2. Encapsulation:
• Hide the internal details of the class and expose only what is necessary. Use
access modifiers to control access to class members.
3. Consistent Naming:
• Follow a consistent naming convention for classes. Use meaningful and
descriptive names that reflect the purpose or role of the class.
4. Proper Modularity:
• Break down large classes into smaller, more focused classes. This promotes
better maintainability and understandability.
b) Methods:
1. Descriptive Method Names:
• Choose meaningful and descriptive names for methods. The name should
clearly convey the purpose or action performed by the method.
2. Keep Methods Small:
• Aim for small, focused methods. If a method becomes too long, it may
indicate the need for refactoring or breaking it into smaller methods.
3. Avoid Side Effects:
• Minimize side effects within methods. A method should ideally perform its
task without altering the state of other parts of the system.
4. Method Parameter Considerations:
• Limit the number of parameters a method takes. If there are too many
parameters, consider using an object to encapsulate related data.
c) Variables:
1. Descriptive Variable Names:
• Use descriptive and meaningful variable names. Avoid single-letter variable
names unless they are used in short-lived contexts like loop counters.
2. Avoid Magic Numbers:
• Replace magic numbers with named constants or variables. This enhances
code readability and makes it easier to maintain.
3. Consistent Naming Conventions:
• Follow a consistent naming convention for variables. Choose a style and
adhere to it throughout the codebase.
6
7. For each of the following systems, provide
a) use cases using use case diagrams
b) list of requirements (functional and non-functional
c) the architecture of the system using context diagrams and mention any
architectural patterns used
d) component design for each component in your system using class
diagrams.
a. Bank Queueing System that accepts incoming clients and routes them to the
appropriate bank agent.
§ Use Cases
7
§ Functional Requirements:
1. The system shall register new clients with their basic information.
2. Clients should be able to check in at the bank.
3. The system must intelligently route clients to the appropriate bank agent based on
their needs.
4. Bank agents should be able to view the client's information and transaction history.
5. The system must support various types of transactions (e.g., deposits, withdrawals,
inquiries).
§ Non-functional Requirements:
1. Performance:
• The system should handle a minimum of 100 client transactions per hour.
• Response time for routing clients should be under 5 seconds.
2. Reliability:
• The system should have a 99.9% uptime.
3. Security:
• Client data should be encrypted during transmission.
• Access to client information should be role-based and secure.
§ Architecture of the System Using Context Diagrams
Model-View-Controller (MVC)
8
§ Components
b. Fast Car Rental Service that allows car rental from the closest parking
point a car is parked in to the user and tracks the car path and drop
point.
§ Uses Cases
9
§ Functional Requirements:
1. The system shall allow users to register and log in.
2. Users should be able to search for and rent the nearest available car.
3. The system must track the path of the rented car.
4. Users should be able to return the car to a designated drop-off point.
5. The system must provide a rental history for users.
§ Non-functional Requirements:
1. Performance:
• The system should provide real-time updates on car availability.
• Path tracking should have minimal latency.
2. Reliability:
• The system should have a 99.9% uptime.
• The car tracking system should be accurate within 5 meters.
3. Security:
• User data must be stored securely.
• Transactions and communication should be encrypted.
§ Architecture of the System Using Context Diagrams
Client-Server Architecture
10
§ Components
11
§ Functional Requirements:
1. The system shall control lighting, allowing users to adjust brightness and color.
2. Users should be able to set and control room temperature through the HVAC
system.
3. The system must predict residents' arrival time based on historical data and adjust
appliances accordingly.
4. Security monitoring features, such as camera feeds, door locks, and alarms, should
be available.
5. Users must be able to configure preferences for various home appliances.
§ Non-functional Requirements:
1. Optimization:
• Lighting should be optimized based on sunlight and user preferences.
• Room temperature adjustments should be energy-efficient.
2. Predictive Capability:
• The system should have a reliable predictive capability for residents' arrival
times.
• Appliance preparation should be proactive and efficient.
3. Security:
• Security monitoring should provide real-time alerts.
• Communication with home appliances and systems should be secure and
encrypted.
§ Architecture of the System Using Context Diagrams
12
§ Components
13