Skip to content

Comments

Jonathan van Oudheusden#134

Closed
jonavano wants to merge 4 commits intoboolean-uk:mainfrom
jonavano:main
Closed

Jonathan van Oudheusden#134
jonavano wants to merge 4 commits intoboolean-uk:mainfrom
jonavano:main

Conversation

@jonavano
Copy link

No description provided.

@ninja-aruna
Copy link

This is a good start, but yu are missing a few key top-level classes whcih akes your design incompete. Customer, Manager, and Transaction all need to be modelled as classes, as they have behavior, and properties. this is the way I would do it, but feel free to tweak it

+-------------------------------------------------------+
| <> |
| TransactionType |
+-------------------------------------------------------+
| DEPOSIT |
| WITHDRAWAL |
+-------------------------------------------------------+

+-------------------------------------------------------+
| Transaction |
+-------------------------------------------------------+
| - accountId: String |
| - amount: double |
| - type: TransactionType |
| - timestamp: String |
+-------------------------------------------------------+
| + Transaction(accountId, amount, type, timestamp) |
| + getAccountId(): String |
| + getAmount(): double |
| + getType(): TransactionType |
| + getTimestamp(): String |
+-------------------------------------------------------+

+-------------------------------------------------------+
| OverdraftRequest |
+-------------------------------------------------------+
| - accountId: String |
| - requestedAmount: double |
| - approved: boolean |
| - processed: boolean |
+-------------------------------------------------------+
| + OverdraftRequest(accountId, requestedAmount) |
| + getAccountId(): String |
| + getRequestedAmount(): double |
| + isApproved(): boolean |
| + approve(): void |
| + reject(): void |
| + isProcessed(): boolean |
| + setProcessed(processed: boolean): void |
+-------------------------------------------------------+

+-------------------------------------------------------+
| Account |
+-------------------------------------------------------+
| - accountId: String |
| - customerId: String |
| - branchId: String |
| - transactions: List |
| - overdraftRequests: List |
+-------------------------------------------------------+
| + Account(accountId, customerId, branchId) |
| + getBalance(): double |
| + addTransaction(transaction: Transaction): void |
| + requestOverdraft(amount: double): OverdraftRequest |
| + getPendingOverdraftRequests(): List|
| + getAccountId(): String |
| + getCustomerId(): String |
| + getBranchId(): String |
| + getTransactions(): List |
+-------------------------------------------------------+

+-------------------------------------------------------+
| Branch |
+-------------------------------------------------------+
| - branchId: String |
| - name: String |
| - accounts: List |
+-------------------------------------------------------+
| + Branch(branchId, name) |
| + openAccount(customerId: String): Account |
| + getBranchId(): String |
| + getName(): String |
| + getAccounts(): List |
+-------------------------------------------------------+

+-------------------------------------------------------+
| Customer |
+-------------------------------------------------------+
| - customerId: String |
| - name: String |
| - phoneNumber: String |
| - accounts: List |
+-------------------------------------------------------+
| + Customer(customerId, name, phoneNumber) |
| + addAccount(account: Account): void |
| + sendStatement(message: String): void |
| + getCustomerId(): String |
| + getName(): String |
| + getPhoneNumber(): String |
| + getAccounts(): List |
+-------------------------------------------------------+

+-------------------------------------------------------+
| BankingService |
+-------------------------------------------------------+
| - branches: List |
| - customers: List |
+-------------------------------------------------------+
| + createBranch(name: String): Branch |
| + registerCustomer(name, phoneNumber): Customer |
| + openAccount(customer, branch): Account |
| + deposit(account, amount): void |
| + withdraw(account, amount): boolean |
| + requestOverdraft(account, amount): OverdraftRequest |
| + processOverdraftRequest(account, request, approve):void|
| + getBranches(): List |
| + getCustomers(): List |
| - sendStatement(account, message): void |
+-------------------------------------------------------+

Relationships:
Account "1" → "*" Transaction (Account has many Transactions)

Account "1" → "*" OverdraftRequest (Account has many OverdraftRequests)

Branch "1" → "*" Account (Branch has many Accounts)

Customer "1" → "*" Account (Customer has many Accounts)

BankingService "1" → "*" Branch (Manages many Branches)

BankingService "1" → "*" Customer (Manages many Customers)

BankingService depends on Account, Transaction, and OverdraftRequest for operations

Key Design Points:
State calculated from history: The Account class doesn't store balance as a field but calculates it from transactions

Branch association: Each account links to a branch via branchId

Overdraft workflow: Clear separation between request, approval, and processing

Messaging: Customer has phone number and receives statements via sendStatement()

Service layer: BankingService orchestrates all operations

@jonavano jonavano closed this by deleting the head repository Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants