SWE30003 Ass2 Group1
SWE30003 Ass2 Group1
ASSIGNMENT 2
Assignment 2 2
Executive Summary
This document presents the object-oriented design for the Online Healthy Foods Store, building upon
the case study introduced in Assignment 1. The objective is to formulate an initial software
architecture that aligns with the principles of Responsibility-Driven Design. The design aims to
establish a robust foundation for the subsequent detailed design and implementation in Assignment
3. Throughout this document, a comprehensive list of candidate classes, their interrelationships, and
the bootstrap process for initializing the Online Healthy Foods Store are delineated. The use of CRC
cards facilitates a detailed exploration of each class, outlining their responsibilities and collaborators.
Additionally, the design solution is subjected to critical evaluation in terms of its quality, adherence to
design heuristics and patterns, and fulfillment of system responsibilities. This executive summary
provides a succinct overview of the subsequent sections, offering a glimpse into the holistic approach
adopted in crafting the object-oriented design for the Online Healthy Foods Store.
Introduction
The introduction sets the stage by revisiting the case study introduced in Assignment 1, emphasizing
the need for a meticulous design of the Online Healthy Foods Store. In addressing the complex
requirements of the food retailer, this assignment endeavors to provide an initial object-oriented
design that adheres to the principles of Responsibility-Driven Design. The document outlines the
overarching problem addressed, namely, the formulation of a coherent and effective software
architecture for the Online Healthy Foods Store. The outlook of the solution involves a strategic
identification of candidate classes, their responsibilities, and the interplay between them.
Problem
The Online Healthy Foods Store faces the challenge of establishing an online presence that facilitates
the purchase of healthy food items while ensuring efficient management of inventory, orders, and
user accounts. The system must accommodate the diverse needs of users, ranging from browsing
products to placing orders, while also providing administrators with tools to oversee operations and
maintain the integrity of the platform.
Outlook of Solution
The solution involves the meticulous design of classes and their interactions to encapsulate the core
functionalities of the Online Healthy Foods Store. By adopting Responsibility-Driven Design
principles, the aim is to identify the key responsibilities of each class and define clear collaborations to
ensure seamless integration and operation of the system. The design solution emphasizes modularity,
scalability, and flexibility to accommodate future enhancements and changes in user requirements.
Additionally, it leverages UML diagrams and CRC cards to provide visual representations and detailed
descriptions of the system components, aiding in the understanding and communication of the design
to stakeholders.
Assignment 2 3
Assumptions
In formulating the object-oriented design for the Online Healthy Foods Store, several assumptions
underpin the decision-making process. These assumptions serve as foundational elements to
streamline the design approach and provide clarity to stakeholders.
1. User Interaction: The design assumes a reasonable level of user familiarity with online
shopping interfaces. Basic user navigation skills and an understanding of standard e-commerce
practices are anticipated.
2. Data Security: It is assumed that the Online Healthy Foods Store will operate in a secure digital
environment. Basic security measures, such as data encryption and secure user authentication,
are presumed to be in place.
3. Unique Identifiers: Each product has a unique identifier within the system for tracking and
management purposes.
4. Product Attributes: All products are characterized by essential information such as name,
description, price, availability, and quantity.
5. Sales Cycle: Products may undergo various transactions, including purchases by customers,
returns, and subsequent resale.
6. Sales Transaction Specifics: Each product sale involves one product, one invoice, one customer,
and one salesperson.
7. Customer Information: Customers are required to provide necessary details like name,
address, and contact information for order processing and communication.
8. Customer Identification: New customers receive a unique customer ID upon their initial
purchase.
9. System Registration: All entities, including customers, salespersons, products, orders, and
payments, are registered within the system.
10. Customer Details: Each customer account includes a unique ID, name, address, and contact
information.
11. Return Policy: Customers can initiate returns or exchanges for products, subject to predefined
return conditions.
12. Product Availability: A product may be available in both new and used conditions, depending
on supplier inventory and condition.
13. Sales Volume: The system accommodates a substantial volume of daily transactions, reflecting
the popularity of healthy food choices.
14. Product Condition: Products are categorized as new or used based on supplier sourcing and
inventory status.
15. Payment Terms: Customers can choose from various payment options, including upfront
payments, instalments, or payment upon delivery.
16. System Security: The system operates within a secure environment, ensuring the
confidentiality and integrity of customer and payment information without the need for
extensive encryption measures.
Assignment 2 4
Evidence of Problem Analysis
Problem Analysis
The object-oriented design presented for the Online Healthy Foods Store incorporates a robust
problem analysis, demonstrating a comprehensive understanding of the challenges and requirements
outlined in the case study. The submission delves into the intricacies of the problem domain, ensuring
a thoughtful and informed approach to the design solution.
1. User Needs and Behaviors: The analysis begins by identifying and analyzing the needs and
behaviors of potential users of the Online Healthy Foods Store. This includes considerations
such as user preferences, shopping habits, and expectations from an online healthy food
platform.
Simplifications
To streamline the design process and manage complexity, certain simplifications were made during
the problem analysis phase. These simplifications are strategic decisions aimed at ensuring a focused
and achievable design within the given constraints.
By documenting these simplifications, the design maintains transparency regarding the chosen focus
areas and provides a clear rationale for deferring certain complexities to later stages of the design
process.
Assignment 2 5
Candidate Classes
Candidate class list
1. Product
2. Account
3. Order
a. CompletedOrder
b. CanceledOrder
4. ShoppingCart
5. User
6. Invoice
7. Receipt
8. Payment
9. Catalog
10. SaleStatistics
Managers:
11. CatalogManager
12. ProductManager
13. InventoryManager
14. ShoppingCartManager
15. AccountManager
16. Administrator
Processes:
17. Shipment
18. Refund
Services:
19. NotificationService
20. AuthenticationService
Assignment 2 6
UML Diagram
Justification
The chosen classes represent the core components of an e-commerce system, each fulfilling a crucial
role in ensuring its functionality and efficiency. The ‘‘Product’‘ class serves as the cornerstone,
encapsulating essential information about items available for sale. ‘‘Order’‘, ‘‘CompletedOrder’‘, and
‘‘CanceledOrder’‘ handle transactional aspects, tracking purchases, and providing necessary details
for order management and reporting. The ‘‘ShoppingCart’‘ class facilitates the user's shopping
experience by managing selected items and calculating costs. ‘‘User’‘ and ‘‘Administrator’‘ classes
oversee user-related processes and system administration, respectively, ensuring smooth operations.
‘‘InventoryManager’‘ and ‘‘ProductManager’‘ handle inventory and product-related tasks, ensuring
accurate representation and availability of products. ‘‘Invoice’‘, ‘‘Payment’‘, and ‘‘Receipt’‘ classes
manage financial transactions, documenting purchases, and providing users with transaction details.
‘‘StatisticsReport’‘ offers insights for decision-making based on collected data. ‘‘UserManagement’‘
and ‘‘AuthenticationService’‘ ensure proper user access and authentication. ‘‘NotificationService’‘
keeps users and administrators informed about system events, while ‘‘Refund’‘ manages refund
Assignment 2 7
processes. ‘‘Shipment’‘ tracks shipping details, and ‘‘Catalog’‘ provides comprehensive product
listings. Finally, ‘‘CatalogManager’‘ oversees catalog operations, ensuring accurate product
representation. Together, these classes form the backbone of an e-commerce system, enabling
seamless user experiences and efficient system management.
CRC Cards
Class Name: Product
Super Class: -
Represents a product available for sale in the system. Stores essential information
about the product, such as its name, description, price, and quantity. Manages
product data and attributes to facilitate sales and inventory management.
Responsibilities Collaborators
Knows name, description, price,
availability and quantity
Knows product status and attributes ProductManager
Assignment 2 8
Class Name: ShoppingCart
Super Class: -
Represents a shopping cart in the system. Stores items added by the user for potential
purchase and manages items in the cart. Calculates the total price of items in the cart.
Responsibilities Collaborators
Stores items added by the user for Product
potential purchase
Manages items in the cart and calculates User
the total price
Responsibilities Collaborators
Manages system administration. System
Assignment 2 9
Class Name: ProductManager
Super Class: -
Manages responsibilities related to inventory management within the system, such as
monitoring inventory levels, restocking, and making adjustments as necessary.
Responsibilities Collaborators
Handles product creation, modification, Administrator
and deletion
Manages product data and attributes Administrator
Assignment 2 10
Class Name: SaleStatistics
Super Class: -
Represents a class responsible for providing statistical data and insights about orders
and sales within the system.
Responsibilities Collaborators
Generates statistical reports based on the Order
collected data
Assignment 2 11
Class Name: Refund
Super Class: -
Manages the refund process for canceled orders, ensuring that users receive
appropriate refunds for their canceled purchases.
Responsibilities Collaborators
Initiates refund transactions for canceled CanceledOrder
orders.
Assignment 2 12
Design Quality
Design Heuristics
Open/Closed Principle Account User and Administrator all derived from Account,
(OCP) Administrator so if we want to add a new functionality, such as
User Manufacturer (in case there is a third party that
Description: want to sell their product through the system),
Classes are open for then this class is a newly added one, deriving
extensions through from Account, and we don’t have to modify
addition of classes, but existing classes
not modification of
existing classes
Liskov Substitution Account Administrator and User all derive from Account,
Principle (LSP) Administrator and they keep the behavior of the base class:
User require authentication to login and manage
Description: content of that account. However the subclass
Derived class can be have extended features, for example the
extended from base Administrator can manage
class without changing ShoppingCartManager class and interact with the
behavior, affecting the System class
program or system
Order CompletedOrder and CancelledOrder all derived
CompletedOrder from Order, and have similar behavior such as
CancelledOrder being able to trigger NotificationService.
However, the CancelledOrder have an extension
of being able to trigger Refund.
Assignment 2 13
Dependency Inversion Account The AuthenticationService and
Principle (DIP) Administrator AccountManagement interfaces is dependent on
User the base class Account instead of its 2 subclasses
Description: AuthenticationService Administrator or User.
High-level modules AccountManagement
should depend on
abstractions, instead of
details
Law of Demeter (LoD) ShoppingCart User does not directly access the Products, but it
User access through the List<Product> attribute of the
Description: Product ShoppingCart class.
Interactions with
neighbor components
to avoid complex
coupling
Encapsulation All classes All data unique to a class should be kept hidden
inside of that class.
Patterns
Strategy Pattern
Assignment 2 14
AccountManagement and AuthenticationService are the 2 interfaces implemented to the ‘’Account’’
base class, which means that the 2 derived classes ‘’Administrator’’ and ‘’User’’ will be given specific,
different way of behaving.
This approach allow the creation of a range of subclasses with a lot of commonalities by reusing the
methods and classes, while also allowing each subclass to have extended features:
• The ‘’CompletedOrder’’ and ‘’CancelledOrder’’ inherit their relationship with
‘’NotificationService’’, ‘’User’’, ‘’ShoppingCart’’,.. From the ‘’Order’’ class, but also having
specific relationship: Association with ‘’Shipment’’ class for ‘’CompletedOrder’’ and ‘’Refund’’
class for ‘’CancelledOrder’’ class.
This approach ensures that a class has only one instance and provides a global point of access to that
instance. This facilitates controlled access, reduces memory occupation, and only require initialization
for once. For example, there is only 1 instance of the ‘’Catalog’’ class.
Observer Pattern
The Observer Pattern is exemplified by the ‘NotificationService’ class within the system architecture.
Acting as a subject, ‘‘NotificationService’‘ notifies observers, such as users and administrators, of
system events like successful transactions and order status updates. In adherence to the Observer
pattern, observers subscribe to receive notifications from the subject, ‘‘NotificationService’‘, and are
subsequently informed when relevant events occur.
Bootstrap Process
Verification
The proposed approach was validated by simulating many use cases indicated below.
The system begins with the administrator querying available products. Upon request, the Product
integrates with the Inventory Manager. Admin then interacts with the Product Manager to add and
retrieve product descriptions. Following this, Admin categorizes products with the Catalog Manager.
Depending on uniqueness, the Catalog Manager either employs machine learning for categorization
or assigns existing categories. If matched, tags are bound to the product.
Assignment 2 16
Generate sale statistical report
The system facilitates online access for a healthy food store's admin to retrieve sales reports. Upon
request, the Sales Statistic module prompts the system's Authentication Service for authentication.
The admin provides credentials, and the system either grants or denies access. Once authenticated,
the Sales Statistic module generates and delivers the requested sales report to the admin.
Tracking Order
The system facilitates online ordering for a healthy food store. Users can retrieve their completed
orders and monitor them. Upon request, the system interacts with a shipment service to obtain
delivery status information. Finally, it delivers the updated delivery information back to the users.
Assignment 2 17
Create a new user account
The system facilitates the online registration process for customers interested in accessing the healthy
food store's services. Upon registration, it verifies the uniqueness of provided contact numbers. If a
number is already in use, it prompts customers to provide an alternative. Once a unique number is
obtained, the system proceeds to create the account and prompts users to fill out their profiles.
Assignment 2 18
Processing payment
The user starts by creating a shopping cart. An order is then generated from the items in the shopping
cart. The user then initiates payment for the order. If the payment is successful, an invoice is created,
followed by the generation of a receipt, which is then returned to the user.
Reference
- Hanmer, Robert S. Pattern-oriented software architecture for dummies. John Wiley & Sons, 2013.
- Clements, P. C. (2002). Software architecture in practice. Diss. Software Engineering Institute.
- Rohnert, H. (1996). {Pattern-Oriented} Software Architecture. In 2nd USENIX Conference on
Object-Oriented Technologies (COOTS 96).
Assignment 2 19