Meaningless Drivel is fun!*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Could anyone help me to analyze and design this problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Could anyone help me to analyze and design this problem" Watch "Could anyone help me to analyze and design this problem" New topic
Author

Could anyone help me to analyze and design this problem

Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Hi All,
I have the basic concepts about UML and OOAD. However, I do not have any experience of doing it. I want to get help from this forum to solve the problem stated below.
The problem is from http://www.mindcrafted.com/training/ooad/oosampp.htm
----------------
Object Trust Bank Problem
The Object Trust Bank (OTB) offers it customers two different types of accounts: checking or savings. An account is owned by either an individual or corporation.
There are several differences between checking and savings accounts. The customer can "attach" a savings account to a checking account to provide overdraft protection for the checking account, but not vice-versa.
A customer can set up a checking account with OTB�s "EZ Payer" feature. This feature lets the customer set up regular payments like mortgage payments and car payments. Once set up, OTB automatically executes the EZ Payer transaction on a specific day for a given amount, deducting the amount from the customer�s checking account. The "payee" on an EZ Payer transaction can be either an individual or a corporation.
There are several basic types of transactions. Customer initiated transactions include checks, deposits to savings or checking, and savings account withdrawals. Bank initiated transactions include EZ Payer transactions and service charges.
Whether an account is owned by an individual or corporation, the account can have several authorized signers who must be individuals. An authorized signer need not be the owner, but can have a signing limit. A clerk may have a signing limit up to $1,000, while the president of the company may have no signing limit.
OTB sets up an account when requested by a customer. Before activating the account, the bank verifies the customer�s identity and will not activate the account if it cannot verify the customer. Once active, an account is subject to periodic automatic service charge deductions.
A customer may close an account at any time. OTB will automatically close any account if its balance stays at zero for 60 consecutive days. If no transactions other than service charges occur against an account for 90 consecutive days, the account becomes inactive.
While an account is inactive the bank continues to deduct service charges. Any other transactions will cause OTB to reactivate the account. Any time an inactive account�s balance falls to zero the bank automatically closes it. If an account remains inactive for five years it becomes dormant. OTB does not deduct service charges on dormant accounts. The bank reactivates a dormant account if a transaction comes in for it. If an account remains dormant for a year, it goes "escheat" which means the bank closes it and transfers the money to the state.
OTB keeps complete information on closed accounts on-line until the end of the year after an account is closed. Then the bulk of the information is placed on microfiche. Once on microfiche, only a basic record giving the microfiche series number is kept on-line. Seven years after an account is closed, the bank discards the microfiche and the on-line record.

Draw an object diagram of this problem domain and a state diagram for an Account.
---------------
Please guide me with suggestions.
---------
Hafizur Rahman


SCJP 2(94%), SCBCD 5.0(86%), SCDJWS(86%), SCEA 5 (I-73%, II/III-88%)
The illiterate of the 21st century will not be those who cannot read and write, but those who cannot learn, unlearn, and relearn. - Alvin Toffler
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I don't really think you will learn much if someone just gives you an answer, so how about you tell us what you have come up with so far:
What objects do you think might be involved? What things might you need these objects to do? Can you group any of these objects into similar types ("classes") ? and so on.
Let us know your thoughts and the specific things which puzzle you, and we can try to help you work through them to improve your (and our) understanding.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
I agree with ur suggestion.
To me the candidate classes are
Bank
Customer
Account
Transaction
Person
Corporation
EZPayment
Signer
Payee
Record
Microfiche
Cheque(probably it will be important afterwards)
Customer(1)----(has)--->Account(*)
Bank(1)---(maintains)----->Account(1..*)
Account(1)---(has)--->Transaction(1..*)
Checking A/C(1)----(may have)---->Saving A/C(0..1)
Account(1)---(may have)-->EZPayment(0..*)
Account(1)---(may be authorized by)-->Signer(1..*)
Signer(1)---(has a)--signing limit
EZPayment(1)--(is paid to)-->Payee(1)
[Account is owned by Customer, hence]
Customer is either Person or Corporation.
Payee is either Person or Corporation.
The thing I find hard is these bold marked.
Signer must be a Person.
I have designed a class diagram as follows(though I missed to put the Signer).
All these are about relationship and cardinality.
Plz check http://www.geocities.com/jdreamer001/class.htm
However, please clarify my ideas.
Thanks everyone.
[ October 06, 2003: Message edited by: Hafizur Rahman ]
[ October 06, 2003: Message edited by: Hafizur Rahman ]
[ October 06, 2003: Message edited by: Hafizur Rahman ]
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
EZPayment and Account should be composition.
Customer and Account should be composition.
:roll:
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
If you have some time and a few bucks, pick up Robert Martin's Agile Software Development. He does a superb case study building a payroll system. It gives you good insight into how he found objects and used Test Driven Development (writing unit tests first) to explore the domain and evolve a design. What surprised me was he built all the guts of the business rules and logic with no UI and no database. It made those things seem trivial to throw on at the end. Poweful stuff.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Notice that this example is a *pure analysis* exercise - it doesn't require any *design* activity at all!


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Originally posted by Ilja Preuss:
Notice that this example is a *pure analysis* exercise - it doesn't require any *design* activity at all!

Would u clarify the boundary between *OO analysis* and *OO design*? I need some light.
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
I found that Account should be generalized. So I have drawn the modified diagram for Account.
However, to map this with the database what are the consequences? What might be the solution?
Looking for ur comments and insight....
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Hafizur Rahman:
Would u clarify the boundary between *OO analysis* and *OO design*? I need some light.

Analysis is the activity of trying to understand the problem.
Design is the activity of trying to form a solution to the problem. The structure of the solution doesn't need to have much in common with the structure of the problem.
Modeling the problem space is a pure analysis activity.
Did that help?
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Hi Ilja Preuss, thanks for nice comment.
However, it raised some questions to me. Plz make me clear.
Originally posted by Ilja Preuss:
Analysis is the activity of trying to understand the problem.

Does it mean to find out the Functional Requirements and Business Rules? In other words, to identify the use cases/interactions in Use case driven approach. Does the Collaboration Diagram/Sequence Diagram come into play during Analysis?
Originally posted by Ilja Preuss:
Design is the activity of trying to form a solution to the problem. The structure of the solution doesn't need to have much in common with the structure of the problem.

Does it mean to identify the classes and mark their responsibities to fulfill the requirements?
Originally posted by Ilja Preuss:
Modeling the problem space is a pure analysis activity.

I got it ie. the scope of the system.
Did I really got it?
william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
Am i right in my understanding when i say that analysis model will model the objects in the problem domain?
If yes i would like to what purpose this will serve.
How will it help in drawing the solution?How will this contribute in finding a solution to the problem?


Help me!Help you!!!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by william kane:
Am i right in my understanding when i say that analysis model will model the objects in the problem domain?
If yes i would like to what purpose this will serve.

The purpose of the analysis model is to help you understand the problem.
How will it help in drawing the solution? How will this contribute in finding a solution to the problem?

Well, how do you build a solution to a problem you don't understand?
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Hafizur,
most of the UML diagrams can be used in *both* analysis and design.
A class diagram, for example, would show concepts of the problem domain during analysis, whereas it'd show classes of the system to build during design.
Otherwise, I think you've got it.
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Thanks.
Though I hoped a more vivid discussion, now is also pretty well.
How about my class diagrams? Fisrt one
Second one
What to do next?
Would anyone put more light?
william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
Next i think one can look at different use case scenarios and come up with the sequence diagrams for each.What say? I think that will surely be a step towards design of the solution
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
So I have identified and drawn the use cases here.
Here Customer and Bank are shown as actors? Is it OK? Is Payee not an actor?
Have I missed something?
Next I should walk for Collaboration/Sequence diagrams.
Let there be light...
[ October 08, 2003: Message edited by: Hafizur Rahman ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
These look pretty good so far! You can do collaboration diagrams now, or right along with these from the beginning. Each diagram can help you understand the other. Sequence diagrams are really just collaboration diagrams shaken out in a different shape - they *can* have *almost* the same information content. I use sequence more for nitty-gritty software objects than for analysis objects. But use which ever best helps you understand and explore the problem or communicate what you know with others.
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Today I got some texts about OOAD. Let me share...
-------------------
Activities in OOA
-------------------
1. Identify the scope - what is/what not
2. Identfy key domain concepts - understand the business vocabulary
3. Specify detailed requirements
4. Examine (only)*a few most important object* behaviour
--------------------
Activities in OOD
--------------------
1. Design the architecture
2. Design the system behavior - more about object collaboration
3. Design the classes
4. Design the association
Then comes the implementation. As OO development is somewhat iterative and incremental, sometimes it is not possible to mark the boundary.
Have I got it?
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Originally posted by Stan James:
You can do collaboration diagrams now, or right along with these from the beginning. Each diagram can help you understand the other.

I agree with u. Once the techniques are mastered, one can select ones best way and GO...
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
So I have drawn a Sequence Diagram for Open Account use case and Customer closes Account use case.
How about the notations in the diagrams? Is anything important for these two?
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
And this is for Bank Closes Account use case.
Comments plz...
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Hafizur , which UML drawing tool did you use, if you don't mind my asking?
Cool diagrams.
regards
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Originally posted by HS Thomas:
Hafizur , which UML drawing tool did you use, if you don't mind my asking?

Poseidon for UML community Edition 2.0 from www.gentleware.com
Thanks.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Those steps and activities don't look too bad. Have you been following the "waterfall vs agile" discussions here? The notion that you should do the first activity for the whole system, then the second for the whole system and so on has given away to the idea that you can do the whole series of steps for a small function in a week or three, and do that over and over until done. The list of "things to think about" is much the same, but the overall feel is VERY different.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Could anyone help me to analyze and design this problem
 
Similar Threads
Java Job in MA
Aggregation/Composition code example
SCEA Part II, UML Doubt
Trouble w/ Savings Acct Program
java.lang.Nullpointer Exception