Determine the different ways the system will be used. This includes main functions the system needs to perform and who will use it.
Based on the requirements and use cases, identify the main objects of the system...
Authentication: user authentication, registration.
UserDetails: data model for user info such as user personal info, DOB, social security etc.
UserService: service class for performing user profile service, update acc info, change password etc.
Regisration: create an account
Account: balance, account type, deport/tranfer.
Transaction: will validate transaction, will modify the balance in Account object if it's valid, otherwise return an error.
FraudRecord: monitoring transaction history to detect frauds using ML.
Determine how these objects will interact with each other to fulfill the use cases...
User will access Account object to perform transsactions.
Account object will access Transation to validate transcation
FraudRecord will access Transaction to monitor frauds based on transaction history (unusual behavior pattern)
Design inheritance trees where applicable to promote code reuse and polymorphism. This step involves identifying common attributes and behaviors that can be abstracted into parent classes...
Account -> Checking Account, Savings Account
Consider using design patterns (e.g., Factory, Singleton, Observer, Strategy) that fit the problem...
Attributes: For each class, define the attributes (data) it will hold...
Methods: Define the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation.
class Authentication:
def __init__(self, userDetails):
self.userDetails = userDetails
def authenticate()
class UserDetails:
def __init__(self, builder):
self.username = builder.username
self.password = builder.password
self.email = builder.email
self.address = builder.address
self.birthday = builder.birthday
self.social_security = builder.social_security
self.owned_accounts = builder.owned_accounts
class Builder:
def __init__(self, username, password, email):
self.username = username
self.password = password
self.email = email
self.address = None
self.birthday = None
self.social_security = None
self.owned_accounts = None
def set_address(address):
self.address = address
def set_social_security(social_security):
self.social_security = social_security
def build():
return UserDetails(self)
class Account:
def init(self, account_num, balance, account_type, transaction):
self.userDetails = userDetails
def deposit()
def transfer()
def withdraw()
def get_list_transactions()
def dispute_transaction()
class CheckingsAccount(Account):
def init(self, account_num, balance, account_type, transaction):
super().init(account_num, balance, account_type)
class SavingsAccount(Account):
def init(self, account_num, balance, account_type, transaction):
super().init(account_num, balance, account_type)
Check and explain whether your design adheres to solid principles (Ask interviewer what SOLID principle is if you can not recall it.)...
Single responsibility: each class serves only one purpose
Open Close: each class is open to extend
Liskov sub: parent class can be substituted by the child class, Account -> checkings account
Interface segragation: does not apply
Dependency inversion: high level class does not depend on low level class
Explain how your design can handle changes in scale and whether it would be easily to extend with new functionalities...
Try creating a class, flow, state and/or sequence diagram using the diagramming tool. Mermaid flow diagrams can be used to represent system use cases. You can ask the interviewer bot to create a starter diagram if unfamiliar with the tool. Briefly explain your diagrams if necessary...
Critically examine your design for any flaws or areas for future improvement...