[e-lang] Prize and Milestone as mutable state idioms
Tyler Close
tyler.close at gmail.com
Mon Jun 30 18:20:00 CDT 2008
Hi all,
I was recently refactoring the JSON serialization code in the Waterken
Server to make auditing its correctness easier. In doing so, I wrote
two small utility classes, each one to enforce the update pattern the
code was using for one of its variables. For example, I was using a
boolean variable to keep track of whether or not the most recent JSON
value had been fully and successfully output. The update pattern here
was that the variable started out false and then transitioned to
forever being true. Verifying that this property was correctly
implemented previously required examining the full file for mentions
of the boolean variable to check that it was only ever assigned the
value true. The Milestone class encapsulates a boolean variable that
can only be updated in this way. There's a similar story for the Prize
class. I'm thinking both of these classes may be generally useful and
help communicate the programmer's intention for a mutable variable. If
they are, I think I'll upgrade them to being reusable parts of the
ref_send library. So, I'm looking for answers to a few questions:
1. Do the Prize and Milestone classes make the JSON serialization code
more reviewable?
2. Do you suspect these classes would make other algorithms more reviewable?
3. Is the ref_send library the right place to host a collection of
these utility classes for capability programming idioms?
See the attached Joe-E source file for the current JSON serialization code.
--Tyler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ValueWriter.java
Type: text/java
Size: 9466 bytes
Desc: not available
Url : http://www.eros-os.org/pipermail/e-lang/attachments/20080630/c72b64bb/attachment.bin
More information about the e-lang
mailing list