By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,827 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

Application design

P: n/a
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.
Nov 15 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2008-11-15 06:12:46 -0500, maverik <ma**********@gmail.comsaid:
>
My questions:
Is this bad design?
What advantages or disadvantages it has?
Can you suggest me how to organize settings in better way?
Design is about specifying how your code will meet its requirements. So
desgin depends on knowing what the requirements are. Without a
statement of requirements it's not possible to evaluate a proposed
design.

"I'm going on vacation. Should I fly or drive?"

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Nov 15 '08 #2

P: n/a
On Nov 15, 4:12 pm, maverik <maverik.m...@gmail.comwrote:
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.

--
Daya
Nov 17 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.