Skip to content

A Java-based e-commerce system featuring a graphical user interface built with Swing, SQLite database integration, and implementation of core design patterns. The system provides product management, shopping cart functionality, and secure payment processing with robust input validation.

Notifications You must be signed in to change notification settings

mahmoodhamdi/ECommerceSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce System Documentation

Getting Started

Setting Up in Visual Studio Code

  1. Open the project in Visual Studio Code
  2. 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

System Architecture

Core Components

DatabaseHelper

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

ECommerceGUI

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

FormValidator

Handles input validation for various form fields including CVV, expiry date, and email.

Product

Data model representing product information including name, price, description, and stock quantity.

ProductFactory

Manages product creation and database integration.

  • Design Pattern: Factory
  • Rationale: Centralizes product creation logic for improved modularity and extensibility

ShoppingCart

Handles shopping cart operations and total price calculations.

  • Design Pattern: Singleton
  • Rationale: Maintains consistent cart state across the application

PaymentStrategy

Defines the payment processing interface.

  • Design Pattern: Strategy
  • Rationale: Enables flexible payment method implementation and switching

CreditCardPayment

Credit card payment implementation of the PaymentStrategy interface.

Validation Rules

CVV Validation

  • 3 or 4 digits required
  • Numbers only

Expiry Date Validation

  • Format: MM/YY
  • Month range: 01-12
  • Must be future date
  • Assumes 20YY for year

Email Validation

  • Standard email format checking

Application Setup

Initial Product Setup

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());
}

Dependencies

  • SQLite JDBC Driver
  • Java Swing

Acknowledgments

About

A Java-based e-commerce system featuring a graphical user interface built with Swing, SQLite database integration, and implementation of core design patterns. The system provides product management, shopping cart functionality, and secure payment processing with robust input validation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages