469,621 Members | 2,300 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

How to implement this case in C#?

Dear Experts,

Could you please provide you comment to me? Thanks

An Exhibition has many Halls, and different Booth Types
If exhibition is not exist, hall and booth type will not exist too.

In the object level, my design like follow, is this design elegance?

Class Exhibition
//Assume setter/Getter method of halls is available
//Assume setter/Getter method of booth types is available

private ArrayList halls;
private ArrayList boothTypes;

Class ExhibitionController
public void addExhibition(Exhibition) {
//implement
}

public void addHall(Hall) {
//implement
}

public void addBoothType(Boothtype) {
//implement
}

public Exhibition getExhibition(exhibition id) {
// get exhibition from database
// get hall from database
// get booth type from database
// return exhibition
}
}
Aug 25 '06 #1
4 1428
SP

"PenguinPig" <肸睫份@そwrote in message
news:uS****************@TK2MSFTNGP05.phx.gbl...
Dear Experts,

Could you please provide you comment to me? Thanks

An Exhibition has many Halls, and different Booth Types
If exhibition is not exist, hall and booth type will not exist too.
You have not stated if there is any relationship between the halls and the
booth types. Is there?
In the object level, my design like follow, is this design elegance?

Class Exhibition
//Assume setter/Getter method of halls is available
//Assume setter/Getter method of booth types is available

private ArrayList halls;
private ArrayList boothTypes;

Class ExhibitionController
public void addExhibition(Exhibition) {
//implement
Don't like the "controller" name here. This seems more like a Registry
object where you will add and retrieve exhibitions from with the possibility
of it delegating to a builder if the requested exhibition is not found in
the registry.
>
public void addHall(Hall) {
//implement
Don't like this either. It would seem that as a hall is part of an
exhibition that you would do
Hall hall = myExhibition.Halls.Add();
Although if halls are shared amongst many different exhibitions then again
keeping the halls in a registry object is okay assuming that the same hall
in different exhibitions is considered to have the same identity.
>
public void addBoothType(Boothtype) {
//implement
}

public Exhibition getExhibition(exhibition id) {
// get exhibition from database
// get hall from database
// get booth type from database
// return exhibition
}
this seems okay and you should delgate this to a builder type object.

SP

Aug 25 '06 #2
Dear SP

exhibition:hall = 1:m
exhibition:boothtype= 1:m

Thanks~
"SP" <ec***********@hotmail.comwrote in message
news:eg**************@TK2MSFTNGP05.phx.gbl...
>
"PenguinPig" <肸睫份@そwrote in message
news:uS****************@TK2MSFTNGP05.phx.gbl...
Dear Experts,

Could you please provide you comment to me? Thanks

An Exhibition has many Halls, and different Booth Types
If exhibition is not exist, hall and booth type will not exist too.

You have not stated if there is any relationship between the halls and the
booth types. Is there?
In the object level, my design like follow, is this design elegance?

Class Exhibition
//Assume setter/Getter method of halls is available
//Assume setter/Getter method of booth types is available

private ArrayList halls;
private ArrayList boothTypes;

Class ExhibitionController
public void addExhibition(Exhibition) {
//implement

Don't like the "controller" name here. This seems more like a Registry
object where you will add and retrieve exhibitions from with the
possibility
of it delegating to a builder if the requested exhibition is not found in
the registry.

public void addHall(Hall) {
//implement

Don't like this either. It would seem that as a hall is part of an
exhibition that you would do
Hall hall = myExhibition.Halls.Add();
Although if halls are shared amongst many different exhibitions then again
keeping the halls in a registry object is okay assuming that the same hall
in different exhibitions is considered to have the same identity.

public void addBoothType(Boothtype) {
//implement
}

public Exhibition getExhibition(exhibition id) {
// get exhibition from database
// get hall from database
// get booth type from database
// return exhibition
}

this seems okay and you should delgate this to a builder type object.

SP

Aug 25 '06 #3
Good evening,

in your case you should better use the Interface IList given in
System.Collections or better the generic Interface IList<Tgiven in
System.Collections.Generic. Also use the name Collection for a
controller that has all exhibitions. That's commonly used by Microsoft.

See the following Code:

public class Exhibition
{
List<Hallshalls;
List<BoothtypeboothType;
}

public class ExhibitionCollection : System.Collections.Generic.IList
{
public void Add(Exhibition item)
{
}

public bool Remove(Exhibition item)
{
}
}

The interface contains several more methods that need to be implemented.
Use the mouse pointer placed over the interface name in VS .NET 2005. I
recommend that you organize the items within the collection by previous
and next pointers.

Bye

Matthias
PenguinPig schrieb:
Dear SP

exhibition:hall = 1:m
exhibition:boothtype= 1:m

Thanks~
"SP" <ec***********@hotmail.comwrote in message
news:eg**************@TK2MSFTNGP05.phx.gbl...
>"PenguinPig" <肸睫份@そwrote in message
news:uS****************@TK2MSFTNGP05.phx.gbl...
>>Dear Experts,

Could you please provide you comment to me? Thanks

An Exhibition has many Halls, and different Booth Types
If exhibition is not exist, hall and booth type will not exist too.
You have not stated if there is any relationship between the halls and the
booth types. Is there?
>>In the object level, my design like follow, is this design elegance?

Class Exhibition
//Assume setter/Getter method of halls is available
//Assume setter/Getter method of booth types is available

private ArrayList halls;
private ArrayList boothTypes;

Class ExhibitionController
public void addExhibition(Exhibition) {
//implement
Don't like the "controller" name here. This seems more like a Registry
object where you will add and retrieve exhibitions from with the
possibility
>of it delegating to a builder if the requested exhibition is not found in
the registry.
>> public void addHall(Hall) {
//implement
Don't like this either. It would seem that as a hall is part of an
exhibition that you would do
Hall hall = myExhibition.Halls.Add();
Although if halls are shared amongst many different exhibitions then again
keeping the halls in a registry object is okay assuming that the same hall
in different exhibitions is considered to have the same identity.
>> public void addBoothType(Boothtype) {
//implement
}

public Exhibition getExhibition(exhibition id) {
// get exhibition from database
// get hall from database
// get booth type from database
// return exhibition
}
this seems okay and you should delgate this to a builder type object.

SP

Aug 25 '06 #4
You class seems ok to me.

chanmm

"PenguinPig" <肸睫份@そwrote in message
news:em****************@TK2MSFTNGP03.phx.gbl...
Dear SP

exhibition:hall = 1:m
exhibition:boothtype= 1:m

Thanks~
"SP" <ec***********@hotmail.comwrote in message
news:eg**************@TK2MSFTNGP05.phx.gbl...
>>
"PenguinPig" <肸睫份@そwrote in message
news:uS****************@TK2MSFTNGP05.phx.gbl...
Dear Experts,

Could you please provide you comment to me? Thanks

An Exhibition has many Halls, and different Booth Types
If exhibition is not exist, hall and booth type will not exist too.

You have not stated if there is any relationship between the halls and
the
booth types. Is there?
In the object level, my design like follow, is this design elegance?

Class Exhibition
//Assume setter/Getter method of halls is available
//Assume setter/Getter method of booth types is available

private ArrayList halls;
private ArrayList boothTypes;

Class ExhibitionController
public void addExhibition(Exhibition) {
//implement

Don't like the "controller" name here. This seems more like a Registry
object where you will add and retrieve exhibitions from with the
possibility
>of it delegating to a builder if the requested exhibition is not found in
the registry.
>
public void addHall(Hall) {
//implement

Don't like this either. It would seem that as a hall is part of an
exhibition that you would do
Hall hall = myExhibition.Halls.Add();
Although if halls are shared amongst many different exhibitions then
again
keeping the halls in a registry object is okay assuming that the same
hall
in different exhibitions is considered to have the same identity.
>
public void addBoothType(Boothtype) {
//implement
}

public Exhibition getExhibition(exhibition id) {
// get exhibition from database
// get hall from database
// get booth type from database
// return exhibition
}

this seems okay and you should delgate this to a builder type object.

SP


Aug 26 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Medi Montaseri | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.