Going Non-Native

Supporting your application on multiple operating systems requires some tough decisions.  Do you develop natively for each OS and maintain multiple code bases?  Do you use a cross platform development framework?  Or do you do something else?

This is the fourth of several articles about my  journey developing an application for NASA’s Fermi Gamma-ray Space Telescope mission.  Earlier articles can be found here:

I knew from the start that in the end the application needed to run on both Android and iOS devices as both are widely used in the scientific community the app targeted.  I chose Android for the prototype simply for practical reasons:  I owned an Android phone and tablet but the only Apple devices in my house were my old MacBook from work and my daughter’s 4th gen iPod Nano, neither of which ran iOS.  I didn’t have a device to test an iOS prototype on.

I originally toyed with the idea of just doing two different apps, one in Java and the other in Objective C to target the two platforms.  Of course that would require learning Objective C as I had (and still have) zero experience with that language.  More appealing would be to find some cross platform development framework that would allow me to target both platforms simultaneously.  And so I started looking around.

I new the app was going to be fairly basic, it would make plots, have some lists and buttons and serve up webpages and data tables.  So the cross platform environment didn’t need to be that spectacular.  I looked at several.  Many of the cross platform systems seemed to be focused on game development (or at least their sales pitches on their websites were).  Others were a little too pricey.

In the end, I settled on Titanium Studio from Appcelerator.  It allowed development for Android and iOS, code was written in JavaScript (which I had some familiarity with), and it was free.  Using this tool, I would be able to write a single program that would compile down to native code on both platforms, and it would look and behave similarly on both.

Switching Development Environments

Up to this point all my work had been done in my primary work environment, namely Linux and the Eclipse IDE.  Titanium uses a customized version of Eclipse for their IDE so that wasn’t an issue, but in order to develop for iOS you have to build and compile on a Mac.  If there is one thing I don’t like about writing iOS apps, it’s that you have to do it on the Mac.  I understand why, but it is still frustrating.

Unfortunately for me, my MacBook is pretty old.  And I definitely felt it.  The iOS simulator was snappy enough but the Android Emulator was painfully slow.  In fact, in the end, it was faster (by nearly an order of magnitude) to deploy test versions to my phone (A Motorola Droid X) and test there instead of trying to use the emulator.  There were times I could definitely relate to this XKCD comic.

There were other issues with working on the Mac, but I’ll save those for another post.  Beyond the slow computer and minor interface dissimilarities, the switch was relatively painless and worked just fine.

One Code Base?

One of the draws of working in Titanium Studio was the promise of being able to develop in a single code base for both mobile OSes.  I knew that there would have to be some OS specific coding in the app to deal with different features (i.e. no hardware back or menu buttons in iOS) but at least it would all be in the same language.

This aspect of the development turned out pretty much as advertised.  I have a single set of classes/files that work just fine on both iOS and Android.  I don’t have to worry about implementing a feature for one OS and then going and reimplementing it for the other.  I just have to do it once and it is there for both.  I believe that this definitely cut down on the total development time it would have taken to build it as two separate apps.

In addition, it saved having to deal with context switches.  I was working in JavaScript with the Titanium APIs.  While developing I didn’t have to switch out of that mode.  Had I tried to do native Java and Objective C applications, I would have been constantly switching between the Java/Android APIs and the Objective C/iOS APIs.  That’s a lot more you have to keep straight in you head and many more chances for errors.  I think of all the benefits, being able to work in a single context and not having to continually switch is probably one of the best benefits of the cross platform framework.

Does that outweigh the issues encountered?  That remains to be seen.  From the point of view of the programmer, I think so.  From the point of view of the functionality provided and the user experience, I haven’t decided yet.  There were several gotchas that I had to deal with where something would work on one OS and not the other that I had to work around but for the most part these were minor.  And there was one major issue that I encountered that I had to work around.  But those issues will be the topic of a future post.

Conclusions

Looking back, maybe Titanium wasn’t necessarily the best choice of a cross-development framework.  It’s been a rocky road that I’ll detail in a future post and give my reasons for that assessment.

However, the decision to use a cross platform development framework was, I believe, a good one.  It kept all the code in a single place.  I didn’t have to worry about implementing a feature in Java and then making sure I remembered to go and reimplement it in Objective C or vice versa,  I could implement it once and it would be there. I think it definitely cut down on the development time, if not the testing time.

So, if you want to target both iOS and Android and possibly others, I think it is definitely worth the effort to look at the existing cross platform development frameworks.  Look closely at the features that you need and what they provide.  And pick a framework that provides what you need/want.  It could save you a lot of work.

This post originally appeared on my old Programming Space blog.

Beginning Mapping in Inkscape

As I mentioned in my last post, I like making maps.  Primarily I’ve done starship deck plans.  You can find examples of several I’ve done for the TSSS Dart, CSS Nightwind, TSSS Morning Glory online (I need to get that last one into the wiki as my website layout has changed and the pages are all messed up now).  As such I get asked occasionally by members of the gaming circles I inhabit for tips on getting started on map making.  Since it has come up more than once, I thought I’d compile my tips and suggestions here to save having to rewriting the information individually to each new query.  Now I can just point them to my blog.

My maps are fairly simple.  As such I have never used any big mapping software.  I just do my mapping in Inkscape, a free vector graphics program similar to Adobe Illustrator (which I have the CS3 version of but never have learned to use).  The following tips were generated in response to a request for help I got a few months ago and were designed to get someone completely new to the program started on some basic maps.  Hopefully they help you as well.

Tip 1: Open the File->Document Properties dialog and set the size of the paper to be big enough to hold your map at the scale of 50 pixels per grid square with 50 extra pixels on each side.  I use 50 pixels per meter for all my maps so that if you print them out you can use the [Star Frontiers] counters  (which are 1/2″ squares) on them.  For example if I was doing a map that was a 10m diameter ship I’d make the image 10m x 50px/m = 500 pixels + 100 pixel border = 600×600 pixels in size.

Tip 2:  In that same dialog, select the ‘Grids’ tab and create a new rectangular grid.  Your tools and such will snap to this grid and make lining things up much easier. Note that this grid is only for use in inkscape to assist in drawing.  If you want an actual grid in the final image, you have to draw that yourself on a separate layer.  The sad thing is I’ve never figured out a way to automate that and so have had to draw all the lines and then copy and paste. 🙁

Tip 3: Use layers.  I usually use at least one for the underlying grid, one for the map itself and one for the labels).  That way you can turn things on and off as needed.  You might even consider doing one for the walls and bulk equipment and another for the furnishings.  Turn on the layers dialog (that will show the layers and allow you to manipulate them) by selecting Layer->Layers… in the menu.

Tip 4: In the bottom right of the program window is the information about your cursor position.  You can use this to line up things and put them right where you want them.  If you’ve got the grid on (and snap to grid on which is enabled by default), you’ll see a little red box or ‘X’ show up on the nearest grid point to your cursor.

Tip 5:  Pressing the 5 button zooms to the page.  Pressing the 3 button zooms to the object you’ve selected and pressing 1 zooms to 100%.  Pressing + and – zoom you in and out.  You can see the shortcuts if you pick View->Zoom from the menu.

Tip 6: (This one was prompted by a specific question) Drawing a circle. There are two ways to do this.  The first is to draw from the upper left to the lower right.  For example if you were drawing a big circle to be the outer hull of your 100m diameter ship, go the the upper left of the image 50 pixels in from the edges.  Assuming you set up the page size based on tip #1 the cursor position in the bottom right should read X:50, Y: 5050.  Click and hold the button down as you drag down to the bottom right and stop at X:5050, Y: 50, release the button and you’ll have your circle.

Now if you have the grid turned on (File->Document Properties, Grid tab, New button) you don’t have to get exactly on those coordinates as it will ‘snap’ to the nearest grid point.

The other way to do it is center outward.  Go to the center of where you want the circle and click and start to drag to the lower right.  Then press and hold the shift key while you’re dragging.  This will move the center of the circle to your first click point and you just drag it out the size you want it.

Along the bottom in the status bar you’ll seed something that looks like Ellipse: 100.00px x 100.00 px (with the values showing you how big in x and y your object is).

Now for the pro tip on making circles.  If you also press the control key while you’re dragging out your circle in either of the methods above, it constrains to ratio of the x and y sizes to be integer ratios.  This means that as long as you go basically down or up diagonally, it will stay 1:1 and you get a perfect circle.

Tip 7: Changing line thickness.  In the bottom left is a Fill: and Stroke: label with colored lines near it (just under the color bar).  Next to the color line by the Stroke label is also a number.  This is your line thickness.  Right clicking on it will bring up a list of sizes that you can just click on to thicken or slim your line.  If you don’t want one of the choices there you can get finer control.  Double clicking on one of the color lines will open up a dialog with three tabs, Fill, Stroke Paint, and Stroke Style.  The first entry in the stroke style tab is width.  Adjusting this allows you to set the width of your lines to anything you want.

I also encouraged him (and you) to do a web search for “inkscape tutorials”.  There are a lot of good tutorials out there to help you get going and solve particular problems you might run into. That was all my original inquirer needed from me to get started and he cranked out some pretty cool maps for a spaceship he was writing an adventure on.  I hope those little bits help you get started.  Feel free to post questions in the comments and I’ll try to address them.  Happy mapping.

This post originally appeared on my old Programming Space blog.

Friday Five Minute Maps

I like to make maps.  Whether they are buildings, complexes, starship deck plans, or what not, I enjoy making them.  I don’t know that I’m that great at it but it is fun.

To that end, I’ve been seeing a lot of mentions of “Five Minute Maps”.  The idea is that you sit down, set a timer for five minutes and draw to see what you came up with.  I decided to give it a go.  In fact, I even joined The Friday Five Minute Map group on Google+.  In any case, I did my first map today.

fiveminutemap130322

It was drawn in my mapping Moleskin with a 0.5mm pencil.  It’s nothing great but I did do it in five minutes.  It shows a large impact crater with central spire that has been  mostly filled in with a shallow lake.  Probably brackish as there is no outflow channel, just an inflow.  The crater walls have been cut down at two points and a road/bridge has been built across the lake to the central spire which holds (the ruins of) a keep. The entire region around and in the crater is forested (it’s an old crater).

Beyond that you can fill in the details as you wish.  The Friday Five Minute Map group has a theme/inspiration idea for each Friday’s map.  These weeks was this image: https://plus.google.com/u/0/communities/107162032035058071166 of an old foliage covered, ruined tomb keep.  Going with that image, the keep and bridge are overgrown with trees/vines and in a great state of disrepair and the area hasn’t been inhabited for centuries.

Of course that begs the back story of why build the keep there, a question that was asked on the Google+ group after I posted it.  Off the top of my head, this was the answer I came up with (taken from my answer to the question):

Why did they build the castle there in the first place?  Let’s see… It’s an impact crater with a central spire, several tens of miles across.  Maybe there was some mystical properties of the material that was the impactor and which is now buried deep below the center of the crater.  A wizard ferried slaves and overseers to the island via boat and began excavation trying to find the source of mystic energy emanating from the region.  Realizing that this would be a good, isolated place to set up shop, both for magical research and controlling the power source, and that it may take some time to find the meteorite, masons were brought in to work the rock being excavated into a keep that would later become the tomb castle.

As work progressed, moving people and supplies by boat tens of miles across the lake was somewhat tedious and the bridge/road was constructed to ease logistics, again being constructed from material being quarried on the central isle.  What later happened, whether the wizard found the meteor, and what happened to cause the keep to fall into disrepair is left as an exercise for the reader.  🙂

Someone else suggested that maybe it was built by a civilization that just didn’t want to go out of it’s way,  The shortest path between two points was through the crater so off they went.  That got me thinking of another, related reason for building the bridge, namely a short cut.

If the crater is large, and it probably is given that it has a central spire, going around could add tens to hundreds of miles to a journey.  And maybe that was the way things were for centuries.  But then someone decided that they had the engineering know-how to make a bridge across the lake and shorten the distance.  They built the bridge, built a keep on the island in the middle, and then set up a toll booth on the island.  The road across the crater cut out days or weeks of travel.  And since the toll booth was on the island half way through, most people paid to continue on.  You could refuse the pay the toll but then you had to backtrack all the way out and then around.  It made a lot of money for the original constructor.  And was probably the scene of many battles for control over the years.

Anyway, that was my first foray in the the 5 minute map.  I look forward to doing more in the future.

This post originally appeared on my old Programming Space blog.

Other Endeavors

I seem to have an infinite number of side projects that I’m always working on.  Today, however, I just want to give a quick shout out to a couple of them that take up the majority of my time.

I like to play (what is now considered) “old school” pen-and-paper role-playing games.  When I started down that hobby decades ago all the adjectives weren’t needed.  You just said role-playing games and people knew what you were talking about.  But today with the computer role-playing games as well other developments, you have to be more specific.

Specifically, I’m a big fan of the old TSR game Star Frontiers.  So much so that I run a Star Frontiers website, The Star Frontiers Network, which primarily hosts gaming forums and a wiki, and I provide hosting for a second site on my server.  You’ll find me hanging out there and on other Star Frontiers sites under my handle Terl Obar, the name of my first major Star Frontiers character.

Related to my love of that game, I let a good friend of mine from the on-line community, Tom Verreault (aka jedion357), talk me into working with him on starting up a science fiction fan magazine, devoted initially to Star Frontiers but with a focus on sci-fi RPGs in general.  The magazine, called the Frontier Explorer, has now published two issues and we’re hard at work getting the third one ready to go.   It’s been a lot of fun and a lot of work.  You can expect to see posts about the magazine and my experiences working with it appearing here in the future.

The other activity that seems to consume the rest of my spare time when I’m not working or spending time with my family is my small publishing company, New Frontier Games.  I haven’t done a lot with this as of yet but things are starting to pick up.  I wrote a book last year (2011) called Discovery which published just as a free e-book.  Just recently I’ve made a print on demand copy available for those that like to have physical copies of their books.  The other thing I’ve been working on is a spaceship combat card game, Star Clash, which I just released as well.  Right now it is available as a “print and play” game.  However, the company we do our distribution through (DriveThruRPG and its related sites) is launching a print on demand card site that Star Clash is specifically suited for.  I’m currently working on preparing the cards to be printed so that people can order the card game ready to play instead of having to print them themselves.

If any of those projects sound interesting, follow the links to check them out.  I’ve had a lot of fun working on them.  Hopefully you’ll enjoy them as well.

This post originally appeared on my old Programming Space blog.

Building a prototype

Once you have an idea for an application, it really helps to get a prototype up and running to understand better how the application will function and even if it is possible.  Building the mobile data application for the Fermi Science Support Center was no different.

This is the third of several articles about the journey of developing an application for the Fermi Gamma-ray Space Telescope mission.  Earlier articles can be found here:

When I started this project my mobile app development experience comprised a sum total of about two weeks of playing around with the Android SDK.  I had it up and installed, had read a few tutorials, and started in on a small app that was to be a character generator for an old role-playing game to have something (semi-)practical to work on.  But beyond that I was a complete novice.

However, that was infinitely more experience than I had with iOS development and that fact, combined with the fact that I owned an Android smartphone (a Droid X) and the only Apple devices in my house were my daughter’s 3rd gen iPod Nano and a work MacBook that I used occasionally to test out builds of our science software, I decided to try the prototype as a native Android app written in Java.

Breaking New Ground

This was a completely uphill journey, although not necessarily a difficult or unpleasant one.  First was the fact that I was working in Java.  I’m primarily a C++/Perl programmer although I’m familiar with many other languages.  I have a passing knowledge of Java but have never really used it for any real project.  So working in Java required more than a bit of looking up syntax and functions.

Doing event driven, GUI programming wasn’t completely new to me.  On of my side projects that I work on off-and-on is a computer version of the spaceship combat game from the old Star Frontiers role-playing game.  This game is GUI based and so the concepts of responding asynchronously to input events isn’t new.  In fact to a lesser scale, the main data server that I built for the mission does the same thing but the events are coming from sockets instead of a user interface.

And of course the entire Android development process was new.  Screen layouts, the SDK, etc was virgin territory.  I spent a lot of time looking at the developer documentation to figure things out and learn about the various classes, what they did and how they interacted.

What to Build in the Prototype

The next question was what the prototype should contain.  The goal of the prototype was two-fold.  First, I wanted it to demo the basic functionality of the application so I could show it to the project scientist to get approval to do the full application.  And second, it was a way for me to explore a bit of how to do thing in the mobile space and how the whole mobile development paradigm worked.

In the end I decided to implement three major components:

  1. Plotting the light curves – This was to be the major functionality of the application to begin with so it made sense to try this out from the get go.  It didn’t have to pull data from the web or perform updates, but it did need to plot regular data points with errors as well as upper limits and give source and data range selection options.
  2. Show the Fermi Sky Blog – I mainly did this one because it was easy as it was effectively just providing a link to the web page of the blog.  This provided some experience in launching other tasks (Activities in Android parlance) that were external to the application I was writing.  However, while everything I learned here could have been learned from implementing the ATels (#3 below) it did provided a little more functionality to have in the demo.
  3. Building and displaying the list of Fermi related Astronomer’s Telegrams – The main draw to implementing this one was that it provided some experience with reading an RSS feed and parsing the related XML.  Both of which I’d never done before.  It also provided some experience with the process of using the network interface to go out and get data.

Putting It All Together

It took me about a week and a half to get the main application screen and get the basic plotting implemented.  I know because a week and a half after I got back from the AAS meeting I was on the plane headed out to NASA Goddard.  The trip was to help train a new staff member on our data server but I would also be pitching the mobile application to the project scientist.

One thing I was reminded of during that time is how effective and efficient you can be when you are really excited about what you are working on.  I was really excited about this project and wanted to pursue it and so I found myself very focused and working hard to get this done.  It’s amazing what you can accomplish when you don’t let yourself get distracted.

While at Goddard, I had a chance to show the prototype as it existed to the scientist who I had worked on the design with as well as the project scientist.  Both of them liked what I had so far and the project scientist gave the green light for me to work on this officially and implement the full version.

I still had work to do on the prototype to fulfill it’s role as an exploratory tool for some of the techniques in building the app but it had fulfilled at least one of its main purposes as a demo tool.  In the end, the functionality of the prototype was expanded some what to include other things like notifications, automatic data updates, and pulling live data from our servers.  Especially in the latter case, it served as a test client to back end services that I needed to develop for the final applications but that that is the topic for another post.  But all along the way it was a tool to help me learn what was possible, what wasn’t, and how to implement those things.  And in the end, that was really its primary purpose which it fulfilled admirably.

This post originally appeared on my old Programming Space blog.

Designing the Mobile App

This is the second of several articles about the journey of developing a mobile application for the Fermi Gamma-ray Space Telescope mission.  Part one was entitled My First Mobile App.

The idea for the application came about due to a request we had from a couple of scientists at the American Astronomical Society meeting in January 2011.  They asked if we had a mobile application that would allow easy access to some of the public data that we were already releasing on the mission website but which would be nice to be able to quickly access on their phones.

At the time we didn’t have such an app or plans to create one so the answer we had to give was no.  However, the requests started us thinking about what it would take to create such an application.

While at the meeting I sat down with one of the mission scientists and she and I went over what such an application should provide, both in terms of functionality and data.  Over the course of a couple hours we worked out the initial design of the app.   This was by no means a continuous process as we both were on duty staffing the mission booth and answering questions about the mission to those who stopped by and so were continuously being distracted from the design process to talk with others about the Fermi mission.

However, out of that process came a fairly straightforward design of what the application should do.  In all, the final design was barely over one page of hand written (by me) notes that included the basic functionality of the the app, the various user interactions it should support, and basic sketched out screens for the various parts of the app.

The initial design we came up with in those few hours at the AAS meeting has served remarkably well to guide the development of the application through its initial release.  Although I should say that the application is fairly simple.  It is serving up basic plotting data and then a lot of textual data and as such didn’t need a complicated design.  Even so, having the design provided good guidance throughout the later development process and kept me on track of what to do and what to leave out.

One of the best things you can do when designing any software, is sit down with potential users and find out how they expect the app to function.  While I knew this already, the process of designing this application reminded me of that truth.  Working with the scientist on the design was very helpful.  While I have a Ph.D. in Astronomy myself, we were working with data that I didn’t use and had no experience with.  She was someone who would actually be using the application and the data it provided and so was invaluable in providing insight into how the app should behave and how the data should be presented.

This post originally appeared on my old Programming Space blog.

My First Mobile App

For the past few months I’ve been working on a mobile application for work.  While it’s nothing fancy, considering the fact that I had no experience with mobile development when I started, I think this first version of the app turned out pretty well.  Although the real test will come as the number of users increases.

The journey from concept to initial version has been fun,  interesting, and educational as well as filled with frustrations and roadblocks along long the way.  This post is only an introduction to a  series of posts  that I’m planning on writing to document a bit of the journey.  For now I just want to tell you a little about the app.

The app is geared towards scientists who use the data from the NASA mission I work on, the Fermi Gamma-ray Space Telescope, although there is nothing that prevents others from using the app to see what is going on.  As part of the mission, we provide a variety of “high level” data on various sources as well as publish alerts and news about sources and events in the gamma-ray sky.  The goal of the app was to aggregate some of this information onto the computer you’re always carrying with you and make it available even when you are off-line for some reason.

Currently the application provides access for four bits of data:

  • Light curves of monitored gamma-ray sources – These are sources that we’ve either been monitoring since the beginning of the mission or which have flared up to be very bright since launch and we’ve been monitoring since they first crossed a predefined luminosity threshold.
  • Gamma-ray Coordinate Network (GCN) notices produced by Fermi – When there is a gamma-ray burst or other very bright transient event (e.g. solar flares among other things) the satellite sends down a real time alert about the event and its location on the sky.  We aggregate these alerts to provide a summary of the best possible data for each event.
  • Fermi related Astronomer’s Telegrams – These are notices sent out by astronomers about objects of interest that have been detected and analyzed using the Fermi data.  While there are dozens of telegrams each week, the app filters and collects the Fermi related ones.
  • Access to the Fermi Sky Blog – This is a weekly summary of events and objects of interest in the gamma-ray sky.

If you’re interested in checking the application out, it is called the Fermi Data Portal and is available on both the Google Play Store and the Apple AppStore and works on both phones and tablets.  Check back for more about the development process and lessons learned from building the app.

This post originally appeared on my old Programming Space blog.

Astronomy StackExchange Site

I’ll admit I’m a big fan of Jeff Attwood and Joel Spolsky’s family of question and answer sites.  I was an early, although not strongly active, user (#116) of their original StackOverflow site and have at least registered with many of the other sites that have come out as part of the StackExchange network of sites.  I even proposed a site (Role-playing) that is currently in public beta.

Anyway, this short post is to announce a new StackExchange site that I’m really excited about, namely the Astronomy StackExchange. This is a great site where you can get answers to any questions you have about astronomy.  But to make it really great we need more people participating on the site, both asking questions and answering them.

So if you have an interest in astronomy jump over and check it out.

This post originally appeared on my old Programming Space blog.

Saturn never fails to amaze

If you haven’t seen it yet, check out the March 15 Astronomy Picture of the Day.  Its actually a movie this time and not a picture.  Part of of an upcoming IMAX movie called Outside In, the video clip is a flyby of some of Saturn’s moons and a pass through the ring system.  The thing is, there is not a scrap of CGI or computer animation in the entire clip.  It is all real images and data take by NASA’s Cassini spacecraft that has been exploring the Saturn system since 2004.  (You can find out more about the mission and science at the link above and also at the JPL Cassini site.)

So if you haven’t watched the video yet, go ahead and jump over and watch it.  It’s only 2.5 mintues long.  I’ll wait.

Welcome back.

Watching this video reminded me of all the nights I’ve spent doing public outreach with small to moderate sized telescopes (in the 4 to 14 inch diameter range).  Scott Hanselman’s (@shanseman) tweet yesterday evening (“Unbelivable when ACTUAL VIDEO OF SATURN looks like CGI.”) was a perfect capture of all the many comments I’d hear from people who would look at Saturn for the first time through the the telescope.

“That’s not real.”

“Is that a picture?”

“What are we really looking at?”

“Is that really Saturn?”

All said in tones of either amazment or incredulity.  And we’d patiently answer that yes it was Saturn and no, that’s not an image, it’s the real thing.  And people would always go away with a sense of wonder and amazement.  Showing Saturn has always been one of my favorite targets on nights like that because it really is a wonderful sight.

Jupiter is neat, you can see the banding from the storm clouds and if the air is still and you’ve got a good telescope (say 8 inches or better), you can see the Red Spot if it is facing towards you.  Plus you have the Gallilean sattelites that are visible as well.

But there is just something special about Saturn and it’s rings that captures the public’s imagination.  With a good telescope you can see the rings sharply defined around the planet and even see the Cassini division (named after the astronomer who first discovered it), the large gap in the rings that is prominent on any image of the planet.  It’s always a crowd pleaser.

That’s one of the wonderful things about astronomy, the images and views can be quite breathtaking and it’s fun to share that with others.  And it’s funny, that despite being spoiled by all the beautiful full color images produced by NASA, the ESO, and other agencies, the simple images available through a moderate sized telescope (which are mostly black and white since there usually isn’t enough light to trigger the color sensors in your eyes), always elicit amazed responses from those viewing them.  It’s still pretty amazing what is visible to the Mark I eyeball with just a bit of glass to assist.

So if you want to sample the wonders of the universe first hand, check out your local planetarium, univeristy astronomy department, or astronomy club and find out when their next public viewing session will be.  There are bound to be many people willing to share the amazing sights and take you on a guided tour of the night sky.  And if you want to see Saturn, it’s rising late right now (~10-11pm) but will be up sooner and sooner in the coming months.

This post originally appeared on my old Programming Space blog.

Cleaning Out Your Code

In my spare time, I’m working on a game. (I wonder if there is any programmer who can’t say that to some extent?)  The details aren’t important (it’s based on the old Star Frontiers RPG) but if you want to check it out you can find it on my gaming site in it’s own forum topic.

I’ve been working on it off an on for several years now.  It’s primarily been a learning exercise for me but it’s getting to the point now where it is actually playable.  I’ve implemented something like 90% of the rule set. And therein lies my dillema.  My efforts on the project have been in spurts.  A couple of weeks spending 10 or more hours on it and then months where I don’t do anything.

During the “on” times, I’m fired up and want to get things implemented and add new features and get them out the door as quickly as possible.  And so I do whatever I can to “just make it work” and get it out there for people to play with.  And so along the way I’ve incurred a lot of technical debt and the code has accumulated a bit of code cruft as well (well, probably much more than a bit).

I was first introduced to the concept of technical debt when reading Jeff Attwood’s post Paying Down Your Technical Debt.  I could defnitely relate to the topic as I was going through the same thing both in my at work code and my game code.

And it seems all I’ve done since then is build up more debt.  I’ve got these last little bits of the game’s rules to implement and it seems that every addition requires reworking things I’ve done before.  But I’m getting better and have started to pay down the debt and clean up the code to make it better and more modular.

As developers, we probably all have to deal with this at some point.  And if we are developing stuff for others to use, they like to see progress and additional functionality with each release.  Unless the bugs were show stoppers, a release that just fixes bugs isn’t very interesting to your users, they want it to do something more than the last one.

But you still need to pay down your technical debt and clean up your code.  And so for the last couple of releases that I’ve done, I’ve adopted a new strategy for dealing with this.  In each release, I’ve added one piece of new functionality, hopefully something that will pique the users’ interest so that they’ll grab the new version and try it out.  But at the same time, I’m working really hard in the background to clean up and refactor the code.  For every visible addition to the game, there have been two or three backend changes that the user doesn’t see (since it doesn’t impact the UI or game play) but which help me get the code under control and pay down my debt.

And it seems to be working, at least to some extent.  In this last go around I fixed several bugs and in the end, the main code was actually smaller than the original and a little easier to understand.  So I must have done something right.

It’s an on-going battle.  In the end, I guess if you are shipping code, you’re winning.  But the faster you can ship, the bigger the win.  And cleaning out your code and paying down your technical debt just makes things easier and makes it possible to have the bigger win.

This post originally appeared on my old Programming Space blog.