Originally posted by pradeep anandan:
I have a Account type class and Account class
where Account TYpe has differnet types of Accounts eg:Saving and Current
and Account class stores the account info like Account id,account type.
To get account type in account class what type of relationship should i show between 2 classes
1) Association or inheritance. and why
Regards,
Pradeep
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
Originally posted by Hari babu:
Hi,
I think it should be aggregation rather than inheritance or association
Hari
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
Originally posted by Ilja Preuss:
I don't think it's possible to tell without knowing more about the code. Can you show us some (potential) implementation for the classes? How will the classes be used?
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
Originally posted by Vikrama Sanjeeva:
I dont think that answering this question will require some knowledge of implementation.Because making/creating relatiosnship is part of desing.However changes occur when one transforms design into implementation.But still deciding which relationship exist b/w two classes is part of design.
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
Originally posted by pradeep anandan:
I have a Account type class and Account class
where Account TYpe has differnet types of Accounts eg:Saving and Current
and Account class stores the account info like Account id,account type.
To get account type in account class what type of relationship should i show between 2 classes
1) Association or inheritance. and why
Regards,
Pradeep
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
Originally posted by pradeep anandan:
I have a Account type class and Account class
where Account TYpe has differnet types of Accounts eg:Saving and Current
and Account class stores the account info like Account id,account type.
To get account type in account class what type of relationship should i show between 2 classes
1) Association or inheritance. and why
Regards,
Pradeep
"A scientist is not person who gives right answers but a person who asks right questions"
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
Originally posted by Vikrama Sanjeeva:
Account(...,AccountType,...)
Considering above code, creation of Account object is dependent on Account Type.Therefore relationship b/w Account and AccountType is of dependency.
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
Originally posted by Ilja Preuss:
A dependency is a rather weak UML artefact, only telling that if AccountType changes, it will probably affect Account.
An association is much stronger - it's a connection between two classes, through which instances of these classes can send messages to each other.
Originally posted by Ilja Preuss:
An association is much stronger - it's a connection between two classes, through which instances of these classes can send messages to each other.
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
Originally posted by Frank Carver:
What worries me about this so far is that no one seems to have discussed how (if at all) the behaviour of the Account class changes as a result of the AccountType.
Anyone got any more background to this problem ?
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
"A scientist is not person who gives right answers but a person who asks right questions"
Originally posted by Vikrama Sanjeeva:
Composition is much stronger relationship then association and dependency
I dont think that one should select relationship on the basis of there strongness.
I dont think that the method getAccountType is placed in AccountType class and Account class send message to AccountType for asking account type.Rather this information is provided as soon as Account instance is created, possibly via Account's constructor.
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
Originally posted by Vikrama Sanjeeva:
And i think it's just a general query when one is designing Banking Applications.
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
Originally posted by Ilja Preuss:
I think the point is that you simply *can't* reasonably design a "general" application, without having detailed insight about the desired behaviour.
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
Originally posted by Vikrama Sanjeeva:
Well, its all depend upon modeler.I think in IBM 486 Exam no one can give answers b/c there is not much detail is given.
Questions are asked in the way pradeep has asked.It's intiuition of modler.In real modeling(i mean other then exam) having good detial of Domain is required.
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
Originally posted by pradeep anandan:
As in RDBMS we have 2 different tables one for Acccount type and other Account and have a foreign key relationship
will the same is applied in OOPS where The rate of interest differs with the account type
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
Originally posted by pradeep anandan:
Well it was a great to see so much response..
and I think We are not arriving to a conclusion as there is not enough information provided.
As I am in the learning curve of UML and I was just going through a Banking Application eg to make a UML
design of it.
And there I had a doubt of it.
As in RDBMS we have 2 different tables one for Acccount type and other Account and have a foreign key relationship
will the same is applied in OOPS where The rate of interest differs with the account type
Regards,
Pradeep
"A scientist is not person who gives right answers but a person who asks right questions"
Originally posted by Piyush Daiya:
It is during analysis and design that you decide what relationships exists between two objects.
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
Originally posted by Ilja Preuss:
And don't get fooled into the thinking that you need to somehow "finish" analyzing before you may start designing or even should have finished your design before you start coding.
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
"A scientist is not person who gives right answers but a person who asks right questions"
Originally posted by Ilja Preuss:
Hell, I even wouldn't know how to design without "seeing the accompanied code in my head".
Originally posted by Ilja Preuss:
The only real semantic difference [from asociation] is that there is no cycle allowed in aggregation.
Originally posted by Vikrama Sanjeeva:
I dont think that the method getAccountType is placed in AccountType class and Account class send message to AccountType for asking account type.Rather this information is provided as soon as Account instance is created, possibly via Account's constructor.
Originally posted by Frank Carver:
It might even be that Account doesn't actually need to know about AccountType at all - maybe they would be better aggregated together into another class.
Originally posted by Piyush Daiya:
As u have mentioned Pradeep, u want account type in account class i.e account type is attribute of account class.Hence the relationship you have to show is association.
Inheritance is type of generalisation relationship.(A Generalisation relationship is relationship among classes where one class shares the structure and/or behaviour of one or more classes).
Since, you havent mentioned anything about sharing structure or anything between Account or AccountType, inheritance is not the relationship between the classes.
Association relationships can be of Aggregation and Composition types.
HTH,
Originally posted by Ilja Preuss:
Oh, ok – if it is a given that Account holds a reference to AccountType, it
Fowler, Martin. UML distilled: a brief guide to the standard object modeling language / Martin Fowler with Kendall Scott. - 2nd ed., 2000, Addison Wesley
p.52
Associations represent relationships between instances of classes...
p.54
An association also implies responsibility for updating the relationship. ...
These responsibilities do not apply to data structure, however... I cannot and should not be able to tell whether the Order [Vanin: read "one" instead of "Order"] class contains a pointer to Customer [Vanin: read "another class" instead of "Customer"], or whether the Order class fulfils its responsibility by executing some selection code that asks each Customer whether it refers to given Order.
p.57
"So a parameter reference, or the creation of an object, does not imply an association, you model those with dependencies (see Chapters 6 and 7)"
Originally posted by Ilja Preuss:
Well, all [composition] it adds over aggregation is lifetime responsibility -
Fowler, Martin. UML distilled: a brief guide to the standard object modeling language / Martin Fowler with Kendall Scott. - 2nd ed., 2000, Addison Wesley
p.57
An association represents a permanent link between two objects [Vanin's comment: I would have said between object's populations]. That is, the link exists during the whole lives of the objects, although the instances that are connected may change over time (or, in optional association, be empty). So a parameter reference, or the creation of an object, does not imply an association, you model those with dependencies (see Chapters 6 and 7)"
Originally posted by Ilja Preuss:
And I think Account somehow probably would want to send messages to AccountType.
Originally posted in
Mark Grand, Patterns in Java: a catalog of reusable design patterns illustrated with UML, Volume 1. - 2nd ed., 1999, John Wiley & Sons
p.56
"Delegation is more general purpose than inheritance. Any extension to a class that can be accomplished by inheritance can also be accomplished by delegation "
"Some inappropriate uses of inheritance are so common that they can be classified as antippaterns. In particular, subclassing utility classes and using inheritance to model roles are common design flaws"
Originally posted by pradeep anandan:
As in RDBMS we have 2 different tables one for Acccount type and other Account and have a foreign key relationship
will the same is applied in OOPS where The rate of interest differs with the account type
Originally posted by Ilja Preuss:
And don't get fooled into the thinking that you need to somehow "finish" analyzing before you may start designing or even should have finished your design before you start coding.
Originally posted by Guennadiy VANIN:
I rather miss a lot. I always thought that architect or programmer-analyst designs, writes in words, defend those descriptions to get financing and after getting money, hire someone to write the corresponding code.
I am getting to this phrase because I see it over and over again. I cannot see how it illustrates any semantics because I even cannot recall any, even single example of, cyclic implementation of association.
Does this phrase mean that the only purpose of aggregation is to exclude the potential threat of cycle?! I may give counterexample: any object is simultaneously the whole and the part of itself.
Relationship doesn't mean inevitably association PERIOD
Association doesn't mean Aggregation or Composition PERIOD
Association doesn't mean having necessarily references THREE PERIODS
Well, all [composition] it adds over aggregation is lifetime responsibility -
--------------------------------------------------------------------------------
I do not agree because association already has life-time responsibility.
I would tell that foreign-key relationship needs in almost cases Association class.
To me analysis is disintegration of problem domain to atomic elements and notions. Design is synthesis from those bricks. I do not know anyone who builds a building using floors, corners, rooms of the previous building...
You are right.Analysis and Design are to be done iteratively.
Piyush
I agree. But this doesn't mean using unfinished/incomplete analysis results at each stage!
You cannot find a single book on patterns, CASE, OOAD without bank accounts model!
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
Originally posted by Ilja Preuss:
I think there is even more required than detail about the domain. Keep in mind that the *only* job of the design is to foster implementation - and the implementation is much more about the solution than about the problem.
So even if you had enough detail to model the domain (what you probably would call an analysis model), there simply is no mechanic way to get to the design. You *need* to think about the solution (the implementation) to give it a first rough shape (what you probably would call the initial design in this context).
So even if in the domain an Account "HAS AN" AccountType, there is no direct way to tell wether Account should have an association to AccountType, or wether those classes should even exist in the design.
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
Originally posted by Guennadiy VANIN:
Account instance might not be created at all as far as semantically Account is just abstract notion or even an interface to concrete SavingsAccount and CurrentAccount. It is overtypical model example in all UML compliant illustrations.
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|