1 big class or 1 for each frame - Choice? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Manatax
Knows some wx things
Knows some wx things
Posts: 37
Joined: Fri Feb 06, 2009 9:28 pm

1 big class or 1 for each frame - Choice?

Post by Manatax »

First. I'm really sorry if this has been talked before, I have my noob hat on :lol: .

The issue at hand: I'm creating an aplication and it should have lots of stuff... but my main concern at this point is: Should I put every frame, panel, dialog, etc on 1 "cpp & h"? or should I create 1 "cpp & h" for each frame and/or dialog?

In the first option, communication between the objects seems to be easier, but in the second option it kinda seems more organized and stuff...

Any advanced user care to give me a tip here?

Thanks for your time ppl :D
"If it ain't broken... give it a little more time... it will break eventually..."
computerquip
Experienced Solver
Experienced Solver
Posts: 72
Joined: Fri Feb 20, 2009 7:13 pm
Location: $(#wx)\src

Post by computerquip »

If your declaring a class that's already made, then no. You would just link to the header of that class and then declare the class.

Code: Select all

MyClass aClass;
//or
MyClass aClass(); //Default constructor of class. 
It's very common practice to make separate files for the sake of code reuse. Though it is valid to stick everything inside of one big as OMGHELL .cpp and .h file. But it becomes very unmanageable and almost to a stupid level of frustration and broken keyboards. It should be based completely on your opinion of organization and management. If you think that every extended and new class deserves a new .h and .cpp then go for it. If you think that they don't, then you need to learn more about design lololol. If the below link contradicts what I said, please go with it. I suck at design lol. It makes my programs look like a big pile of dog du du as well.

http://www.cprogramming.com/tutorial/class_design.html
Manatax
Knows some wx things
Knows some wx things
Posts: 37
Joined: Fri Feb 06, 2009 9:28 pm

Post by Manatax »

Ok, sounds cool. It's kinda with what I started.
I guess I will have to work more on comm now :)
Thx M8!
"If it ain't broken... give it a little more time... it will break eventually..."
Post Reply