473,499 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OO-Question

Hey,

I just started out using Visual C# (Visual Studio .NET 2003), but am having
a little problem figuring out where to place my datastructure. I've worked
with programming alot before, but this is my first real object oriented
project. To describe my problem, I'll just outline the project I'm working
on. Basically, I'm working on a questionaire program that has a general
static datastructure used for holding the information about the
questionaire. Where do I place this general datastructure? If using several
different classes/forms, I'd have to pass references along between them,
unless I can place it somewhere general.. But OO-programming is all about
getting rid of the global variables :P Um, it's a bit hard to explain the
problem completely, hope some of you people understand this - probably -
trivial problem, and can give me a quick solution :)

Thanks,
- Rasmus.

Ps. I searched around for other newsgroups, but this one seemed to be the
one fitting my problem best - I apologize if this is completely off-topic :)
Nov 15 '05 #1
5 1160
Well, to throw a few thoughts

If the questions vary wildly you might want to create custom controls. A
base question control and any number of derived types from that. A
question control would receive information to display from the
Questionaire class (question, images, alternatives etc) and hold the
answer for retrieval. Questions would have no knowledge of eachother (hm,
sub questions might get tricky). The questionaire class would parse any
question documents, create the controls, process and questions and create
any answer documents. Hm, tricky topic. The best solution might be
something completely different.

Happy Coding!
Morten

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode and Nostalgia enabled
Nov 15 '05 #2

"Rasmus Kromann-Larsen" <ra****@kromann-larsen.dk> wrote in message
news:bu**********@news.net.uni-c.dk...
Hey,

I just started out using Visual C# (Visual Studio
.NET 2003), but am having a little problem figuring
out where to place my data structure.

Are you at all familiar with the C# language, or is this your very first
attempt at a project using it ? If the latter, I'd recommend first
completing some tutorials and the associated exercises. A Google search will
turn up many of these.

I've worked with programming alot before, but this is my
first real object oriented project.

So, you're familiar with programming [even GUI-based programming ?], but not
using an object oriented programming language [OOP] ?

To describe my problem, I'll just outline the project I'm
working on. Basically, I'm working on a questionaire
program that has a general static data structure used for
holding the information about the questionaire. Where do
I place this general data structure? If using several
different classes/forms, I'd have to pass references along
between them, unless I can place it somewhere general.

If you're not familar with OOP then it would seem pointless outlining a
possible design for this problem. I'd suggest:

* You first complete some tutorials as described earlier

* Put together a design that will work as a console-based
application [the tutorials will contain suitable samples]

* If it is a GUI-based solution you are after, then a
Windows Forms tutorial is recommended, maybe
even consulting a book like:

'Programming Windows with C#' by C. Petzold

But OO-programming is all about getting rid of the global
variables :P

OOP is about much more than getting rid of global variables [though, to be
fair, OO finds good ways to hide them - it renames them 'singletons' ;)].

Um, it's a bit hard to explain the problem
completely, hope some of you people understand this
- probably - trivial problem, and can give me a quick
solution :)

No, it's not a trivial problem. The solution is the advice I gave earlier.

Ps. I searched around for other newsgroups, but this one
seemed to be the one fitting my problem best - I
apologize if this is completely off-topic :)


Well. if your question is C#-related, then it is on-topic :) ! I suspect,
though, at this stage, you don't have enough OO or C# knowledge to make a
start on your project which is why I again recommend completing a tutorial
or more on C# and/or Windows Forms.

I hope this helps.

Anthony Borla
Nov 15 '05 #3
Rasmus,

First, let me first say that one principle of object oriented design (OOD)
is a single instance class called a "Singleton". This class can be used to
hold information used by all threads. It sounds like this is what you want.
And by the way, yes this is a global. And no, globals are not bad. They
have just been widely miss-used and in C# they are created the first time
they are needed making them hard to catch any errors. I'm sure you can find
many newsgroup threads on Singletons.

As for designing the data structure that depends on the goals your trying to
achieve. For example if a major design goal is speed over flexibility the
hard coding field elements for each question answer may be warranted.

It's your world, make as you see fit. Hope this helps.

--
Glen Jones MCSD

"Rasmus Kromann-Larsen" <ra****@kromann-larsen.dk> wrote in message
news:bu**********@news.net.uni-c.dk...
Hey,

I just started out using Visual C# (Visual Studio .NET 2003), but am having a little problem figuring out where to place my datastructure. I've worked
with programming alot before, but this is my first real object oriented
project. To describe my problem, I'll just outline the project I'm working
on. Basically, I'm working on a questionaire program that has a general
static datastructure used for holding the information about the
questionaire. Where do I place this general datastructure? If using several different classes/forms, I'd have to pass references along between them,
unless I can place it somewhere general.. But OO-programming is all about
getting rid of the global variables :P Um, it's a bit hard to explain the
problem completely, hope some of you people understand this - probably -
trivial problem, and can give me a quick solution :)

Thanks,
- Rasmus.

Ps. I searched around for other newsgroups, but this one seemed to be the
one fitting my problem best - I apologize if this is completely off-topic :)

Nov 15 '05 #4
You are a darling - that was exactly the information I needed, thanks alot
:) I have worked with OO-oriented stuff before - but it's just that most of
the tutorials you go through doesn't really implement 'bigger' applications,
where stuff like this might be needed. I have no problem creating the
datastructures myself :)

Thanks a bunch,
- Rasmus.

"Glen Jones MCSD" <gl********@mailhot.com> wrote in message
news:rd********************@comcast.com...
Rasmus,

First, let me first say that one principle of object oriented design (OOD)
is a single instance class called a "Singleton". This class can be used to hold information used by all threads. It sounds like this is what you want. And by the way, yes this is a global. And no, globals are not bad. They
have just been widely miss-used and in C# they are created the first time
they are needed making them hard to catch any errors. I'm sure you can find many newsgroup threads on Singletons.

As for designing the data structure that depends on the goals your trying to achieve. For example if a major design goal is speed over flexibility the
hard coding field elements for each question answer may be warranted.

It's your world, make as you see fit. Hope this helps.

--
Glen Jones MCSD

"Rasmus Kromann-Larsen" <ra****@kromann-larsen.dk> wrote in message
news:bu**********@news.net.uni-c.dk...
Hey,

I just started out using Visual C# (Visual Studio .NET 2003), but am having
a little problem figuring out where to place my datastructure. I've worked with programming alot before, but this is my first real object oriented
project. To describe my problem, I'll just outline the project I'm working on. Basically, I'm working on a questionaire program that has a general
static datastructure used for holding the information about the
questionaire. Where do I place this general datastructure? If using

several
different classes/forms, I'd have to pass references along between them,
unless I can place it somewhere general.. But OO-programming is all about getting rid of the global variables :P Um, it's a bit hard to explain the problem completely, hope some of you people understand this - probably -
trivial problem, and can give me a quick solution :)

Thanks,
- Rasmus.

Ps. I searched around for other newsgroups, but this one seemed to be the one fitting my problem best - I apologize if this is completely

off-topic :)


Nov 15 '05 #5
I do suggest one slim book that will really help with OO programming.
It is called Introduction to Design Patterns by Alan Shalloway.

Problems like the one you are facing come up all the time. This book will
give you a good set of "best practices" in OO design, and introduce you to
an
entire body of literature that will get you past the "simple" designs.

(He has a good section on Singletons, as well)

Hope this helps, and good luck.

--- Nick

"Rasmus Kromann-Larsen" <ra****@kromann-larsen.dk> wrote in message
news:bu**********@news.net.uni-c.dk...
You are a darling - that was exactly the information I needed, thanks alot
:) I have worked with OO-oriented stuff before - but it's just that most of the tutorials you go through doesn't really implement 'bigger' applications, where stuff like this might be needed. I have no problem creating the
datastructures myself :)

Thanks a bunch,
- Rasmus.

"Glen Jones MCSD" <gl********@mailhot.com> wrote in message
news:rd********************@comcast.com...
Rasmus,

First, let me first say that one principle of object oriented design (OOD)
is a single instance class called a "Singleton". This class can be used to
hold information used by all threads. It sounds like this is what you

want.
And by the way, yes this is a global. And no, globals are not bad. They
have just been widely miss-used and in C# they are created the first time they are needed making them hard to catch any errors. I'm sure you can

find
many newsgroup threads on Singletons.

As for designing the data structure that depends on the goals your trying to
achieve. For example if a major design goal is speed over flexibility

the hard coding field elements for each question answer may be warranted.

It's your world, make as you see fit. Hope this helps.

--
Glen Jones MCSD

"Rasmus Kromann-Larsen" <ra****@kromann-larsen.dk> wrote in message
news:bu**********@news.net.uni-c.dk...
Hey,

I just started out using Visual C# (Visual Studio .NET 2003), but am

having
a little problem figuring out where to place my datastructure. I've

worked with programming alot before, but this is my first real object oriented project. To describe my problem, I'll just outline the project I'm working on. Basically, I'm working on a questionaire program that has a general static datastructure used for holding the information about the
questionaire. Where do I place this general datastructure? If using

several
different classes/forms, I'd have to pass references along between them, unless I can place it somewhere general.. But OO-programming is all about getting rid of the global variables :P Um, it's a bit hard to explain the problem completely, hope some of you people understand this - probably - trivial problem, and can give me a quick solution :)

Thanks,
- Rasmus.

Ps. I searched around for other newsgroups, but this one seemed to be the one fitting my problem best - I apologize if this is completely

off-topic
:)



Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2201
by: lawrence | last post by:
I asked a lot of questions in May about how to organize OO code. I didn't get great answers here, but someone here suggested that I look the Eclipse library, which was a good tip. Looking at its...
51
5200
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
63
5063
by: Davor | last post by:
Is it possible to write purely procedural code in Python, or the OO constructs in both language and supporting libraries have got so embedded that it's impossible to avoid them? Also, is anyone...
7
1499
by: Chinook | last post by:
OO approach to decision sequence? --------------------------------- In a recent thread (Cause for using objects?), Chris Smith replied with (in part): > If your table of photo data has...
1
2587
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
8
1713
by: Allan Ebdrup | last post by:
I just had a discussion with one of my fellow programmers. We have a class for doing some logging and sending an email, it has 5 different scenarioes of loggin that are common enough to share a...
17
2031
by: Nick | last post by:
I am doing some research into building web applications using Object Oriented techniques. I have found the excellent patterns section on the MSDN site, but other than that I cannot find any good,...
6
2327
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
34
2151
by: Nate | last post by:
Scenario: In a commerce application, there is a Product class. Along with the Product class there is a form (the text that goes in the labels of the input controls) for inputting and updating...
7
1630
by: Kay Schluehr | last post by:
On 20 Sep., 18:33, Bruno Desthuilliers <bdesth.quelquech...@free.quelquepart.frwrote: This is correct but it detracts from a more general problem of language "paradigms". Assume you type ...
0
7128
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
7006
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
7215
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...
1
6892
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...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4597
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...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
294
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...

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.