This Java-based console application serves as the final project for the Object-Oriented Programming course, showcasing a comprehensive e-commerce system. The application encompasses various features that mirror real-world e-commerce functionalities.
The project adopts a modular structure with packages like appinterface, authentification, orderprocessing, paymentprocessing, productmanagement, promotionservice, searching, 'shopping cart' and wishlist. Each package encapsulates specific functionalities, adhering to OOP principles.
The AuthenticationService manages user authentication in the e-commerce system. Users can sign up as admins or customers. The user hierarchy includes an abstract User class, ensuring a standardized structure for both admins and customers. User data, including usernames and passwords, is securely stored using HashMaps (adminUsers and customerUsers). All methods are static for the authentication manager so we don't have to instantiate it every time we use it. For the customer class, it has all necessary attributes for a customer having compositions and aggregations with other classes like shopping cart, order, order processor, and wishlist.
- User Registration: Users can sign up by providing a username and password.
- User Login: The service allows users to log in based on their role.
- User Logout: Users can log out, terminating their current session.
- User Management: Admins can be added or removed, and similar functionality exists for customers.
- Hierarchical structure products stored in product categories stored in the list of products existing in the product manager.
- Products stored in hashmap, and it includes an id generator for each new order. All methods are static for the product manager so we don't have to instantiate it every time we use it.
- Attributes: Encapsulates product details. Composition with product feedback class.
- Methods: Manages product information, stock, and user feedback.
- Attributes: Represents product categories.
- Methods: Handles product categorization and search.
- Static Methods: Manages global product aspects (CRUD operations for the user).
- Inventory Management: Tracks stock levels, handles increases/decreases in stock quantity, and displays out-of-stock products.
- Facilitates the management of products within a user's cart.
- Includes functions such as adding, updating, and removing items, and viewing the cart and it has a menu.
- Composition with the user class.
- Orders stored in hashmap and an it includes an id generator for each new order.
- Users can cancel, pass a new order, or pay it (linked with the payment service), and we can ship orders via the
OrderProcessor(this feature is only for admins). - Order history for each user.
- Different order status.
- Once the order is successfully paid the inventory immediately changes.
- Implements dynamic search functionality for efficient product discovery.
- Provides filtering options to refine search results by category, price, rating, brand, and availability.
- A searching menu for each category itself.
- A payment service class that has a static method
payand aPaymentStrategyinterface, so the strategy pattern is used. We can easily add a new payment method (for now we have credit card, carte E_Dinar, and PayPal). - The use of the strategy pattern enhances the Close to Modification, Open for Extension principle.
-
ProductFeedback Class:
- Attributes: Captures user feedback.(The feedback includes a review and a rating on 10)
- Methods: Facilitates feedback input and retrieval.
-
AuthenticationService Integration:
- User Identification: Associates feedback with the loggedUser details.(The user has the freedom of giving the feedback anonymously or with his name)
-
Product Class Integration:
- Enables products to collect and display user feedback.
- Users can add and view feedback on purchased products.
- Displays an aggregate of a genral rating for each product.
OOP principles ensure modularity and flexibility for both product and feedback components, contributing to a cohesive and scalable e-commerce system.
Description:
The PromotionManager class facilitates product promotions in an e-commerce system, embracing key Object-Oriented Programming (OOP) principles. There are two hashmaps one storing products in promotion and one storing discount codes.
Emphasis on OOP:
-
Encapsulation:
- Secures data using private fields, encapsulating product IDs and corresponding promotion percentages and discount codes.
-
Integration with Product and ProductManager:
- Collaborates with
ProductManagerto dynamically adjust product prices during promotions.
- Collaborates with
-
Integration with Order processor:
- Before paying any order the user is asked about discount codes, and if he gives an existing discount code, the amount to pay changes.
-
Dynamic Linking:
- Leverages the
Productclass for real-time price updates, establishing dynamic links.
- Leverages the
Usage:
- Adding/Removing Promotions: Utilizes
addProductandremoveProductfor managing product promotions. - Checking Promotion Status: Employs
isInPromotionandgetPromotionto verify and retrieve promotion details.
This design ensures simplicity, modularity, and collaboration, aligning with OOP principles.
- Facilitates the management of products within a user wishes to buy.
- Includes functions such as adding, updating, and removing items, and viewing the wishlist and it has a menu.
- Composition with the user class.
- Users can convert products to the shopping cart.
- Description:
- The
HomePageclass provides the main interface for users, allowing sign-up, login, search, and exit. - It integrates with
ProductManagerto display best sellers. - Utilizes the
AuthenticationServicefor user authentication. - Then depending on the logged user it takes him to the appropriate interface.
- The
- Description:
- The
CustomerInterfaceclass represents the customer-specific interface after login. - Displays options for managing shopping cart, wish list, order history, and more.
- Utilizes
OrderProcessorfor order-related functionalities. - After the logout that takes you back to the Home page or you can directly exit.
- The
- Description:
- The
AdminInterfaceclass provides an interface tailored for administrators. - Supports various admin actions such as order shipping, user management, product management, and promotions.
- Collaborates with
ProductManagerandOrderProcessorfor inventory and order processing. - Utilizes
PromotionManagerfor managing product promotions. - Relies on
AuthenticationServicefor admin and user management. - After the logout that takes you back to the Home page or you can directly exit.
- The
- Embraced a modular architecture to ensure each functionality is encapsulated within its designated class/package.
- Applied OOP principles, including encapsulation, inheritance, and polymorphism, to enhance code readability and maintainability.
- Prioritized user experience by providing intuitive interfaces and clear prompts.
- Used hashmaps in storing data in the project because it provides a fast and easy access(O(1)).
- The design follows the Open/Closed Principle by allowing the addition of new payment methods without modifying existing code, enhancing the application's flexibility and extensibility.
- For the Managers ProductManager, AuthenticationService, OrderProcessor, PromotionManager, PaymentService, SearchingManager, and the interfaces I used static methods because these classes are usually used so we don't have to instantiate them every time.
In summary, this e-commerce console application effectively applies Object-Oriented Programming principles, delivering a modular and scalable system. With its various features, the application strikes a balance between simplicity and functionality. The design promotes code reusability, making it a solid foundation for future enhancements and exemplifying the practical application of OOP in real-world scenarios.