Bookmark Topic Watch Topic
  • New Topic

OO design  RSS feed

 
Prasanna Raman
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

I had started this a few months ago in another thread but didn't go far with it I want to start new here and hopefully get some guidance with my design. The other thread is too old, so I thought I'd post a new one. Kindly review and comment. Here is my requirement:

A bank can have any number of customers, and each customer can have multiple checking and/or savings accounts.
Checking: The customer can open or close a checking account. He can deposit or withdraw money. The account balance cannot be negative. If a customer tries to withdraw more than he has in his account, the transaction will be declined
Savings: The customer can open or close a savings account. The minimum balance in the account should be $100. This account accrues interest at 5% compounded daily.
Opening an account: The customer will need to provide some personal details, and have a minimum balance of $100 to open either account.
Closing an account: The customer can close his account at any time. The money has he has in the account at that point will be returned to him. An account once closed can never be reopened.

I hope these requirements will be challenging enough and will lead to something meaningful. I also hope to build a web application on top of this at some point. If there are other things that I can add or if there's anything that doesn't look right, kindly let me know.

Here are the classes I've identified based on the 'nouns' in the requirement:

  • Bank
  • Customer
  • abstract Account
  • CheckingAccount extends Account
  • SavingsAccount extends Account
  • enum AccountStatus


  • Please review these classes. Once someone approves, I will start identifying the attributes and methods in each of the classes.
     
    Greg Charles
    Sheriff
    Posts: 3015
    12
    Firefox Browser IntelliJ IDE Java Mac Ruby
    • Mark post as helpful
    • send pies
    • Report post to moderator
    I approve. You may continue.

    The only thing not suggested by your requirements is account status. What are the possible values, and how would they be used?
     
    Prasanna Raman
    Ranch Hand
    Posts: 410
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Thank you, Greg Sorry, the account status can have values - CLOSED and ACTIVE.

    Should I start designing the classes taking into account the front end and the back end? Will the design change in any way because of the front end or the database? Or, should I design the application as a standalone and then if I designed it properly, it should work with any GUI and back end? It's very confusing to me
     
    Campbell Ritchie
    Marshal
    Posts: 56536
    172
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Prasanna Raman wrote: . . . designing the classes taking into account the front end and the back end? . . . it should work with any GUI and back end? . . .
    No. Yes.

    The design of your classes should be to design classes. Well‑designed classes can be used regardless of a GUI database, etc. Design the classes first, and then later populate them with a database or display the objects with a GUI.
     
    Campbell Ritchie
    Marshal
    Posts: 56536
    172
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Please continue all discussion here. Closing thread as duplicate discussion.
     
      Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!