Application design

M

maverik

Hi all.

I'm writting some kind of text processing application (in C++). It has
about 20 classes. Of course, it also has some settings (such as text
color, text size, text family, etc). This settings is represented as
class with static members, like this:

Settings.h

class Settings {
...
static std::string TextFamily;
static int TextSize;
static std::string TextColor;
... // Many other options (about 100)
};

So, other classes use this class:

MyAnotherClass.cpp

voif foo() {
if(Settings.TextSize == 12) { ... }
...
};

My questions:
Is this bad design?
What advantages or disadvantages it has?
Can you suggest me how to organize settings in better way?

Thanks.
 
M

mail.dsp

Hi all.

I'm writting some kind of text processing application (in C++). It has
about 20 classes. Of course, it also has some settings (such as text
color, text size, text family, etc). This settings is represented as
class with static members, like this:

Settings.h

class Settings {
...
static std::string TextFamily;
static int TextSize;
static std::string TextColor;
... // Many other options (about 100)

};

So, other classes use this class:

MyAnotherClass.cpp

voif foo() {
if(Settings.TextSize == 12) { ... }
...

};

My questions:
Is this bad design?
What advantages or disadvantages it has?
Can you suggest me how to organize settings in better way?

Thanks.

Go and study some OO design pattern books and use some design patterns
like Flyweight etc. It will give you a wide thought.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top