5 questions to ask before “Hello World”-ing in a new language

Shir Matishevski
NI Tech Blog
Published in
5 min readJan 10, 2019

If you could go back in time to the first day you started coding, what would you tell yourself?

For me, it’s “you’ll be writing code in so many languages, don’t get too attached to C# .” But really, in the last decade so much has changed. While back in the days you could learn one big and popular language and just keep evolving in that field, nowadays you rarely get that luxury. Being the optimistic person that I am, I think that’s a huge benefit for us developers, but at the same time, I’m very aware of the struggle.

As a web developer especially, things have been evolving so quickly. Nowadays, there are ~700 programming languages out there. Just for the past 2 years, I moved from writing code in Ruby to Node.js and then to Java, and of course, I also wrote some client-side so needed to learn React.js … you get the idea. That’s CRAZY!

so many tabs, so little time

So after years of having my production apps written in ~6 different languages, sometimes learning 2–3 new ones in parallel, I think I’m onto something here. I realized I developed a method.

Wait, why do you even need a method? Can’t you just google the language, find some tutorial/cheat sheet and get started?

You see, it’s not that simple nowadays. It’s very hard to know what platform will provide you with the exact information you need. Do you start with looking through blog posts? maybe Youtube? or maybe you head over to some “Getting Started” tutorial on some Learning platform like Lynda/Pluralsight/Egghead/CodeAcadamey? 🤷‍♂️🤷‍♀️ You will probably find so many tutorials, that you’ll just feel overwhelmed and the worst thing is — they might not cover all the things you NEED to know to get your software written.

So what can we do? For me, I’ve wrapped my head around some questions that once I get them answered, I know I’m able to head over and start doing my thing. Answering these questions help me get more productive with my learning time, as well as choosing wisely my learning sources.

The following are the 5 questions you need to ask to help you SPEED UP your learning of a new programming language:

  1. What is this language best used for?
  2. How does the language handle a problem?
  3. If (language.type == backend) — How does it communicate with the DB?
  4. Configuration / Convention?
  5. What package manager should you use?

Before we get started with an example, I want to be clear — these are not the only questions you should be asking yourself, but rather just a few I found worth mentioning since they might be less intuitive to some. For the more intuitive/classic/less generic questions, You will probably want to go and figure out how to declare variables, whether the language is typed, learn about scope, closure and such. But since the above are, as I said, the “classics” that are usually covered in most Programming languages tutorials, I wanted to address the somehow forgotten questions.

Now, let me walk you through the process. Let’s say you want to learn Node.js for the first time! Exciting times!

So, you ask yourself:

What is this language best used for?

Just to make this point clear, Node.js is not a language in itself, but rather javascript running as Server side. Now for answering the question- Node.js really shines for Real-time web applications, thanks to its ability to process many requests with low response time. Realizing the strengths of the language is crucial to writing good quality code.

How does the language handle a problem?

To answer this question you need to look for the error-handling methodology that is implemented by the language. For Node.Js, it throws in a standard way, only it throws Errors (which are equivalent to Exceptions). Another important note is that since JS is a functional interpreted language in its nature, it doesn’t have any out-of-the-box completion process and all of your Exceptions will only be shown on runtime. Understanding the language’s mechanism of handling errors will allow you to design your system better and will likely reduce the “unexpected error”s your software will run into.

How is it communicating w/ the DB?

For simplicity reasons, let’s assume your DB is a MySQL database. Node.Js gives you plenty of options, depending on how many dependencies (see what I did here?) you would like to add. The simplest solution would be to require the MySQL module, initialize a connection and run native SQL queries against it. If you want to take it a step further, you can also consider using an ORM like Loopback, Sequelize, Mongoose and many others.

Communicating with the Database may seem trivial, but it’s often not the case. Learning about the options that you have in order to set this part up, will allow you to write your DB accessing segments in a more efficient and elegant manner.

Configuration / Convention?

Node.js projects usually rely more on configuration over convention, i.e it won’t ruin the whole project if you locate your controller in another folder or, god-forbids, use plural namings.

Just in case you haven’t worked with a “convention over configuration” language/framework fashion, let me just say that knowing this part, in advance, will seriously save you a huge amount of time. This is because when Convention is preferred, everything that is not aligned with the “rules” will just blow-up and if you don’t know this, you will likely be introduced to it in a tough way.

And finally,

What package manager should you use?

For Node, the most popular package manager is npm, while yarn is definitely on the rise as well. Deciding which one to use is a whole different topic, but if you’re just starting out — it won’t make a big difference for you and you can just go for npm (which since v5 is as fast as yarn).

Package managers are, in my opinion, not the first thing you should choose. However, you will most likely need one in order to continue your development cycles happily. This is the reason I’ve decided to put this question here as well.

Why I wrote this (or: Summary)

Though I love researching, I would often feel the need to learn and read so many articles before I was able to go ahead and start coding in a fresh new language, since I always found something that I still didn’t know. I hope that by reading this post you got a better sense of what you really need to know before heading over and writing your basic software (or your advanced one) in a new language. I know for myself, that since I started applying this technique, it saved me a ton of research time that I used to spend.

Learning a new programming language can feel a bit overwhelming at first. However, everything is solvable with the right algorithm 😏 I hope that the technique I’ve shared above will help you find your way of doing it faster and better.

--

--