|
|
stbenge <stb### [at] hotmailcom> wrote:
> A simple (tile based) level editor is my current project. Already, I
> have about two dozen global variables. It's getting messy, and I'm
> having to rewrite code to handle, say, foreground tile editing as
> opposed to background tile editing.
High-quality object-oriented design is far, far from trivial to do.
It requires years of OOD and OO programming experience, and even then
it usually requires several iterations of design-use-redesign.
Making a good, encapsulated, abstract, flexible and reusable graphical
editor is a rather difficult tasks of OOD in general (regardless of the
programming language used) and C++ programming in particular. I know this
because I have been working on exactly such a thing as my payjob.
You are on the right track, though: Global variables should and can
be avoided (there are very few exceptions to this rule, of which eg.
std::cout is a good example (I consider std::cout to be a "global" variable
even though it's inside a namespace), where practicality compensates
globality more than enough), and clean abstract designs should be preferred.
--
- Warp
Post a reply to this message
|
|