Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Solstice

Factories or ct registration?

This topic is 6025 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ever had one of those designs in which you can go one of several different ways and still reach the same result? Each way of course has it''s own little nicities, but nothing profound? Here''s mine: I have an object XMLParser which creates a tree of type XMLEntity. This class is nothing more than an interface for several other classes, XMLTag, XMLData, XMLComment...(yes, I like XML). I would like to provide customisation for the parser by altering these classes and not the parser itself. I think this can be done one of two ways: 1. The XMLEntity could have a virtual static method used to contruct new objects of itself. This function would be "registered" via pointer in the Parser object for each type (Tag, Data, Comment...). In this way, one can register a different static constructor to modify the default behavior of that class. 2. Several virtual build...() functions are be part of XMLParser. These functions construct a new object of that type. You would subclass XMLParser to customize. Another thouoght is to use the factory pattern and pass new factories to the XMLParser, a bit cleaner than both but I would really like to see what everyone thinks being that this may be a Object-oriented alternative to Expat. -Solstice deninet.com aeris.deninet.com "...I was given three choices, the earth, the stars, or..."

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!