Purpose of this Process
Reason for going to such elaborate lengths is that
there are still some small issues in the designs
that can't be resolved until we see the lab on the screen.
So we need to be able to tinker with the code in a few months
from now and be able to add small changes.
The emphasis in these labs is not on efficiency
but on maintainability and consistency.
It is likely that the code for each lab will need
to be slightly modified at some point after the programmer
has finished with (and moved onto another lab or project.)
Thus, where possible, where a particular functionality is required
in more than one place, create a method or a class for it.
For example, let's all concentrate on using the
static methods in the GenericGlobals class and the
GenericApp material. This will allow us to make changes
in that code that apply to all the labs.
It is that simplicity and consistency that we need.
Of course, we need things to run adequately.
But this is most likely to be an issue in the animation
which will require individual consideration in an attempt to use
generic classes that mix the gif and programming animation styles.
Process
Share code and put into central mechanism
so that only need to change one place.
If inelegant, don't worry.
Parameterize so that things are described as what they are
rather than achieving complete efficiency by accessing a value directly.
Do the accessing in functions/methods.
Document all functions, methods, classes
etc.
As much as possible, allow customization using resources
held either in the properties table by each LabApplet
or directly in the Globals class as a static object
that gets set in the processArg() method for the LabApplet extensions.
These mechanisms exist for doing this so it is easy
to make use of.
Modularize and sub-class as much as possible.
Make a new extended class to do a slightly different
thing so that we can change it without breaking
anything else.
This allows us to put the common class in or use
the new class to get a different effect.
Use the data manager where possible to
create objects asynchronously. This is a generalization
of the MediaTracker class and allows for much faster start
up times (especially if these are used on the web).
Also, it makes for more literate code if the application doesn't
want to block.
Asynchronous loading is done by the DataManager.
One must arrange to wait on the loading but mostly
this is transparent. Use the get() method
and check to see if it is null.
If you supply a ManagerRunnable object and it is not
being loaded or already loaded, then it will be loaded
and the call will block. This allows the app to wait
until the object is ready. This is true for all get( )
operations from the DataManager unless the object can't
be loaded asynchronously.
Writing Specs
You don't have to write them in this detail
and make it appear on the screen, although that doesn't
hurt and is what we would like.
Prioritize the resources, but it does help
to have it working to the point that it displays
on the screen so that we can discuss it (with Rick so he has a
better idea of what the lab is about and what needs to completed)
and so we can consider any small changes before the
programmer sees it. This way one knows that the class structure
and
skeleton does work
and also is easier to discuss with the programmer.
It also maximizes the chances of reusing code as the
the skeleton writer is more likely to know, a priori,
what is common to labs. This may become less true in
the future if we have several people doing this.
The process will not be as complicated as this typically
as again, we are trying to sort out some of the commonalities
and repair classes that were written very quickly for prototyping.
(E.g. the DataSet and Histogram material).
The basic steps involved in the whole lab
are
- grab a copy of the template application
- enumerate the different cards based on the buttons that
have
to appear in the Navigation Toolbar.
- For each card,
continue to add components to the card by determining
what each does and what data each needs externally.
Then extend this process to figure out how these
methods can use each others and then how the classes can
be consolidated into more general classes.
So it is an iterative process and at this stage the iterations
are pretty quick and limited in number.
I tend to write the body of a method for those methods that
are easier to write than explain. Of course, the explanation
has to be provided for the method anyway.
But sometimes it is easier to think things through by coding
it, if it is a short and "simple" method.
This is especially true for the convenience functions/methods
that refer to other methods in a clean way rather than accessing
data directly (e.g. overloading methods with different arguments
that call a single complete method)
Create separate classes for things that might be
used in separate contexts in other labs.
For example, the sampler has a running total.
We may want to change the nature of this (e.g.
running average, running total, etc.)
so it is easier if we can just plug a new object into
the objects that use this.
Global Issues
Appearance and Dynamic Customization
Every App card needs to support the font change
called from set_font().
This is primarily used from the dialog.
The class that extends AppCard is responsible for
Writing the current state of the application is done
by calling the dumpState method for each card.
This is a little asymmetric in that the info is read
before the objects are created in the next session.
This receives a connection as an argument
and should write onto this.
The
HTML widget - see HTMLWidgetInterface for API.
Quizzes
- Quizzes are handled using a script.
We arrange to call that using the
sendQuiz()
method for the quiz page.
- Quizzes are returned in two ways - one is a corrected
version of the quiz with corresponding form elements
with the correct version beside the student's answer.
The second is the table of graded answers
as a property table or hashtable.
Grading
Grading is done outside of the application by
a separate process.
This allows us and other installations to change
the grading at any time and also to defer consideration
of this. Additionally, we simplify the
Duncan Temple Lang<duncan@stat.Berkeley.EDU>
Last modified: Tue Apr 22 07:35:22 PDT 1997