How I Choose a Language for a Project
I’m apparantly a freak. Well, say those who know me, duh! But in this sense I’m talking specifically about programming. Most people program in one, maybe two languages. I program in a half dozen fluently, and a full dozen if you count languages I would need a refresher on.
So this is fairly unusual from what I’ve seen, but it has some distinct advantages. For one, getting a paying job is pretty easy when you know most major programming languages. Second, and most important as it relates to this post, you have the flexibility to choose the right language for the job.
Programming languages all have pro’s and con’s, and specific cases where they may be better than another. Part of knowing how to program in a language should be the best times to use it. Because while C++ gives you great speed with your code, you’re going to have a really hard time programming a web site in that.
So here’s a quick breakdown of the pro’s and con’s of the languages I use regularly, in the order I most use them (outside of work, or it’d be C# at the top even when it’s not my language of choice)
PHP is my go-to language of choice. It’s quick, flexible, well-documented, and the syntax is easy to understand if you’ve done basic programming. PHP is a language that gets out of your way and lets you get down to coding without worry about imports and DLLs. Many a programmer has been converted to PHP when forced to use it because the code is easy to read and easy to run functions. None of this System.out.println stuff, you just say echo; It also has a massive community of developers, who more than likely have already solved the problem you are tackling, so googling becomes very useful.
Ruby has jumped a few spots in the last few months as I’ve revisted Rails, by far Ruby’s killer application. Rails is a MVC framework for Ruby that adds a lot of structure to Ruby, and makes it very powerful as a web language. Rails created “scaffolding” or being able to type in a console command to create your components as their most basic levels. It’s extremely powerful and useful for things like Models. Ruby also has the ability to be added on to with “gems” or pre-built community code that you can install with a command. They are extremely powerful. I built a full registration and login system in a half hour using a gem and a tutorial. And unlike PHP Ruby does not have an execution timeout set.
On the downside, Ruby’s syntax makes me want to cry. It’s painful, mainly because it takes a little of this and a little of that approach to syntax. It’s got some C style in it (Java, C#, PHP all follow C style) but when it comes to brackets, they are gone for words. There are around 4 ways to do anything in Ruby, so unless you comment your code someone will have no idea what you did (and I’ve worked with enough programmers to know we never comment as much as we should!). But overall it’s a solid language, albeit with a bit of a steep learning curve.
Despite being primarily Windows-only, C# is the only way to do a Windows application. And since Windows is still the OS with the largest market share, it makes sense to develop a nice GUI for it. C# is a nice language, there’s no way around it. It built upon what was nice about C++ without going the Java route and making everything so complex you’ll never be able to figure it all out. And it has so many features that are just inspired, primarily LINQ, which lets you search arrays just like you search a database (oh, and you can search those with the same syntax!). And everyone can agree Visual Studio is the best IDE around, with just about every bell and whistle a developer could ask for in it.
C#’s biggest problem is primarily the documetation. As in it’s buried in so many places and so imcomplete it’s very difficult to find what you are looking for unless you know where to look for it. Which brings us to point number two: It’s extremely complex. C# has so many “add-ons” that you need to know to really “know” the language that I doubt anyone really knows it all. There is WCF, WPF, .NET, Sharepoint, and let’s not even mention legacy things it has to support like older ways to do GUIs. So it has a bit of what I call “inherent complexity” in that to do something simple, it takes a lot of either typing or work.
Like it or leave it, Java is a huge force in the world. From desktop to Android, it runs just about everywhere (except your non-Android phones mostly). Unlike C#, this includes OSX and Linux as well as Windows. So it’s ideal if you need to do a cross-platform desktop application, and it’s alone in that regard.
But past that, Java is pretty horrible, and I don’t know anyone who will admit to actually liking it. It’s horribly slow (and the cause for why Android is so slow), very complex to use, has spotty documentation, and tends to give some of the most cryptic errors I have ever seen in a programming language. If you can avoid it, never use Java. The fact that they still teach introductory programming classes in it is probably the reason most kids transfer out of computer science. It scares them away!
So we’ve got the pros and cons out of the way, and I mentioned a little about what each language is good for, but how do you go about picking when some of them overlap? I’ve propared a flow chart to aid in your quest. The main idea is to limit language fragmentation where you code different parts of your software in different languages, hence some of the odd answers. Also I don’t take into account languages I don’t know or use often, so there may be something better out there. Also this is very simplified, choosing a language is actually a pretty big part of starting a new project since you’ll be stuck with it for as long as the product exists!