Finishing up this round of MfGames Culture

For November, I decided to focus on MfGames Culture. It was a pretty productive month in many ways, but the development cycle has ended and it is a good time to report where I am and what needs to happen next.

Reasons

I've been trying to write this library for a number of years. I've tried it in a few forms, the C# version being the previously most successful one, but it hit some conceptual snags and overwhelming details (the bulk of the reasons why my bigger projects fail).

This time, I tried something entirely different, I wrote it in Javascript (well, Typescript). Typescript is not one of my primary languages, but I think it has a good chance of becoming one. I've played with it in a number of other iterations, mostly related to Author Intrusion.

The library is a small but rather complex part of my master plan for Author Intrusion. I want to use this library to tag the headers of my various chapters and tell me when and where it happens. The library is also to let me build a timeline of the entire world of Fedran.

Confusion

The biggest problem with Typescript is that I couldn't figure out the One True Way of getting it to work. Whenever I thought I figure out how to get something working, it broke with the next step. And then I'd puzzle through that and come up with a new way, it ended up breaking up with the next one. It was a rather frustrating experience, to say the least.

My first thought was to write using ES6 modules (tsc --target es6). I figured that Author Intrusion is going to take five years, so going with the edge development seemed like the right idea.

Needless to say, I love the ES6 import syntax. It compiled great and everything was perfect.

At least until I needed to get it tested. I really like to use TDD (Test-Driven Development) which means I usually write with tests to help prove out small, discrete concepts. I do not do BDD or top-level testing, but working on internal logic to make sure the foundation was correct.

To get testing working, I ended up having to go to jasmine-es6 but after trying mocha, jasmine, and a bunch of other things.

Eventually, I got mfgames-culture-js working (well, it was called something else at the time).

Then I encountered the next stumbling block. I tried to put it up as a fiddle. This was a fun experience, mainly because I have not really made a web-based Javascript page before, but also because my nice and stable system crumbled. Absolutely failed because I couldn't figure out how to get the ES6 module to work with the website.

I tried a lot of things, babel and webpack, but I couldn't figure out them out. There were errors messages that apparently no one else in the universe had ever had. I spent over a week trying to get it working. I also tried creating two versions of the mfgames-culture-js (AMD and CommonJS) to use that.

Eventually, I went back to mfgames-culture-js and redid it as UMD (universal module definition). That required me to rework the testing framework, but I could go back to the regular jasmine which I was happy about. I did have to reduce the entire project to one file (as opposed to breaking it apart) because Typescript and RequireJS don't seem to support multiple files being reexported or combined together. I really hate having a 1,000+ line source file.

Following the refactoring that came with it, I finally got my website working. I figured I was free and clear.

And then I started working on the command-line client (mfgames-culture-cli). So, the CLI is based on NodeJS and CommonJS modules while the website used AMD modules. I had to split my JS library in two because it was the only way I could figure things out.

Another week later, I managed to get everything working smoothly in a Frakenstein-like system. I don't think it is the right answer, but it worked for me. At least until I try to do something else, that is.

  • UMD modules for the core libraries
  • Jasmine for testing
  • NPM for various scripts (as opposed to gulp or grunt)
  • No babel or webpack

I also ended up with four packages and one website:

  • mfgames-culture-data: JSON data files.
  • mfgames-culture-js: Typescript/Javascript core module.
  • mfgames-culture-node: NodeJS-specific modules to support the main one.
  • mfgames-culture-cli: Command-line interface to use it.
  • My fiddle website

I also spent another week trying to figure out how to get Typescript “typings” working. That still hasn't been resolved yet, but I ran out of time. I'll puzzle that out the next round, mainly to “finish up”.

I also spent a week documenting it and I feel that I'm only 50% done with that task.

Complexity

Calendars are complex. This weekend, I tried to explain to my dad how my system works. Going through the JSON files, I realized that this really isn't a trivial system and I don't think I can make it simple. I can make it easy to isolate and work, but this will never be “easy”.

I did create a forum to talk about it. I'll be glad to help if anyone does decide to join in or try to use it.

Retrospective

I spent a lot of time trying to figure things out. All my web searches didn't really give a good answer, so I fumbled through it. I may have gotten a decent work flow, but it doesn't feel “right” yet.

I also uploaded everything to npmjs.com, so anyone can use them.

Next for the library

There are a few steps still left for the library:

  • Get my Fedran calendars implemented
  • Get the Aztec/Mayan calendar working
  • Finish documentation
  • Get various typings submitted so others can use it
  • Looking into the typings infrastructure
  • Get Typescript to reference modules

I'm sure as my understanding and the ecosystem both evolve, I'll change how to these systems are arrange. That is why I kept them at the 0.1.0 level. I am nowhere close to being version 1.0.0.

December plans

The main reason I worked on this library for November was to take a break from writing. I posted on Facebook and a few other places, but generally I was frustrated with my weekly serials. I made a decision to start releasing Flight of the Scions for Patreon subscribers only. I'll do another blog post on that, but I'm getting excited about writing again.

Metadata

Categories:

Tags: