Still Plinking Away, Part the First

So of you might remember this post some weeks ago where I came up with a huge org-chart of all the different roles they I thought i would need for may AD&D characters.

Well I was just now getting into the actual instantiation of characters and having them do something well I ran into a number of differing choices that I sort of discussed here on this post. I found that the visitor pattern worked very well for character creation (that one is almost all wrapped up) now that I am getting to the other side of the game I have t0 make a choice of which design or pattern to use.

Well I do have some choices I could use a decorator pattern ie simply instantiate a basic character class then decorate it with all the required roles. However so far I have found that this might be best suited when playing the game. For example when a character is bitten by a giant spider I just add a role called 'poisoned' to the instance and watch them die a slow and painful death.

So what to do. Well the 'Factory' pattern is most useful I find in this situation and MooseX does have a number that I will have a look at but the three I have my eye on are

  1. MooseX-AbstractFactory
  2. MooseX::ClassCompositor
  3. MooseX::ShortCut::BuildInstace

Stay tuned as I go over each in turn to see if they have what I need


Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations