mail.dsp
11/17/2008 6:27:00 AM
On Nov 15, 4:12 pm, maverik <maverik.m...@gmail.com> wrote:
> 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