473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1573
SP

"PenguinPig" <¥øÃZ½Þ¤j·Ý@¤½¥qwrote 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" <¥øÃZ½Þ¤j·Ý@¤½¥qwrote 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" <¥øÃZ½Þ¤j·Ý@¤½¥qwrote 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" <¥øÃZ½Þ¤j·Ý@¤½¥qwrote 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" <¥øÃZ½Þ¤j·Ý@¤½¥qwrote 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Medi Montaseri | last post by:
Hi, I think my problem is indeed "how to implement something like java's final in C++" The long version.... I have an abstract base class which is inherited by several concrete classes. I...
6
by: Charles Law | last post by:
This is going to seem like a basic OO question, but it comes up and bites me every now and again. Suppose we have a multi-tiered protocol to implement, what is the logical, OO way to design the...
11
by: me | last post by:
I have got all my pages to comply with the W3C validator, except this one line as below. I need to keep the line (or the functionalilty) but it would be nice to implement it in a way that gives...
3
by: ATS | last post by:
HOWTO Implement LoadLibrary, GetProcAdress, and FreeLibrary. Below is code that I want to be able to use simple LoadLibrary\GetProcAddress\FreeLibrary technqiues on. I've used the code that was...
5
by: nobody | last post by:
With Visual C++ 2005 beta 2, I get the below compling error for the following code. I think this error is not acceptable to me because int::typeid is a constant and is known to compiler when...
2
by: bp | last post by:
Hi, I try to use my own PreviewDialog with a PrinPreviewControl, to preview a document of type MyPrintDocument, and I want to implement the PrintRange functionnality (print some pages between 2...
8
by: fniles | last post by:
I have a collection inside a class, sometimes when I add to the collection, I get the error "At least one object must implement IComparable". What does the error mean ? Thanks. Public Class...
2
by: hakimks | last post by:
You are provided with a sample C programs: calc.c, which implements a reverse polish notation calculator. Study it carefully. This program uses a stack (of course!) but the stack implementation is...
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.