Software Engineering · Unit 7 · 5 hrs
Design and Implementation
Exam-focused notes for Design and Implementation (Software Engineering, CSC375): what the TU syllabus asks and how it has actually been tested, with 2 solved past questions from this unit.
Design and Implementation in short
Software design turns a system's specification into a structure a program can be built from, and implementation turns that structure into working, delivered code.
What this unit covers
- Introduction
- Object-Oriented Design using UML
- Design Patterns
- Implementation Issues
- Open-Source Development
Object-Oriented Design using UML
2081 · 10 marks
Draw use case diagram, class diagram and sequence diagram for online book recommendation system. Make your own assumptions.[10]
Show solved answerHide answer
Online Book Recommendation System - UML Diagrams
Assumptions
- Users can register, login, browse books, and receive recommendations
- The system recommends books based on user preferences, reading history, and ratings
- Users can search for books, add them to a wishlist, and rate/review books
- An Admin manages the book catalog and user accounts
- The system interacts with an external Payment Gateway for purchases
1. Use Case Diagram
Purpose: Shows interactions between the system and its environment (actors and use cases), focusing on functional requirements and providing an outside view of the system.
+----------------------------------------------------------+
| Online Book Recommendation System |
| |
| +----------------+ +-------------------------+ |
| | Register | | Manage Book Catalog | |
| +----------------+ +-------------------------+ |
| ^ |
| +----------------+ | (Admin) |
| | Login | +-------------------------+ |
| +----------------+ | Manage Users | |
| | +-------------------------+ |
| v |
| +----------------+ +-------------------------+ |
| | Search Book | | View Recommendation | |
| +----------------+ +-------------------------+ |
| | | |
| v v |
| +----------------+ +-------------------------+ |
| | Rate & Review | | Update Preferences | |
| +----------------+ +-------------------------+ |
| |
| +----------------+ +-------------------------+ |
| | Add to | | Purchase Book | |
| | Wishlist | +-------------------------+ |
| +----------------+ | |
| <<include>> |
| +-------------------------+ |
| | Process Payment | |
| +-------------------------+ |
+----------------------------------------------------------+
[User] -----> (Register, Login, Search Book,
Rate & Review, Add to Wishlist,
View Recommendation, Update Preferences,
Purchase Book)
[Admin] -----> (Login, Manage Book Catalog,
Manage Users)
[Payment Gateway] <----- (Process Payment)
Textual Description of Relationships
| Actor | Use Case | Relationship |
|---|---|---|
| User | Register | Association |
| User | Login | Association |
| User | Search Book | Association |
| User | View Recommendation | Association |
| User | Rate and Review | Association |
| User | Add to Wishlist | Association |
| User | Update Preferences | Association |
| User | Purchase Book | Association |
| Purchase Book | Process Payment | <<include>> |
| View Recommendation | Update Preferences | <<extend>> |
| Admin | Manage Book Catalog | Association |
| Admin | Manage Users | Association |
| Payment Gateway | Process Payment | Association |
2. Class Diagram
Purpose: Shows the static structure of the system - the object classes and associations between them, used when developing an object-oriented system model.
+------------------+ +----------------------+
| User | | Book |
+------------------+ +----------------------+
| - userID: int | | - bookID: int |
| - name: String | | - title: String |
| - email: String | | - author: String |
| - password: String| | - genre: String |
| - preferences: | | - ISBN: String |
| List<String> | | - price: float |
+------------------+ | - rating: float |
| + register() | +----------------------+
| + login() | | + getDetails() |
| + updateProfile()| | + getAverageRating() |
| + logout() | +----------------------+
+------------------+ |
| |
| 1 | 1..*
| |
v v
+------------------+ +----------------------+
| WishList | | Review |
+------------------+ +----------------------+
| - wishlistID:int | | - reviewID: int |
| - userID: int | 1 * | - userID: int |
| - bookList: |<-------->| - bookID: int |
| List<Book> | | - rating: int |
+------------------+ | - comment: String |
| + addBook() | | - date: Date |
| + removeBook() | +----------------------+
| + viewWishlist() | | + submitReview() |
+------------------+ | + editReview() |
+----------------------+
|
| 1
|
v
+----------------------+ +-------------------------+
| RecommendationEngine | | Order |
+----------------------+ +-------------------------+
| - engineID: int | | - orderID: int |
| - algorithm: String | | - userID: int |
+----------------------+ | - bookID: int |
| + generateRecommend()| | - amount: float |
| + updateModel() | | - status: String |
| + fetchUserHistory() | +-------------------------+
+----------------------+ | + placeOrder() |
| | + cancelOrder() |
| uses | + getOrderStatus() |
v +-------------------------+
+----------------------+ |
| BookCatalog | | 1
+----------------------+ +-------------------------+
| - catalogID: int | | Payment |
| - bookList: | +-------------------------+
| List<Book> | | - paymentID: int
| | | - orderID: int |
| | | - amount: float |
| | | - method: String |
| | | - status: String |
| | +-------------------------+
| | | + processPayment() |
| | | + refund() |
| | +-------------------------+
+----------------------+
Key Relationships
| Class | Related Class | Multiplicity | Relationship |
|---|---|---|---|
| User | WishList | 1 to 1 | Composition |
| WishList | Book | 1 to many | Association |
| Book | Review | 1 to many | Association |
| RecommendationEngine | BookCatalog | uses | Dependency |
| Order | Payment | 1 to 1 | Composition |
3. Sequence Diagram (Purchase Book Use Case)
Purpose: Shows the time-ordered sequence of messages exchanged between objects to accomplish a specific use case, useful for understanding dynamic, run-time behaviour.
User BookCatalog Order Payment PaymentGateway
| | | | |
|--selectBook()-->| | | |
| |--getDetails()-| | |
|<--bookDetails---| | | |
| | | | |
|--placeOrder()------------------>| | |
| | |--createOrder-| |
| | | |--processPayment()-->|
| | | | |--validateCard()-->
| | | | |<--paymentApproved--
| | | |<--paymentResult-| |
| | |<--orderConfirmed-- | |
|<--orderStatus("Confirmed")------| | | |
| | | | | |
Flow Description:
- The User selects a book, and the system fetches its details from
BookCatalog. - The User places an order, which
Ordercreates and forwards toPayment. Paymentcalls the externalPaymentGatewayto validate the card and process the transaction.- On success, the payment result flows back through
PaymenttoOrder, and a confirmation is shown to the User.
Summary
The Use Case Diagram captures what the system does from the outside (registering, searching, rating, purchasing, and administering the catalog), the Class Diagram captures the static structure that makes those use cases possible (User, Book, WishList, Review, RecommendationEngine, BookCatalog, Order, and Payment, with their attributes, methods, and relationships), and the Sequence Diagram captures how objects collaborate over time to carry out one specific scenario, purchasing a book, from selection through payment confirmation. Together, these three views give a complete picture of the Online Book Recommendation System's structure and behaviour, which is exactly why UML modelling typically combines a structural view (class diagram), a behavioural/interaction view (sequence diagram), and a requirements view (use case diagram) rather than relying on any single diagram alone.
Design Patterns
2081 · 5 marks
What do you understand by design patterns? What role does it have in object oriented design. [5]
Make Unit 7 stick
Practice CSC375 with flashcards & quizzes