Originally posted by titan sim:
Basically, I want to model a person and company (he works for). Thus, I've the Person and Company class. A person can work for many company and a company can have many employees (Person object). How can I actually model this type of real world example?
I've try to do some coding, however, is totally stuck here when I want to do further coding (ie how to get the person's company, and how to get the company's employee).
And if there is any url where I can learn about this type of real world example, pls let me know. thanks.
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
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
Basically, I want to model a person and company (he works for). Thus, I've the Person and Company class. A person can work for many company and a company can have many employees (Person object). How can I actually model this type of real world example?
I've try to do some coding, however, is totally stuck here when I want to do further coding (ie how to get the person's company, and how to get the company's employee).
Originally posted by Ilja Preuss:
Not an URL, but a book: http://www.javaranch.com/bunkhouse/Process.jsp#0135974445
Originally posted by Frank Carver:
It looks as if you might be confusing the idea of a collection of companies, with the idea of a single company.
Consider the following simplified example:
In this example, a Company object represents a single company. it has no need to know that any other Company objects exist. If you want to be able to search for companies by name, you probably need some sort of collection of companies:
Notice that these two classes are broadly similar in structure (a company has a list of employees, a company collection has a list of companies), but different in the detail of their behaviour.
Has this helped, at all?
Help me!Help you!!!
Originally posted by Frank Carver:
It looks as if you might be confusing the idea of a collection of companies, with the idea of a single company.
Consider the following simplified example:
In this example, a Company object represents a single company. it has no need to know that any other Company objects exist. If you want to be able to search for companies by name, you probably need some sort of collection of companies:
Notice that these two classes are broadly similar in structure (a company has a list of employees, a company collection has a list of companies), but different in the detail of their behaviour.
Has this helped, at all?
Help me!Help you!!!
Originally posted by Frank Carver:
It looks as if you might be confusing the idea of a collection of companies, with the idea of a single company.
Consider the following simplified example:
In this example, a Company object represents a single company. it has no need to know that any other Company objects exist. If you want to be able to search for companies by name, you probably need some sort of collection of companies:
Notice that these two classes are broadly similar in structure (a company has a list of employees, a company collection has a list of companies), but different in the detail of their behaviour.
Has this helped, at all?
Originally posted by titan sim:
How should the uml be drawn to show company and companyCollection?
Help me!Help you!!!
SCEA
Originally posted by Roger Zacharias:
Hi!
I have a question on which I am very uncertain:
Imagine you have two classes, e.g. Customer and CreditCard and the Customer can only have one CreditCard. So you have an 1:1 association "owns" between Customer and CreditCard and navigability in both directions.
I am uncertain if I have to show the customerID as an attribute to CreditCard or if this is done implicit???
Or must this be modelled with aggregation???
What do you think?
Roger
Help me!Help you!!!
She'll be back. I'm just gonna wait here. With this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|