944,142 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 2344
  • C# RSS
May 4th, 2006
0

How to use good oo-structure?

Expand Post »
Hi.
I am stuck when it comes to plan my application.
The purpose is to importdata from a database and export it to a cvs file. During the transfer should some data be validated (email adress). How shuld one build such a thing in good OO-structure.
I have writen a main class wich have communciate with a dbConn class, importClass, exportClass. The data is sent all over by Hashtable and strings, this does't feel like good OO.
Plase give me a hint in the right direction.
Br
Matt
Sweden
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
matt87 is offline Offline
1 posts
since May 2006
May 5th, 2006
0

Re: How to use good oo-structure?

Usually, it helps me to draw out my code, using something like UML, or just a pen and paper.

In most circumstances, I use a wrapper class to do all of the talking to my database. That way, all of the calling classes/methods don't have to know anything about what type of database I'm connecting to.

Encapsulation is the word of the day in this matter-- the thing to focus on is this question:

"If I change something in class A, will I have to change anything in Class B to keep using Class A with it?"

If your answer is yes, then you probably need to change something in your design. The whole idea with object orientation is to have the object you've created be almost entirely responsible for doing stuff to itself. At least, that's how I understand it.

Can you post some code snippets of some parts that make you uneasy about your design? I'll admit I'm somewhat of a noob still at this game, but after reading the book Object Oriented Thought Process (disclaimer:informational link, no referrals, or anything), I really feel stronger in what exactly you're supposed to accomplish with OO design. I'm not through with the book yet, but they really reinforce the idea of encapsulation in EVERYTHING they do.

Basically, make a method that describes what you want to do. Then, the class that instantiated your object can call it, without knowing anything about what the method actually does. If done right, you can completely change the way your method works, but if you return the same types of values, and accept the same parameters as before, then the instantiating class will be none the wiser that you've changed anything
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Cannot Get Memory To Release
Next Thread in C# Forum Timeline: C# beginner





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC