Language choice and Polyglots By drenwick on 2019-06-14 09:28:13

As an active member of a game development community, I frequently see people completely new to programming wondering which language they should learn.

Given most of them are interested in game development, the answer is usually C# or C++, but I see many people who seem to think that, once they learn a language, they will only ever use that language.

To explain why this is a problem, I'd like to start with an analogy. Let's say you're doing some DIY house work, maybe you're building a deck, or fixing a broken cabinet. You head to Home Depot, and ask the first employee you see "Should I get a screwdriver or a tape measure?"

The employee is going to look at you dumbfounded, and ask you to elaborate on what it is you're trying to do. This applies to programming languages. When you join a chatroom and proceed to ask "Should I learn X or Y", it's very likely you're asking for the difference between a screwdriver and a tape measure.

Not all languages are created equally. In theory any language can do "anything", but in practice each language has its own use case, and it's up to you as not only a programmer, but a Software Engineer to pick the right tool for the job.

For those still in the dark, here's a brief list of languages I use, and their typical use cases:

  • C#
    • Desktop software development
    • Server application development
    • Game development
    • Backend web development
  • PHP
    • Backend web development
    • Server script development
  • JavaScript/TypeScript
    • Frontend web development
    • Game development
    • Backend web development

Of course, you can push these boundaries and do some unintended things with these languages. For example, given JavaScript can be used for Backend web development by using Node.js to run JS scripts on the server, it can also be used for Server script development.

And yes, there are OpenGL bindings for PHP, meaning if you were to find a way to run PHP on a user's desktop, you could do game development in PHP (Note to self: Possible future project)

So with this in mind, when you join an online chatroom and ask "Should I learn C# or JavaScript", my first question is going to be "What are you wanting to do?" If it's game dev, are you wanting to make browser games or desktop games?

JavaScript is designed as a frontend web language, so is perfect for browser games, but through Electron it can be used for desktop games as well. C# is designed as a desktop development language, but given it is used by Unity, it can also be built for WebGL.

However, I personally wouldn't recommend JavaScript for desktop or 3D games, and I wouldn't recommend C# for relatively simple 2D browser games.

On the other hand, if you're wanting to do web dev, I'm almost certainly going to recommend JavaScript. C# can't properly handle frontend web dev, not without an awkward transpiler and while, thanks to ASP.NET, C# can be used for backend web dev, it shouldnt.

So the next time you find yourself pondering which language to use, think about what you're trying to do, think about what the languages are designed to do, and don't try to unscrew a screw with a tape measure.