473,791 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ExhibitionContr oller
public void addExhibition(E xhibition) {
//implement
}

public void addHall(Hall) {
//implement
}

public void addBoothType(Bo othtype) {
//implement
}

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

"PenguinPig " <¥øÃZ½Þ¤j·Ý@¤½¥ qwrote in message
news:uS******** ********@TK2MSF TNGP05.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 ExhibitionContr oller
public void addExhibition(E xhibition) {
//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.Ha lls.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(Bo othtype) {
//implement
}

public Exhibition getExhibition(e xhibition 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:boot htype= 1:m

Thanks~
"SP" <ec***********@ hotmail.comwrot e in message
news:eg******** ******@TK2MSFTN GP05.phx.gbl...
>
"PenguinPig " <¥øÃZ½Þ¤j·Ý@¤½¥ qwrote in message
news:uS******** ********@TK2MSF TNGP05.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 ExhibitionContr oller
public void addExhibition(E xhibition) {
//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.Ha lls.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(Bo othtype) {
//implement
}

public Exhibition getExhibition(e xhibition 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.Collecti ons or better the generic Interface IList<Tgiven in
System.Collecti ons.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<Boothtypeb oothType;
}

public class ExhibitionColle ction : System.Collecti ons.Generic.ILi st
{
public void Add(Exhibition item)
{
}

public bool Remove(Exhibiti on 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:boot htype= 1:m

Thanks~
"SP" <ec***********@ hotmail.comwrot e in message
news:eg******** ******@TK2MSFTN GP05.phx.gbl...
>"PenguinPig " <¥øÃZ½Þ¤j·Ý@¤½¥ qwrote in message
news:uS******* *********@TK2MS FTNGP05.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 ExhibitionContr oller
public void addExhibition(E xhibition) {
//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.Ha lls.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(Bo othtype) {
//implement
}

public Exhibition getExhibition(e xhibition 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******** ********@TK2MSF TNGP03.phx.gbl. ..
Dear SP

exhibition:hall = 1:m
exhibition:boot htype= 1:m

Thanks~
"SP" <ec***********@ hotmail.comwrot e in message
news:eg******** ******@TK2MSFTN GP05.phx.gbl...
>>
"PenguinPig " <¥øÃZ½Þ¤j·Ý@¤½¥ qwrote in message
news:uS******* *********@TK2MS FTNGP05.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 ExhibitionContr oller
public void addExhibition(E xhibition) {
//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.Ha lls.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(Bo othtype) {
//implement
}

public Exhibition getExhibition(e xhibition 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
23146
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 have a group of methods that I'd like to implement in the base class
6
3831
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 handler? For example, let's say that we have to implement the ISO 7-layer protocol, or something like an Allen-Bradley master-slave protocol. At the lowest layer we might only need to top and tail the data being transported, such as DLE STX DLE...
11
43969
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 me a 100% pass with W3C. Any ideas? Thanks.
3
6507
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 initially placed on the .NET 247 forum as such: http://dotnet247.com/247reference//msgs/28/140461.aspx I have expanded it here to let one call any/all kinds of functions. The idea is that a "MASTER" Invoke function takes arrays that explain...
5
3118
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 compiling. Will VC++ 2005 implement switch with case int::typeid in the final release? error C2450: switch expression of type 'System::Type ^' is illegal 1> No user-defined-conversion operator available, or 1> Integral expression required
2
6623
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 values). I noticed that we can specified the PrintRange, FromPage and ToPage properties of the PrintDocument.PrintSettings object, but, as said in MSDN : "The FromPage, ToPage and PrintRange can also be set programmatically,
8
14759
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 SessionClass Private Quotes As Collection = New Collection Sub NewQuote(ByVal Message As String) Dim swError As StreamWriter
2
19338
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 missing and you have to add it. You are to use the linked list structure defined within the program, to implement a stack. In short, you need to implement the functions pop() and push() using a linked list. You are provided with calc-array.c which...
20
3097
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 like 65% of the time of the second routine. Yet both do the same thing. However, the second one seems better in terms of the way the code is written since it helps encapsulate the transformation in the inner loop better making it easier to read,...
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.