Mastering E-Prime: How to Learn E-Prime Programming

David McFarlane mcfarla9 at msu.edu
Tue May 10 20:02:40 UTC 2011


The question comes up from time to time, "How can 
I learn to program with E-Prime?"  Here is my attempt to answer that.

First, some earlier posted partial attempts to address this:
http://support.pstnet.com/forum/Topic1806-5-1.aspx
http://support.pstnet.com/forum/Topic2316-5-1.aspx
http://support.pstnet.com/forum/Topic2951-12-1.aspx
http://support.pstnet.com/forum/Topic2446-23-1.aspx
http://groups.google.com/group/e-prime/browse_thread/thread/e4b89ad5265c747a/b1ec5d104cc7977d
   ( http://listserv.linguistlist.org/cgi-bin/wa?A2=ind0804D&L=EPRIME&P=R1715 )

And now, my essay...

For those without any programming background:
- E-Prime is well suited for casual, amateur programmers of simple
   psychological experiments, insofar as it insulates the user from the
   deeper workings of the system (and encapsulates several structures and
   concepts peculiar to experimental psychology).  As a result, it makes
   a poor platform for learning or understanding actual computer
   programming.  If you try this you will only make things hard on
   yourself.
- I urge you instead to just knuckle down and do some actual coursework
   in any modern object-oriented programming language until you at least
   grasp some general core concepts (bits, bytes, words, literals,
   constants, variables, integers, floats, strings, arrays, objects,
   representations, types, classes, scope, operators, labels,
   conditionals, branches, loops, blocks, subroutines, functions,
   arguments, etc.).  Otherwise you will not understand what we are
   talking about.
     - Since E-Basic is a derived from Microsoft Visual Basic for
       Applicatons (the language element of Visual Basic 6), you would do
       best to study this if possible.
     - Some of us who hearken back to the 1980s still think that Pascal
       makes a fine language for learning general programming concepts,
       but it has fallen out of fashion.  (And if you did study Pascal,
       you would want an object-oriented version, e.g., ObjectPascal.)
     - You can use any web browser (e.g., Internet Explorer, Firefox,
       Opera) to study JavaScript, which incorporates a rich set of
       object-oriented concepts, for free.  However, JavaScript quickly
       gets entangled with HTML, Cascading Style Sheets, and the Document
       Object Model, so this may not be so useful as I once thought.
     - Python is also free, and seems to be generally in fashion now for
       Introduction to Programming, so you might try that.
         - Python does not let you learn directly about labels and goto
           statements, which you will need for E-Prime.  But you might
           learn similar concepts with Python's exception handling
           (i.e., try, raise, except).
     - Personally, for this kind of work I think you cannot do better
       than to get a good grounding in C or C++, but I seem to be
       outvoted here.
- Even more fundamental than learning any programming language, you
   should study and be comfortable with math in general, and in
   particular propositional logic, combinatorics, and probability.
     - It also helps to know some information and communication theory.
       (If you can make it through the classic work of Claude Shannon,
       then you are in good shape.)
- See my "How to Solve E-Prime Puzzles".

For those who come to E-Prime with some programming background:
- E-Basic is a derived from Microsoft Visual Basic for Applications
   (the language element of Visual Basic 6).  So you might like some
   materials on VB or VBA.
     - Most materials on Visual Basic focus on using the VB GUI to design
       the GUI aspects of your program, and using VB to control
       databases and web sites, so they are not much use to us.
       Instead, you want a source that covers the basic language
       elements.
     - Books to try:
         - "VBA for Dummies", Steve Cummings, IDG Books Worldwide, Inc.,
           Foster City, CA, 1998.
         - "VB and VBA in a Nutshell: The Language", Paul Lomax,
           O'Reilly Media, Inc., Sebastopol, CA, 1998.
         - "VBA Developer's Handbook", Ken Getz & Mike Gilbert, Sybex
           Inc., San Francisco, CA, 1997.
         - "VBA for Dummies" and "VBA Developer's Handbook" come
           recommended in the E-Prime User's Guide (p. 124, sec. 4.1.1).
         - I find "VBA for Dummies" to make the best general discursive
           introduction (despite its annoyingly chatty style).  "VB and
           VBA in a Nutshell", true to O'Reilly's general quality, makes
           a generally good reference book.  "VBA Developer's Handbook"
           is really meant for a different audience (developers of
           commercial VBA applications).
     - E-Basic lacks some standard VBA elements (e.g., With).
     - E-Basic extends VBA with its own host of classes/objects (and
       associated properties and methods), so VB books only help so far.
     - In addition, vital task control issues such as randomization and
       critical timing go beyond the scope of most programming texts, so
       you will have to learn those separately (e.g., Chapter 3 of the
       E-Prime User's Guide).
     - BTW, the E-Studio environment itself borrows a lot from the
       Visual Basic Editor.
- Some features of E-Prime (e.g., graphics and timing) rely on
   Microsoft's DirectX technology, so you may wish to also study that.
- The Guides supplied with E-Prime do a pretty good job as far as they
   go, but they are rather tutorial in nature and scope.  There is
   neither a proper technical reference, nor any discursive guide to lay
   out the underlying principles and concepts of E-Prime and E-Basic.
   You are left to puzzle this out for yourself, or along with other
   regular users.
     - Make lots of small demo programs in E-Studio, and study the
       generated code.
         - Use Lists and Weights to easily limit test runs.
         - Use Clock.Scale for speeded test runs.
         - Log test values (c.SetAttrib) and examine the resulting
           .edat* file *after* test runs to see what the program did.
             - Or, use Debug.Print (per Michiel Spapé).
             - Or, use MsgBox to trace execution at run time.
         - Use GetUserBreakState() for graceful early exits.
     - If you have EP1, use E-Run to try out E-Basic elements with even
       simpler test programs.  You can do this even without a hardware
       key (which is probably why PST removed this capability from E-Run
       in EP2).  In this regard, EP2 makes an inferior platform for
       studying E-Basic.
     - See my "How to Solve E-Prime Puzzles".
         - In particular, study Chapter 4, "Using E-Basic", of the User's
           Guide.
         - If you care at all about critical timing, then someone in
           your lab *must* study Chapter 3 of the User's Guide.  I
           cannot stress this enough.
         - The "real" documentation, insofar as we get any at all, is in
           the E-Basic Help facility.
            - The E-Basic Help facility is still incomplete (e.g.,
              http://support.pstnet.com/forum/Topic1241-12-1.aspx ), and
              in some cases misleading or just plain wrong (e.g.,
              http://support.pstnet.com/forum/Topic1197-5-1.aspx ).

-- David McFarlane, Professional Faultfinder

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list