How erajasekar/simple-banking-system works
Project type and purpose
• This is a small, monolithic, command-line banking system written in Python using OOP concepts.
• It consists of three main modules: bank.py (Bank class), client.py (Client class) and main.py (CLI entry point).
File structure
Top-level files:
• bank.py – defines the Bank class, manages the “database” (a list of dicts), account creation, and authentication.
• client.py – defines the Client class, holding account number, name, and balance, plus methods for deposit/withdrawal.
• main.py – user interface loop: displays menus, gathers input, invokes Bank and Client operations.
• README.md – project description.
• __pycache__ – compiled bytecode.
README for insights
• The Bank class holds a “database” (list of dicts) representing multiple Client instances.
• Workflow:
a) Instantiate Bank.
b) CLI: create new account → calls Client.__init__, generates a 5-digit account number, then Bank.add_client.
c) CLI: login existing account → Bank.authenticate returns a Client instance (current_client).
d) CLI: account operations (deposit, withdraw, check balance) invoked directly on current_client.
Main components & interactions
a. Components:
• CLI (main.py)
• Bank module (bank.py)
• Client module (client.py)
• In-memory database (Bank.database: list of dicts or list of Client objects)
b. Relationships:
• CLI ↔ Bank: CLI calls Bank.create_account(), Bank.authenticate()
• Bank ↔ Client: Bank stores references to Client; Bank.lookup returns Client.
• Client ↔ (self): deposit(), withdraw(), get_balance()
c. Architectural principles:
• Separation of concerns: CLI vs business logic vs data model
• Single responsibility: Bank manages accounts; Client manages individual account state.
d. Technologies:
• Python 3.x
• Standard library (random for account numbers, basic I/O)