Jump to content
  • Advertisement
Sign in to follow this  

[.net] Auto generating simple classes

This topic is 4739 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

Suppose I have an object representing a molecule. I want to use this object for scientific modeling, but in a variety of different ways. In one circumstance I might need a set of properties related to how this molecule will react with light. In another, with a neutron beam. In yet another, both. The possible combinations are numerous. Now suppose I don't want this object to implement all possible interfaces. I want it to implement just those interfaces it needs for a given situation. This is in part because I don't want the extra overhead of using objects that are larger than necessary, and in part because I want to make things simpler for the user. (The user interface uses reflection to allow the user to set or change certain property values, and I don't want him flooded with unnecessary properties to sort through for just those he needs to worry about.) The Facet design pattern doesn't seem appropriate. Which interfaces are exposed is controlled and limited by this pattern, but there's still the issue of dealing with objects much larger than necessary. The visitor pattern doesn't seem right either, because of the extra overhead of invoking the visitor, and it doesn't seem to really solve the problem of many possible combinations of interfaces being used. So this is my idea. Given a set of interfaces, the user or client software can specify just those interfaces needed, and the class will be created dynamically, implementing those interfaces. The core of the class will be the molecule object (a flyweight), which can also be used as a key in a database to get amy availible data on those properties implimented. My questions are: 1. Am I reinventing the wheel here? is there some design pattern or library that already does things like this? 2. Is there a better way of doing this? Thanks. Matt Brown (p.s. please don't move this to general programming. I will be implementing this in C# or managed C++, and am particularly looking for solutions involving the .NET framework.)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!