[messages] [Module Design] Questions about Prototyping and Best Practices

Rommel14 pfell.688 at gmail.com
Mon Jul 7 01:25:17 CEST 2014


Dear Moderators and VASSAL Gurus,

After being away for a while due to a serious family illness, I returned
to find 3.2.12 released, including the fine documentation for
Expressions and the Bean Shell items.  Thanks to all (esp. Brent) for
that helpful addition, as I've been stumped a few times regarding syntax
with Calculated Property Expressions.

I have three questions that all relate in some way to Prototypes and
"best practices" in VASSAL coding (and coding in general):

1) Copying Code - This may have been asked previously, but I cannot find
the thread for some reason.  Is there a way to transfer Prototypes or
other portions of module code between modules?  By this I mean via the
GUI, such as having 2 modules open and C/P between them?  I think
someone said that you could do this by opening the file that stores all
the raw code, but that this file was not entirely human-readable, so it
might be hard to track down individual parts of a module that you wish
to clone.  Am I recalling this correctly, or has something changed with
recent updates?  If this capability is not currently available, is it at
all feasible?  Surely this is a common occurance for those of us who
work or have worked on multiple modules.

2) Global vs. Zone Properties - In Java (and in many other languages),
programmers are vehemently discouraged from using global variables, as
this violates encapsulation and risks generating effects / errors that
are hard to trace.  I realize that in VASSAL, Global Properties are both
necessary and essential to overcome certain issues with the interface. 
However, I was wondering if people often create Properties within Zones
or Boards in an attempt to maintain encapsulation.  Is this common
practice, or does this tend to create collateral problems with
visibility that, in the end, must be solved by making a Property global
to the Module after all?  Should I potentially revamp a work-in-progress
to restrict the visibility of some Properties?  How do people feel about
this and what do all of you do in this kind of situation?

3) "Best Practices" Library - Is there some place (a sub-forum, sticky
thread, etc.) were people could post snippets of Prototypes or Traits
that constitute "standardized" ways of achieving certain actions or
characteristics?  For instance, I have figured out on several occasions
how to use various Global Properties, Markers, etc. to create generic
Prototypes that can apply to many different units in all kinds of
modules.  In addition, I have by trial and much error discovered how to
automate some types of common game rules using various combinations of
Properties, generic Prototypes and Traits.  Is there a clearing house in
which developers could post some of these discoveries so that we can
share our collective knowledge?  I'm certain that amongst us we
re-invented the wheel many times over.  Moderators, if this was possible
and practical, what would be the best way to do this?  In conjunction
with this, could a portion of this "area" be set up as a "tutorial
clinic" for newer users, thereby expanding the user base?  I know the
web site has some examples, but something within the forums may be
easier to manage and maintain.  Thoughts?

Thanks to everyone who has helped me in the past.  Sometimes we all need
a second (or third) pair of eyes to catch the errors!

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=45587#p45587


More information about the messages mailing list