Been working on some difficult software architecture problems lately. I'm a proponent of a method of thinking that, according to my rather faulty memory, was attributed to Einstein, possibly by Robert Anton Wilson. I can't actually find any evidence that Einstein used this method now, but I find it useful nevertheless! Essentially, the theory goes that the subconsious mind is highly effective at problem solving but does not work quickly. Whereas the conscious mind is useful for making snap decisions (on the timescale of seconds or minutes) that can mean the difference between escaping a predator or being eaten, the subconscious mind works on timescales approaching days, weeks, months, and beyond. An effective way to use the subconscious mind is therefore to pose a question or series of questions to it, then banish those questions from the conscious mind (either by occult means or by sheer distraction). Upon returning to the problem in roughly three days time, the subconscious mind will usually have arrived at some sort of solution.
To achieve this, I spent the last few days hammering away at the
mindless task of modularizing an existing codebase. In this case,
jsycamore. I'm only really
this year getting a handle on applying a service-oriented
approach to programming and each new project is an opportunity
to find new places where the model can be applied. For example, the
user interface in the jsycamore
package is themable. Previously,
the core package provided a set of four default themes, each of
which emulated the look and feel of an existing operating system. The
modularization of the code moved those themes into their own modules
with the themes being published as services. This allows programmers
to publish their own themes as services and have them automatically
made available to any program using jsycamore
without anyone having
to write extra code to use them. If nothing else good comes from
Jigsaw, I hope at least
that it shoves programmers in the direction of publishing services as
opposed to relying on ClassLoader
and reflection hacks to provide
late-binding of functionality in this way. Much of the JDK has been
converted to services, apparently, and they're now a core part of
the new module system instead of lurking in the background the way
they have since Java 6.