Using the right programming tools

by Stephen Fluin 2009.03.03

It's said so often that it almost cliche, "The right tool for the right job". In computer science this concept has some very real and very practical implications. Almost every developer has preferred tools for certain jobs. Often individuals can get stuck using those tools and believing they are the ideal tools. For this to actually be true, one has to continually evaluate and try out new technologies, new tools, and new ways of using and thinking about those tools.

In order to support this concept, I am going to share the three languages I currently use. I am going to break down what I use it for and why.

Java

What I use it for - I use java for application programming. This means that any server, game, etc that I write is probably going to be written in java.

Why I use it - I use it because its strength is in logic. Javas overhead, strong typing, and strong object orientation enable me to know that if I put the same inputs in, I will get the same inputs back. It is also possible to completely understand and control the state of the program. I anything happens, it is because I changed it or put it there.

Java is designed to be cross-platform, and although this claim is questionable for moving between operating systems or browsers, it tends to be true in environments you control. This means that when I wrote a text-based roleplaying game Troll Attack that interacted with multiple players and xml data files, I was able to run the server on any operating system I chose.

PHP

What I use it for - Web development, and web application programming. If I need to have many users accessing a database or using a program where there isn't a reason to have a custom server and client, I will develop it using PHP.

Why I use it - I treat PHP like stateless programming language. For every request that gets made, I validate the state of the universe, modify it if necessary, and then output the results to the user. This works great because on the web, you never know what people are going to send you. Unlike a language like Java, every day users can intentionally modify your pages and some of your variables on the client side (such as form data), and PHP makes it really easy to follow a paradigm that works with this. Each of my PHP pages reads the session state that I store, process user input, interacts with a database, and outputs the result to the user.

But why is PHP better for this purpose? Java has Java Server Pages, and Python has Django and other cgi interaction tools, and there are a plethora of other languages. One of my criteria for web development is that the language and server be free. This immediately eliminates .NET. Java Server Pages (JSP) follows some of the .NET paradigm, splitting pages into half-code files designed to focus on appearance, and class files representing objects and source code for the pages. The paradigm that java tries to push you into doesn't work for me. I don't think about programming in this way. Although most of my web applications end up looking like this, I prefer to develop something extremely quickly in a single place, and then move forward by refactoring and adding new functionality.

Compared to Python or Perl, PHP is designed for the web. This means that unless you are looking to, you don't need to worry about 404 errors, script errors, etc. When I have attempted to pick up Python or Perl again for web development after a few months away, numerous ambiguous Internal Server Errors frustrated me to the point of giving up again.

Despite the inconsistent command naming and syntax, my agile development process is best supported by PHP.

Python

What I use it for - I use python for scripting. This means that whether I have to mess with log files, remove duplicate files from my system using MD5 hashes, or calculate the 5,000th Fibonacci number, I will use Python.

Why I use it - Python isn't strong for large applications in my opinion, and PHP has web development down pretty well, apart from numerous syntax inconsistencies. The reason I use it is that Python makes simple things simple.

I'm still learning to be a Python master, and I have been finding some extremely useful features recently which might make me reconsider Python's position for other types of development in the future. Two examples are arbitrary integer representation. Meaning I don't have to worry about my integers getting too large. The second feature I found recently was an path walk command for navigating operating system directory structures.


permalink