Click here to Skip to main content
15,887,393 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: general window UI design Pin
derek71-Mar-06 3:35
derek71-Mar-06 3:35 
GeneralRe: general window UI design Pin
toxcct1-Mar-06 3:55
toxcct1-Mar-06 3:55 
Questionhow set a global message, same in all process. Pin
FlyWithYou1-Mar-06 2:00
FlyWithYou1-Mar-06 2:00 
AnswerRe: how set a global message, same in all process. Pin
ThatsAlok1-Mar-06 2:39
ThatsAlok1-Mar-06 2:39 
AnswerRe: how set a global message, same in all process. Pin
Ryan Binns1-Mar-06 2:40
Ryan Binns1-Mar-06 2:40 
AnswerRe: how set a global message, same in all process. Pin
jhwurmbach1-Mar-06 3:00
jhwurmbach1-Mar-06 3:00 
QuestionClass Design Question Pin
ldsdbomber1-Mar-06 1:43
ldsdbomber1-Mar-06 1:43 
AnswerRe: Class Design Question Pin
walter761-Mar-06 2:17
walter761-Mar-06 2:17 
You ask a difficult question here. In general a good class design is never easy to make. But try to think in a object-oriented way. First you should define what problem you want to solve. As i can suggest from your post, you made that already. Then try to define the classes. Start with the core of the problem. I try to explain what i do if i invent a new class design from scratch and hope that leads you in the right direction.

1. First i write the problem i like to solve on a piece of paper. I try to put the words in one simple sentence. That helps me to get a crip on the problem.

2. Then i start with the core class. In your case this would be something like C2DArray. I try to keep it as simple as possible first. What do i need the class to do:
- read in a text file
- store the data kept in the text file
- store some header information
- do some simple calculations
These points already define me some member functions:
- C2DArray(const char* filename)
- readFile()
- calculateSomething()
- ...

3. After i got the first simple class i try it out with a simple application. In most cases this is a console application with a lot of printf's.

4. I put more functionality into the class. While i do this, i keep the following in mind:
- If a member function gets too big and i don't understand what's going on anymore i split it
in several subfunctions
- If a class gets too big and i don't understand what's going on anymore i try to generalize
parts of the class into a superclass
In that way you will become more classes and functions on need and you don't get overwhelmed by a mass of classes from the start.

About generalisation, operator overloading etc. Do this only if it is worth the effort and you need it for your application. There are so many class designs where people did operator overloading only cause it looked nice.

I am not sure if this is what you needed. Hope it helps you out a bit. And i am sorry if my English isn't that good. It is not my native language.

Walter


GeneralRe: Class Design Question Pin
ldsdbomber1-Mar-06 5:32
ldsdbomber1-Mar-06 5:32 
GeneralRe: Class Design Question Pin
walter761-Mar-06 5:38
walter761-Mar-06 5:38 
QuestionCracking console app that takes data to stdin. Pin
9ine1-Mar-06 1:02
9ine1-Mar-06 1:02 
AnswerRe: Cracking console app that takes data to stdin. Pin
RobJones1-Mar-06 3:31
RobJones1-Mar-06 3:31 
GeneralRe: Cracking console app that takes data to stdin. Pin
9ine1-Mar-06 5:39
9ine1-Mar-06 5:39 
QuestionConverting HWnd to CWnd Pin
whatever891-Mar-06 0:56
whatever891-Mar-06 0:56 
AnswerRe: Converting HWnd to CWnd Pin
Vinaya1-Mar-06 1:01
Vinaya1-Mar-06 1:01 
AnswerRe: Converting HWnd to CWnd Pin
Nibu babu thomas1-Mar-06 1:03
Nibu babu thomas1-Mar-06 1:03 
AnswerRe: Converting HWnd to CWnd Pin
walter761-Mar-06 1:04
walter761-Mar-06 1:04 
GeneralRe: Converting HWnd to CWnd Pin
whatever891-Mar-06 2:53
whatever891-Mar-06 2:53 
QuestionCombo box height is not increasing Pin
BiswaR1-Mar-06 0:51
BiswaR1-Mar-06 0:51 
AnswerRe: Combo box height is not increasing Pin
khan++1-Mar-06 1:26
khan++1-Mar-06 1:26 
GeneralRe: Combo box height is not increasing Pin
BiswaR1-Mar-06 1:48
BiswaR1-Mar-06 1:48 
GeneralRe: Combo box height is not increasing Pin
khan++1-Mar-06 2:19
khan++1-Mar-06 2:19 
QuestionLost my way in classes and array.. Pin
joostvaningen1-Mar-06 0:50
joostvaningen1-Mar-06 0:50 
QuestionRe: Lost my way in classes and array.. Pin
David Crow1-Mar-06 2:58
David Crow1-Mar-06 2:58 
GeneralRe: Lost my way in classes and array.. Pin
joostvaningen1-Mar-06 3:37
joostvaningen1-Mar-06 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.