At the Intersection of Work, Play, and Learning

A Diaspora Cluster Map. The three attributes with ratings between -4 to 4 are: T for Technology, R for Resources, E for Environment. Five star systems: Athens (T 1, R -1, E -1), Sparta (T 0, R 2, E -1), Corinth (T 2, R -3, E 2), Thebes (T 3, R 0, E 4), and Ephesus (T -1, R -1, E 1). Athens connects to Sparta, Corinth, and Thebes. Sparta connects to Athens, Corinth, Thebes, and Ephesus. Corinth connects to Athens, Sparta, and Thebes. Thebes connects to Athens, Sparta, Corinth, and Ephesus. Ephesus connects to Sparta and Thebes.
Cluster with Standard Attributes

update: I have added ALT-tags to the two cluster images. If I were to re-run the scripts for the second cluster, I would choose Knights, Dragons, and Magic.

For the most part, I keep my professional blogging separate from my hobby blogging. update: Since posting this, I briefly blogged at ndlib.github.io. I have stopped doing that, and am moving more of my blogging onto Take on Rules. During the day, I’m a programmer for the University of Notre Dame, and at night a pen, paper, and cardboard gamer.

I consider myself to be a reasonably competent programmer, but recognize continued room for growth. This manifests in reading and experimenting in code. Lately, I’ve thought of myself more as a software doctor than a software engineer. Doctors practice medicine, and I practice programming.

This past month, I picked up Avdi Grimm’s “Objects on Rails” [Free legal online version] and Robert Martin’s “Clean Code”. update: I purchased this book, but Robert Martin’s behavior and world views as a Trump supporter and apologist run contrary to mine. So I’ve removed the link and hope you look elsewhere for coding insights. I recommend Avdi Grimm and Corey Haines as two authors. I’m interested in exploring better software design, with a focus on code refactoring…I’m the primary maintainer of a 6+ year old Ruby on Rails based CMS 📖 (It started somewhere around Rails 1.1.6 for those keeping score). And sometimes it feels like I’ve donned the Black and patrol the Wall. But I digress.

I decided that I wanted to apply some of these principles to a problem space that I understood…RPGs. In particular, I wanted to automate the Diaspora Cluster Creation, not because it is convoluted, but because it is very well defined process. That is to say I already understood the domain.

An alternate Diaspora Cluster. The three attributes with ratings between -4 to 4 are: K for Knights, D for Dragons, and M for Magic. Six systems connect: England (K 1, D 0, M -1), France (K 0, D 2, M 1), Germany (K -1, D -1, M -4), Italy (K -2, D -1, M 0), Poland (K 0, D 0, M 2), and Austria (K -1, D -1, M 1). England connects to France and Germany. France connects to England, Germany, Italy, and Poland. Germany connects to England France, Italy, Poland, and Austria. Italy connects to France, Germany, Poland, and Austria. Poland connects to France, Germany, Italy, and Austria. Austria connects to Germany, Italy, and Poland. Note: In the original image I have Maidens instead of Magic, but want to step away from the sexist implications
Cluster with Arbitrary Attributes

Over the past week, I’ve worked on creating the Diaspora Cluster Creator command-line utility by striving to apply these recommended constraints and methodology. The tool I’ve created is an over-engineered solution for what amounts to 5 minutes of dice rolling at a table with a group of friends.

This exercise has proven to be ridiculously rewarding. I was working on a greenfield project and trying to adhere to the teachings of others. In some cases, I stumbled, creating code that I should’ve known would be a problem; Hint, if the tests are complicated to setup, then there are issues. But, through refactoring, I was eventually able to clean things upI’m still not satisfied with the Node class.

While I typically try to work within these constraints, for this project I was trying extra hard to keep them at the front of my considerations: The Law of Demeter, Single Responsibility Principle, Test-Driven Development, Command/Query Separation, general readability, and fast tests (Corey Haines would be proud).

The result has been a code-base that has been very fun to work with, and has been relatively painless to extend. The Cluster creator can just as easily create Diaspora clusters with attributes different than the assumed Technology, Environment, and Resources.

The command-line solution is not suitable for the general role-playing populous, so I’ll need to take that into consideration.

For those of you interested in installing it yourself, it’s up on Githuband available as a Ruby gem – gem install diaspora-cluster-creator. You can take a look at the Cucumber feature that defines the command-line behavior of the tool (Hint: there are several options).