Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

What should I name my module?

by BerntB (Deacon)
on Sep 07, 2005 at 23:56 UTC ( #490034=perlquestion: print w/ replies, xml ) Need Help??
BerntB has asked for the wisdom of the Perl Monks concerning the following question:

Where in the module name hierarchy should my code go?

I've (almost) written a simple modelling system (not "OO modelling", as in the comp-sci term). It is used to model something that can be described by a hierarchy of objects. The objects, the rules for inheritance and so on are defined by code and configuration files.

I wrote this specification system to implement the design part of an old favorite game from long ago, which AFAIK has never been fully implemented before. (-: Yes, this was one of my life goals. :-)

It was quite hard to write the design framework and it should be a good fit for other modelling problems. I have no idea what this will be usable for, outside of over complex board games.

So where in the module name hierarchy should my code be? Hardly in "Game::"?

I'm now writing a simple CGI user interface and will have to write a new example with new .t files (my only real example is for that game, which is copyrighted) -- and then it is finally first upload to CPAN!

So, a second question is -- any neat Monk nodes about how to package the small CGI test application for install?

Update 3:

I am trying a new version of description of this in my scratchpad.

Update 2:

Monks has pointed out that the above description was much too vague to give naming advice. :-)

OK, here is another definition.

The problem I wrote this for was designing a vehicle in a game. It is a hard problem that no one ever solved, because there are lots of rules with lots of exceptions.

1. Consider mapping the vehicle design onto an XML document, with the tags as parts (physical or logical) of the vehicle.

2. Then let the XML tags be objects. Let the objects have an inheritance hierarcy, too. (Something like building a graphical interface from objects, where you subclass e.g. a Pane class and add your own specific data.)

3. Now you can have lots of standard behaviour and override the behaviour in local places -- in a way that doesn't result in too d.mn complex code.

4. Add some simple logic for letting a changed value in one object influence other objects (like a spreadsheet), rules for allowing a hierarchy of objects, etc.

5. Voila, a design system that can model quite complex rule systems. But not a simulation handler, because there is no concept of time, etc. It is just the Model part of a MVC.

There should be similar systems, but I've never heard of them. For some kind of problems, this should be very good.

(-: If this really is new, which I doubt, wonder if some US Monks are writing a patent application right now...? It should be patentable over there. :-)

Update:

A definition of an object in the hierarchy is going to look something like this. So there is an inheritance hierarchy of objects. Then there is a build hierarchy. What objects can be above/below others are specified. Lots of other rules are also added.

# Class definitions, hierarchical: # (Not exact syntax.) # Variables are typed. The 'ShowPriority' part hints # to the GUI if they are to be emphasised. ClassDef name=Chassis sup=CWSpace type=abstract DefVal name="vehicletype" type=enum inherit=true ShowPriority=high enumvalues=(car motorbike trike) # These depends upon other objects. # (Code updating these is called when they changes.) DefVal name=acceleration type=int inherit=true ShowPriority=( 0 high 5 low default normal) #(Hints to GUI.) DefVal name=maxspeed type=int inherit=true ShowPriority=high DefVal name=maxload min=0 type=int inherit=true ShowPriority=high #(Maxweight) # Objects below in hierarchy checks these. DefVal name=FP type=bool usermod=true inherit=true ShowPriority=high description="Fire Proof armor?" # (And lots of other details.) EndClassDef # ... # This is a (simplifed) specification for the Driver # object, which is added automatically to a design. # The 'allowbelow' list specifies those objects that # are lelal sub-objects to Driver. (Those that # classify themselves as 'personal'.) # The '_class_0-1' is a specification of the number # of objects allowed. ClassDef name=Driver sup=People type=obj allowbelow= ( personal _class_0-1 ) setDefaultValue name=space value=2 ShowPriority=low setDefaultValue name=weight value=150 ShowPriority=low EndClassDef # There are some code overrides that check additions # below the Driver object, too.

Comment on What should I name my module?
Download Code
Re: What should I name my module?
by eff_i_g (Curate) on Sep 08, 2005 at 00:09 UTC
    Searching for 'Game' on CPAN gives varied results; some used a prefix of Game or Games, others placed Game at the end. However, Games:: seems to be the majority: Games::CarWars?

    use strict; use Devo; $whip->it(*GOOD);
      I can't publish the Car Wars part. S J Games would sue. Yes, I asked. (They didn't answer when I asked if it would be enough if I put a copyright notice on the CW implementation.)

      This CPAN release won't be about CW. I think it won't be used for games at all.

        Games::AutomobileFights ? ;-)
Re: What should I name my module? (no idea)
by tye (Cardinal) on Sep 08, 2005 at 03:08 UTC

    If you can't come up with even part of a name for it after you wrote most of it, then I can't come up with a name for it based on a vague or at least imprecise description.

    Be much more specific and include at least some sample usage to help us understand what you mean by "model".

    - tye        

      If you can't come up with even part of a name for it after you wrote most of it, then I can't come up with a name for it based on a vague or at least imprecise description.
      Valid criticism. :-)

      I wrote it for another purpose then I think people might use it for. It's a solution looking for a problem.

      I added a part of a definition of a object at the top.

      Is that enough to understand?

      Update:

      If I put it like this:

      I wrote above "think of a backend to an XML editor with an API so you can implement a data model" A backend to a smart XML editor, might be a good definition.

      And it is hard to describe! I played the game 15+ years ago and it took a while to understand how it could be modeled without all the exceptions in the the rules making it really ugly code.

      I am proud, it was a hard problem that imho resulted in quite a neat package of functionality.

      There must be similar things, but I've never seen them. I am trying to describe something new. (-: And my verbal talents suck. :-)

        Personally, I'm still lost as to the point of your module. (Which is likely more a reflection on me than on your module.)

        You've provided some sample input. (Thanks.) How about some sample output? What does this module give you or do for you? I don't know what modeling a class hierarchy means or is meant to acomplish. Point out dependency loops? List properties of leaf classes?

        - tye        

Re: What should I name my module? (module-authors ML)
by grinder (Bishop) on Sep 08, 2005 at 07:39 UTC

    I can't give you any direct advice as for a good name, but another good source of feedback is the module authors mailing list. It's fairly low traffic, and is always an excellent source of advice.

    - another intruder with the mooring in the heart of the Perl

      Thanks!

      I've added more description three times, now. It should be understandable... soon. :-)

      If that still doesn't help, I'll collect up my description and send it to that mailing list.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://490034]
Approved by JSchmitz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-11-28 14:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (197 votes), past polls