Joining the Coders Without Borders

Or: How to Always Get the Best Tools for the Job

Hayo van Loon
incentro
7 min readAug 23, 2019

--

Ever been in the situation where there is a good framework, but it hasn’t been ported to a language you know (i.e. Python’s scikit-learn)? Or where there is a port to your language, but it lags behind several months or years its native language (i.e. Apache Beam Python vs Java)?

Fortunately, I am reasonably proficient with mentioned languages, so these examples do not directly apply to myself. But there are (probably) plenty of useful frameworks out there for which I do not (yet) master the native language. Regardless, when you work in teams, you might run into the issue by proxy if some team members do not know a framework’s native language.

Other than waiting and hoping, there does not seem to be a whole lot that can be done about it. Until you rewrite the rules of the game that is. “If the mountain does not come to Muhammad, then Muhammad must go to the mountain.”[1]: you just learn the language!

This may sound irrelevant in a professional setting, but I would argue that you could make a business case for it. With the benefit of being able to choose the best tools (and up-skill your developers), the costs are the developer time alternative costs. Learning time for any language to a basic professional level is measured in weeks, not months or years. It usually takes more time for updates to trickle down from the framework’s native language to yours.

Also, in a world moving towards microservices, one is less bound by old constraints of languages. As long as a microservice fulfils its contract (and security is in order)(and resource use is within limits), what language it is written in should be the least of concerns. Plus, if you keep your services micro enough, coding them in the first place should be less daunting in any case.

Last year, I started learning Go and recently I started with C. I could not help notice that I was following a similar pattern. So without further ado, here I present my free, seven-step, (partly) tongue-in-cheek guide to learning new programming languages.

Step 1: Best! Language! Ever!!1!

Face it: your to-be-learned language is better than any language you have ever learned. Its performance is stellar, it is incredibly concise, it is the source of all life. Be sure to inform co-workers and bosses of your plans. Make sure they acknowledge the aforementioned absolute truths. At times this might require application of minor force, but ultimately it is for their own good. Some might even want to join you in your quest; the more, the merrier.

Step 2: Hello World

Only after you have raised expectations sky high should you try your hand at ‘Hello World’. This requires patience, but once you start receiving the first (passive-aggressive) enquiries on your progress, you are good to go.

For C, I could quite literally code the ‘Hello World’ [2]. You will probably have to make do with a puny imitation. But go code it all the same.

Compile it (if applicable).

Run it.

Weep tears of joy and show this masterpiece to all your colleagues. They might appear underwhelmed, but do no be disheartened. Those are cheap facades for their raging envy. If needed, extrapolate the features of this fine piece of software engineering to all the benefits lectured to them during step 1. To your trained eye, these are of course obvious and justified, but not all eyes are equally susceptible to the truth.

Step 3: Read

Once you have those bare basics, you will need practice. But first you will need to get familiar with the features of the language and its idioms. Try to get a basic grasp of the language’s main concepts. Most languages loudly advertise those somewhere on the internet. With any luck, they may host some small tutorials as well. Have a Go! (pun intended)

Learning to write proper, idiomatic code can take quite some time. Reading a code style guide from a respectable authority on the matter should give you a head start. Besides, it is never a bad thing to read stuff from people you are soon going to be rubbing elbows with. For my language, I scanned through the Linux Kernel Coding Style[3].

Learning about food safety equipment

Step 4: Solve a Classical Problem

You could try to implement that awesome app you thought up the other day, but restrain yourself for now. Keep it pure; make it about just you, the language and writing it properly. The value here is in the journey, not in the result.

My advise is to solve some standard coding problem you have already solved in another language. You should pick one of reasonable complexity. For reasons I will detail below, I always pick a variation of the coin change problem[4]: “Given an infinite supply of coins from a certain set of values, what is the minimum number of coins required to obtain a certain target amount”.

I found that when solving this issue, you encounter several basic language components like flow control and collections. Especially with the latter, form and ease of use can vary (surprisingly) from one language to another. This is where the caveat comes though. Whenever you run into an issue, do not go to StackOverflow to look for a quick fix. Rather, use StackOverflow to (find references to) read up on the topic at hand. Then and only then return to the issue at hand. You learn the most from questions you both ask and answer yourself.

Another plus of the coin problem is that it can be extended naturally in several ways. If you had not done so already, you can implement using command line arguments as input for both the target amount and value set. This can help you bump into things like number parsing and exception handling.

For this particular problem, you may also want to implement your own sorting algorithm along the way. Another tweak is to add the requirement to elegantly return not only the minimum number of coins, but the underlying set of coins as well. Not all languages have convenient support for returning tuples. Or even collections.

Step 5: Include an External Library

Real-life programming usually revolves around tying one library to another with as little code as possible. More often than not, these libraries are not part of the language’s built-in libraries. Therefore it is imperative to find out how to include external libraries. Pick something simple to practice; for instance a single-purpose library like a JSON or YAML parser. Anything will do really, as long as it does not distract you from the language; time spent configuring peripherals is time not spent learning the language.

Step 6: Go Parallel

Eventually you will need to do some parallel processing, for instance when aggregating information from multiple web services. I have yet to encounter two languages that handle or even let you express such concepts in a similar fashion. At times it may take you (deep) into the bowels of the language and/or your operating system. Fun stuff. You can opt to skip this step for now though, it doesn’t really matter as the next step is …

Step 7: Despair

Even when implementing simple stuff, you still visit StackOverflow at the wing-flapping rate of a hummingbird. Your compilation error logs dwarf Wikipedia. At times your programs crash before you even write them. Although you may have experienced some improvement since HelloWorld, you are nowhere near as productive as in your previous life. You are starting to realise it is going to take weeks if not months to reach a base professional level with your new darling.

But do not give up. No one ever said it was going to be easy (Did I happen to give that impression? My bad). Take a few hours every week to try and build something small, something funny: prime content for banter at the coffee machine. Also: read up on gRPC[5], which can help build language agnostic microservice landscapes. And who knows? Maybe you will get that chance to replace or build a microservice in that fancy new language.

So just keep coding, keep learning and keep testing, everything.

Links

[1] The Phrase Finder, “If the mountain will not come to Muhammad…”, The Phrase Finder, 2019. Available: https://www.phrases.org.uk/meanings/if-the-mountain-will-not-come-to-muhammad.html [Accessed Jul 27, 2019]

[2] Wikipedia contributors, “Hello World”, Wikipedia.org, 2019. Available: https://en.wikipedia.org/wiki/%22Hello,_World!%22_program [Accessed Jul. 27, 2019]

[3] The kernel development community, “Linux kernel coding style”, The kernel development community, 2016. Available: https://www.kernel.org/doc/html/v4.10/process/coding-style.html [Accessed Jul. 27, 2019]

[4] Project Euler, “”, The Project Euler, 2019. Available: https://projecteuler.net/problem=31 [Accessed Jul. 27, 2019]

[5] gRPC contributors, “”, gRPC: A high performance, open-source universal RPC framework, 2019. Available: https://grpc.io [Accessed Aug. 23, 2019]

--

--

Hayo van Loon
incentro

Cloud Architect, Developer and Climber. Never stop coding.