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.
Just because you can convince 9 out of 10 people that your stupid idea is a good idea doesn't make it a good idea it just makes you a skilled liar.
Morale shall continue until beatings improve.
Etc.
Managed to hit 3000 GitHub contributions today:
Had a change of heart. Doing all of the package renames now rather than waiting for Java 9. I wrote:
There is the possibility that changing the entire name of a project could be considered a non-compatibility-breaking change according to semantic versioning...
I'm choosing to believe this is true and am renaming projects and modules without incrementing the major version number. I'm using japicmp to verify that I'm not introducing binary or source incompatible changes.
Sometimes, what you really need is a mutable, boxed integer.
While updating jcanephora, I
discovered that I needed to update jpra
to use the new jtensors
types. Whilst doing this, I discovered that the new simplified
implementation of the ByteBuffer
based storage tensors that
I'd implemented were too simple: The jpra
package made use
of the cursor-like API that the old jtensors-bytebuffered
package provided. I'd not provided anything analogous to this
in the new API, so I had to do some rewriting. In the process,
I discovered that the code that jpra
generated was using an
AtomicLong
value to store the current byte offset value. The
reason it used an AtomicLong
value was simply because there was
no mutable, boxed long
value in the Java standard library. To
remedy this, I've created a trivial mutable numbers package
upon which the com.io7m.jtensors.storage.bytebuffered
and
com.io7m.jpra.runtime.java
modules now depend. I should have done
this years ago but didn't, for whatever reason.
https://github.com/io7m/jmutnum
It may be the least interesting software package I've ever written.