JFugue Music Notepad Status
By Geertjan-Oracle on Feb 25, 2012
The biggest problem with the JFugue Music Notepad is that it has developed organically. Once you realize that the word "organically" is a polite synonym for "chaotically", you'll understand the previous sentence in the way that it was intended. I'm now rearchitechting it with the following aims in mind:
- A highly modular architecture where each distinct feature is found within a distinct module.
- A strictly defined "currency", i.e., a consistent communication layer between the modules.
Phase 1 above has been completed. Take a look below, where each feature is in a separate module and each module is clearly named so that you know what's going on in the structure immediately:
Everything compiles correctly, exactly as before.
However, phase 2 is not yet complete. The "currency" between the modules needs to be the Note object. When the user clicks the keyboard, a Note should be published, which should also be the case when the guitar neck is clicked. The currently shown music score should be listening for new Notes and publish new Notes within itself. Related to that, when a new Instrument is selected, that Instrument needs to be published so that other components, such as the Syntax window, can update themselves with information about the new Instrument. Finally, when multiple Scores are open, the Composition window needs to list those Scores so that they can be played and saved together as a unit.
Up until now, that's not how things have worked at all. The keyboard and guitar have, somehow, retrieved the Score window and updated the Score window with the current Note. That's simply the wrong way round, while it also creates a completely undesirable dependency on the Score window. It is an anti-pattern to access a GUI object across different modules (whether via the Lookup or otherwise). Instead, domain objects, i.e, business objects, should be the currency between the participating GUI components.
So that's the work I'm currently doing, rewriting the communication layer between the modules. Even though that part isn't done, a screenshot can already be shown of what the application currently looks like when the application first starts, since everything compiles and runs correctly:
Watch this space for further updates.