If all you have is a hammer…

If all you have is a hammer, everything looks like a nail.

Abraham Maslow, “The Psychology of Science”, 1966

This is nowhere more true than in the discipline of programming.

The problem.

There are so many who have their training in this language/platform or that one but have no experience with any others. This sometimes makes it hard for them to see solutions that would be obvious from another point of view.


Many years ago I was working for a company that produced special versions of automobiles for the manufacturers. In one case, we had to provide the window price sticker because we were the last group to touch the car.

Unfortunately, we couldn’t get a file with the data needed to produce the sticker. All we were provided with was the file that would be sent to the printer to produce the original sticker. We needed to extract data from this file so we could produce our own sticker. The problem was that the format of the file was not nice, neat easy-to-parse columns but an ugly mark-up language that really only made sense to the printer.

This was back in the S/38 days where RPG didn’t have any string functions.

To my RPG-brain, there was no way to handle this problem. Fortunately my BASIC-brain knew exactly what to do.

I was able to write a BASIC program to do the processing using all the lovely BASIC String functions (InStr, Pos, Mid…).

Once I’d solved the problem (by thinking in BASIC), I wrote RPG Subroutines to mimic the BASIC functions using RPG character arrays.

Bingo! Thinking in BASIC, but writing in RPG did the trick.

.NET Frameworks and PHP.

More recently, working on a .NET project we had a request from the user for a specific behavior. The expert .NET developer said that it was “impossible”. Well, from his point of view it was. He only had a hammer in his toolbox. Just one framework. He was an expert in this domain, but it couldn’t handle what the user wanted.

This user request wasn’t impossible at all. In fact, it was pretty simple to implement (we had it roughed in about an hour based on a technique stolen from some PHP/JavaScript web pages). Just think outside the box (framework) a bit. A quick step outside the comfort zone is sometimes all it takes!

Some examples.

Check out this old article of mine comparing RPG and PHP, it shows two approaches to the same problem.

In this article (a work-in-progress) about adding Sensors to the IBMi using web services, I’m using DB2/RPG in an IBM i for the web service, but in my original implementation was in MariaDB/Python on a Raspberry PI. Once the design and thinking were all done on one platform it was easily moved to another.

My advice

My advice to everyone is to learn as many tools as you can. You don’t need to be an expert in all of them, but being familiar with many different approaches helps you to see solutions you might otherwise miss.

Besides the practical applications, it can be a lot of fun to learn some other languages and platforms. It’s always good to keep learning and with all the Internet resources, it’s easy to find good tutorials to play with.

George Alderton