Dec 312013

I’ve spent a year reading Clean Code: A Handbook of Agile Software Craftsmanship. That’s not to say I’ve been reading it once a week or had so little time I only managed to read a single book. Instead, I’ve been slowly making my way through it – sometimes only reading a single page at a time. It has made me a better coder and I’m certain I’ll be reading it again.

Clean Code Textbook Cover

The premise is: bad code can operate, but only clean code will work long-term. As code develops and matures, effort must be made to clean and improve it. If your code starts out ugly (or becomes ugly over time), things will inevitably fall apart. Bad code requires too much effort and too many resources to maintain. Businesses and organizations can be weighed down or destroyed by bad code.

Continue reading »

Nov 302013

Computers are complex systems, which makes them difficult to predict. Often times the hardware layers are fairly sophisticated, with the software adding even more factors – many more than a person can fit in their head. That’s why unit tests, integration tests, compatibility tests, performance tests, etc are so important. It’s also why leadership compute facilities (e.g., ORNL Titan, TACC Stampede) have such onerous acceptance tests. Until you’ve verified that an installed HPC system is fully functioning (compute, communication, I/O, reliability, …), it’s pretty likely something isn’t functioning.

Stampede InfiniBand Topology

Stampede InfiniBand Topology

The Stampede cluster at TACC contains over 320 56Gbps FDR InfiniBand switches. Including the node-to-switch and switch-to-switch cables, over 11,520 cables are installed. How much testing would you perform before you said “everything is working”?

Continue reading »

Feb 242013

Writing shell scripts is easy, but they’re often ugly. Writing Python is clean, but getting it to accomplish the same tasks isn’t always as easy.

I’ve been kicking around the pros and cons for a while. Many people choose simply based on what they already know, which only gives them that one option.

After reading A Clean Python Shell Script the conclusion started to form in my head:

  • If there aren’t any arguments to pass in, it’s probably a shell script.
  • If there isn’t much for control logic (besides a single loop or if/else) it’s probably a shell script.
  • If the task is automation of command-line instructions it’s almost definitely a shell script.

Python is great for projects with complicated logic or utilities that take many different arguments. Similarly the logging capabilities are excellent if the project could fail in many different ways.

I suspect that if I have a project mixing this set of requirements, I might try calling the shell from Python rather than trying to shoehorn pipes and I/O redirection into Python.

Aug 082012

I’ve been dabbling in game development for at least 7 years. A lot of knowledge and experience have been absorbed, but there’s not a lot to show for it. My primary project was originally a barely-playable prototype, but has been a technology demo ever since.

A year and a half ago, I wrote that you have to complete simple game projects before building larger games successfully. I’m sure it’s not a universal rule, but I have no doubt a more experienced developer designs better games. I failed to follow my own advice and continued dabbling with my existing project. There’s not a lot of free time in my schedule, but I’m now certain I have enough to get things done.

Screenshot of N-Snakes game

At the end of July I attended a Boston Python Meetup focusing on simple projects. Based on a Pygame template they built, I was able to quickly build a playable game. I’m not about to win any speed-coding competitions, but I have an interesting game after one month of dabbling.

Continue reading »

Feb 032012

Procedurally generated content is a fairly large movement at this point. The most prominent, recent example is probably Minecraft, which relies heavily upon computer algorithms to generate the world and events in the game. There’s no cubicle farm of artists churning out Minecraft landscapes.

To a large extent, we have Ken Perlin to thank for this. Ken was awarded an Academy Award for the invention of Perlin Noise during the production of the film Tron. His name is now ubiquitous, but unfortunately the algorithm which bears his name is dated. Ken published a paper in 2002 describing the drawbacks of Perlin Noise and introducing a new algorithm. Many references to this algorithm confusingly call it Improved Perlin Noise, but it is actually named Simplex Noise.

It seems many developers start searching for noise functions and don’t know which to use. Thankfully, Simplex Noise is a suitable replacement to Perlin Noise in almost every way: the noise is cleaner, less computationally expensive and easier to implement in hardware (if desired). Unfortunately, with all the confusion on the web it’s hard to find a good implementation and impossible to find documentation.

Continue reading »

Jan 272012

Maybe you’ve had the experience of retrofitting your computer to operate quietly? Afterwords you say to yourself, “How did I ever think with all the noise that computer was making?” A small change in your environment creates a shift in your thinking and productivity.

I had the same reaction to the Sublime Text editor. After an hour of use I was loving it. A couple hours later it was customized just the way I like it. The next day I realized I was spending more time getting good code written and less time fiddling around.

Screenshot of Sublime text editor

Sublime doesn’t have every feature possible, but it does have some imaginative features such as multiselect/multi-edit. Linux, MacOS and Windows are supported. A vi mode is available. It’s also incredibly clean and fast. You’ll love the way it looks and feels.

There are all sorts of options for customizing the editor. Many plugins are available and it’s easy to write you own. You’ll also find plenty of assistance in the forums. It seems Sublime is going viral within the developer community.

Oct 182011

I’m giving a lightning talk at the Boston Python User Group this week. The presentation is very short, but provides a 5-minute overview of why an object-oriented design may not be ideal for game development. None of these are my own ideas – I’m simply passing along the wisdom of much wiser (and larger-scale) game developers. Object Oriented designs have caused them much pain in the past, so they’ve come up with a better scheme: Entity Systems.

Entity Systems provide more flexibility (for the developers and the game designers) and higher performance. The end goal is a design that is easier to create and much easier to modify.

Continue reading »

Apr 232011

I’ve been curious about QR codes for quite a while. They certainly seem like an interesting method for distributing data, but are also simple enough for people to do creative things with them. You’ll see them popping up more and more – on ads, in videos, random t-shirts, etc. I fear I’ve spent too much time brainstorming unique QR codes…

I don’t know that animated QR codes will ever be particularly practical, but it seemed like an interesting experiment. One of the simplest examples is a simple QR code clock which updates once a second.

Continue reading »

Mar 272011

Google, Eyebeam and Fast Company are hosting a data visualization challenge:

Every year, Americans fill out income tax forms and make a payment to the IRS. It’s an important civic duty, but it is also a lot of money. Where does it all go? Using data provided by, we challenge you to create a data visualization that will make it easier for U.S. citizens to understand how the government spends our tax money.

When I learned about the visualization challenge, I’ll admit I didn’t actually know many hard facts about government spending. I knew the military and national defense were huge expenditures, but wouldn’t have been able to accurately place them in relation to other large expenses, such as social security.

I decided my level of knowledge would likely be similar to that of potential visitors, so I used that as a strength. Building a tool which helps me better understand the budget should be equally useful to others.

Continue reading »

Jan 302011

Six weeks ago, in an attempt to improve my productivity, I pledged to build a simple game. Regrettably, the deadline has passed and I have nothing to show for it. The reason is not technical but simply a failure of time management. I have two perfectly acceptable designs and I did pick up a bit of Python, but I never sat down to start development.

There are a few reasons for the failure – some avoidable and some unexpected. For several days after I resolved to build a new game, I read through the Python manual and picked over the available tool sets. Then I was distracted by some other projects and the holidays. Two weeks ago, I came down with a particularly nasty illness and was out of commission.

Continue reading »