20 essential points on learning a new programming language

devops terminal
7 min readAug 16, 2021
courtesy of photo: https://unsplash.com/@altumcode

Once, I heard from a developer “C++ is all I need for the rest of my career” and yet after 5 years, he needed to spend full time learning a new programming language named Java2. That was a story I heard 10 years ago, so what about now?

It wasn’t far away when a collection of new programming languages were introduced to the computing world within the last decade including Golang, React, Vue, Rust, VLang (and a few more). Learning a new language is not an uncommon act anymore, instead we would need to get ourselves ready for learning a new one at anytime. That brings out a question — “how do we effectively learn a new programming language then?” This blog tries to summarise a list of points to look for when learning a new language from scratch. Hopefully it rings the bell in you :)

1. “Hello World”

Knowing how to write a “hello world” in the new language is essential as it involves the following points:

  • how to code the “main” method (including the parameters and syntax involved)
  • knowing how to format the source code. Some languages like Golang has a relatively strict requirement on the source code formatting and again this is essential for us to master the language
  • understand how to compile the source code into executables or intermediate byte-code. Here includes writing build files (or makefile) even though most modern languages do not required such settings.

2. comments

Comments provide us hints on how the program works; hence it is essential to know how to add comments (I know… not every developer loves to write comments :))). Most modern languages also leverage comments to build documentations as well.

3. variables

Programs work with data members (a.k.a. member variables, properties, instance variables …), knowing how to declare variables with the correct data-type is a MUST.

  • understanding various data-type characteristics improves memory consumption in general. Take an example, if the HTTP status code ranges from 200 to 500, using a short (16 bits) rather than an int (32 bits) would be more efficient on memory management.
  • knowing how data-type behaves improves program logics. Provided that a language provides 2 integer data-types, int (32 bits signed) and an uint(32 bits unsigned), the latter one actually can store more +ve integer values whilst it would fail to store any -ve integer values; which means if this variable would NEVER had a -ve number, using uint seems to be a better choice.
  • learning how to initialize the data-types correctly. Different data-types would have their own ways to init the values in a couple of fashions which is essential to know as well.

4. constants

Most languages support constants and again we should learn how to define re-usable constants throughout the code.

5. arrays, list and map

Every language has its way to define a collection of homogeneous data — array and list; knowing the various ways to define and init such data structure is essential. Maps (we can find map structures OR dictionary in early languages such as “c”) are one of the most handy data structures we would hands on, learning how to operate with it is again essential.

6. functions / methods

Programs usually are composed of data-members (mentioned in point 3) and functions / methods. Data-members store the attributes / data of a program, whilst functions provide business logics to manipulate the data-members in a senseful way.

  • knowing how to define functions. This sounds funny, but the truth is different languages have their unique syntax on function definitions, take an example in VLang, a mutable parameter needs to be annotated / prefixed with the “mut” keyword whilst for Golang, all we need to do is to pass a pointer / reference instead.
  • understand how to return values. Again… sounds funny, languages have different support on returning values, take an example, Java2 can return a single value; whilst Golang could return multiple values. Hence knowing workarounds on Java2 in returning multiple values would be essential in this case (we can always return a Map or custom-object which contains multiple values inside)

7. conditionals (if / then / else)

Conditionals are important to grasp… unless the business logic is 1-direction.

8. loops

Loops are essential for iterating a collection of values like an array. Sadly different languages have their own unique syntax for iterations; hence learn them~

  • knowing what loop flavours are available. Take an example, not every language supports forEach
  • experience when to use which loop flavour. Simply when is the best moment to apply a forEach and when to use a Do-While loop.

9. pointers / references

Some languages hide out the complexity of pointers / references for us (e.g. Java2), however still a lot of languages (c, c++, Golang, VLang, Rust etc) depend on such feature; hence it would be our responsibility to learn how to work with pointers.

10. concurrency (threads vs routines)

Advance topics~ Most programs do not require multi-threading functionality, however if your program DOES… we would need to learn how to operate on the supported concurrency models. In Java2, there are a lot of supported models including Futures and pure ThreadPools; whilst in Golang and VLang, the main option is routines. Grasping these concepts would be essential in case multi-threading is required.

11. testing (unit testing)

Talking about testing, there are a few flavours including unit-test, site-integration-test, user-acceptance-test etc. Despite all the mentioned, only unit-test is 100% do-able.

  • Somehow not every language provides built-in support for unit-test; hence learning how to setup the unit-test infrastructure is another essential task
  • code coverage is another measurement on the quality of your code. Again, the question is how to setup the infrastructure AND to know which source code components should be included in the code coverage exercise. Take an example, many projects actually evicted Database-Access-Object code logics as DAOs usually just perform search queries and simple updates to the backened data-source; so not much value to run a test on such.

12. memory management

Related to point 9 above, if the language supports pointers and references, we would need to know how to reclaim the memory. Sadly, not every language provides support on auto memory reclaims. Java2 has auto GC (garbage collection) but c / c++ does not by default. Sometimes memory leak would happen to Java2 as well, hence on the coding level, we would need to “cleanup” object references as soon as they are done…

13. restricted words

Each programming language has its own restricted words; knowing them is essential again or else your source code won’t compile. Or worse… they got compiled and execute in a weird way till it crashed (Most modern languages would block your code from compiling, so no worries :)))).

14. documentation

Related to point 2 above, special comments in the source code would be converted into documentation. Unless your code is not used by others… Good documentation on describing how your code operates would be a plus to code-sharing and code-reuse. JavaDoc is a blockbuster feature in Java2, it simply helps to convert certain comments from your source code into a HTML documentation file; and since then, most languages introduced afterwards have similar documentation support. (big thank to Java2~)

15. module / library integrations

Languages nowadays have the capability to import 3rd party module / libraries into the source code. Learning how the import works is essential; think about it, we probably won’t write logics for everything~ If there were a HTTP connectivity library, we should use it instead of re-writing it… Importing 3rd party libraries involve also the updates on compilation steps as well and it would be necessary for us to know.

16. structs / classes / objects

OOP (object-oriented-programming) is a big thing since 1990s. Hence learning the language’s support for OOP is important. Interestingly, not every language supports OOP directly. In Golang and VLang, they provide an “object-like” functionality by extending the structs to provide callable functions; whilst for Java2, it supports pure and complete OOP like inheritance and polymophism.

17. generics

Generics helps to avoid wrong data-type insertions on data structures like List and Map; it also helps to reduce type-casting when accessing the data-members. Interestingly, generics is yet powerful but NOT fully supported by all languages. Hence we should learn about generics support on our targeted language.

18. json handling

JSON~ What is JSON? :))) A simple sentence is — a format to denote a message / event which would be exchanged between systems. In the good old days, we would be using XML instead; but due to the bulkiness of XML, we shifted to key-value pairs JSON nowadays. Since JSON is a de-facto standard to exchange information between systems (expecially written in different programming languages); learning how the language could handle JSON parsing is essential.

19. ORM (object-relation-mapping)

ORM is a way to convert between an object into a datastore format and vice versa. Not every programming language provides such functionality. Hence learn about this would be an extra. But to be honest, ORM could also be viewed as Marshal / UnMarshal of data — simply converting data formats. One example is you have a JSON document and how do you convert it into an object? Maybe converting the object contents back into a JSON document. So all these are essential to our programs in some ways.

20. language specific features

Despite of the above points, the last thing we should learn is the language specific features. If not… how could we claim “mastered the language” :)))

closings

I hope this list (20 points) are informative to you and rings a bell. In the coming blog posts, I would provide some examples on the checklist on how I learnt VLang. Stay tuned ~

--

--

devops terminal

a java / golang / flutter developer, a big data scientist, a father :)