A pile of packages

In the process of cleaning up and getting Author Intrusion ready for release, I ended up making quite a few distinct libraries and projects. These are very small, focused assemblies, but I think they have the potential of being useful in themselves.

Philosophy

My influential development came from the Unix world. I like things that "do one thing" that are designed to be chained with other things. In effect, most programs are just a composite of lots of different little things.

These packages follow much of the same philosophy. While I could write them as part of Author Intrusion, there were advantages of separating them. The biggest is reuse. A good example is the MfGames CIL project. It has lots of little C# utilities that I've used in a dozen programs over the years.

Drawbacks

There are some major drawback of working with separate packages. While I tried to follow the Stable Dependencies Principle, the fact is that almost all of this is greenfield development and therefore unstable. Near the end of last week, it got really annoying when I had a bug in one code that required me to cascade the change through five different packages. Fortunately, PowerShell is very useful for handling all these things and I got a pretty solid workflow when it came to those final packages.

The other is overhead. Projects require overhead. Not just a website on my site or a reposotiroy in GitHub, but (if done right), documentation, examples, and unit tests. What could be a bullet point in one program (implemented a command pattern) becomes something major when it is a command pattern library.

Projects

These are the projects I worked with or created in the process. I'm using the GitHub links for these, mainly because those pages have more information than the ones on Moonfire Games (documentation takes time).

MfGames CIL

Over the years, I've had a little "catch all" library for the things I happen to write. I released about ten years ago, but mostly had local development since.

  • Settings management class to handle keeping track of settings for the various plugins, window positions, and everything else.
  • A hierarchical path classes. I arrange a lot like a directory tree so I wrote a common framework for working with them. So, the window settings are stored underneath "/GUI/Gtk/Windows/Main Window" where plugin settings are "/Plugins/NHunspell".

This package was bumped to version 4.0.1.0 in the process of getting Author Intrusion out. The rest of the packages are version 0.1.0.0 since they are very unstable.

MfGames Languages CIL

This is actually a new package and created at the last minute. While .NET has a lot of functions for working with languages in general, there are some limitations when it comes to switching locale. More importantly, I'm going to want a system that handles constructed languages (conlangs) which the built-in locale system can't really handle.

I'm not entirely sure if this will be that useful, but my gut feeling is that it will be needed. Eventually, I plan on including a lot more in there including name generators and word identification.

  • A rough word tokenizer. I'm using this to handle control-arrow movements, deleting and selecting by word. Eventually, the undo/redo will use it so if you type "word" and undo it will undo the entire word instead of just the "d".

MfGames Commands CIL

This is actually week four of this release. A command pattern basically is a way of handling interactions with the user. Instead of inserting a "w" in a buffer and handling the results, I create an object that says to insert "w". The main reason is that my code becomes more separated in logic (the command object handles inserting "w") but also simplifies code for undoing and redoing.

Eventually, this will also let me serialize the undo/redo so I can save, quit the program, come back, and still be able to undo where I left off.

The problem was that both the text editor and Author Intrusion both had command patterns, but they were incompatible with each other. Creating a library meant that I could reuse the logic (a good thing) and just handle the differences.

I also made a text editing project out of this that takes a core set of commands and wraps them in composite commands. It sounds complicated, but take pressing return in the middle of a paragraph. Instead of having a split paragraph command, it is really a combination of:

  1. Insert a new line below.
  2. Copy the text to the right of the cursor into the new line.
  3. Delete the text to the right of the cursor from the first line.
  4. Position the cursor at the beginning of the new line.

It works out better than I describe it, but mainly I can do a lot with just six core functions. And that makes it easier to implement than every possible keyboard input or action a user could do.

MfGames GtkExt CIL

The last project was Gtk# extension for things I use while developing. While Gtk# isn't as pretty as WPF or most Windows, it has something I like: cross-platform support. It also doesn't have as rich of a widget set of most toolkits, so I gathered it here.

The biggest part is the text editor. I created a text editing widget that doesn't work on a single text buffer (like most editors do). So, the entire novel isn't in a single string. Instead, it is managed line by line. This means I don't have to have an entire 600k word serial in memory at the same time, which is a good thing.

I expect to see a lot of churn in this last project for a few years.

Metadata

Categories:

Tags: