- Open the project in Visual Studio Code
- Run the application:
- Open the Run and Debug view click play icon in sidebar or press Ctrl+Shift+D
- Select the Launch ECommerceGUI configuration
- Click the green play button to start the application
A singleton class managing SQLite database connections and CRUD operations for the products table.
- Design Pattern: Singleton
- Rationale: Maintains a single database connection instance with global access point
The main graphical user interface component displaying products and shopping cart.
- Design Pattern: Observer
- Rationale: Monitors and responds to shopping cart changes in real-time
Handles input validation for various form fields including CVV, expiry date, and email.
Data model representing product information including name, price, description, and stock quantity.
Manages product creation and database integration.
- Design Pattern: Factory
- Rationale: Centralizes product creation logic for improved modularity and extensibility
Handles shopping cart operations and total price calculations.
- Design Pattern: Singleton
- Rationale: Maintains consistent cart state across the application
Defines the payment processing interface.
- Design Pattern: Strategy
- Rationale: Enables flexible payment method implementation and switching
Credit card payment implementation of the PaymentStrategy interface.
- 3 or 4 digits required
- Numbers only
- Format: MM/YY
- Month range: 01-12
- Must be future date
- Assumes 20YY for year
- Standard email format checking
The system can be populated with initial products using the DatabaseHelper.addInitialProducts() method:
public static void main(String[] args) {
// Add initial products to the database
DatabaseHelper.addInitialProducts();
SwingUtilities.invokeLater(() -> new ECommerceGUI());
}
- SQLite JDBC Driver
- Java Swing
- Professor Dr. Mahmoud Al-Bassiouni, for the course and guidance.
- SQLite JDBC Driver
- Java Swing
- Observer Pattern
- Singleton Pattern
- Factory Pattern
- Strategy Pattern
- Decorator Pattern
- Design Patterns
- Java Documentation