How to learn a new Computer Language (Intermediate)

In the past few years I’ve had to learn or interact with new languages at a decent level to solve important tasks (Python, Ruby, Java, Lua, C++).   This is not an exhaustive list, but these are some critical tips and tricks that have helped me significantly when learning/mastering a new programming language:

Memory & Assignment:
1. How are variables declared, defined and destroyed?
2. When assigning data to a variable is it by reference or copying or both? Is there a garbage collector and how often does the garbage collector run, and under what circumstances?
3. When copying a variable is it by value or by reference?

Types
1. How are primitive types (bool, char, int, float) represented?
2. Boolean Logic: Does the int 0, or empty string, empty object (list, hash) also represent a false value?
3. How is null treated? Is it the address 0 (C), is it an object (nil is an object in Ruby), does it represent the value false?
4. Statically typed or dynamically typed:  When are the types determined (compiled vs runtime or both)? If types are deferred until compile time can they be inferred (Scala, C++11 auto, etc.,)

Compound Types
1. How are abstract types [sometimes called compound types] (classes, structs, pointers, references) if any represented?
2. How are containers of variables declared, defined and destroyed? (Arrays, Vectors, LinkedLists, Hashes/Dicts etc.,)
What are the containers available to you? (You can always create your own implementation too if the language allows)
3. How are items added, updated, accessed and removed from compound types?

Object Oriented or Functional
1. Is it Object Oriented: Abstract Data types (as opposed to primitive types: char, int, bool) represented as Classes, Interfaces, Polymorphism.
2. Are all types objects (in Ruby/Java all variables are objects inheriting from a parent Object class)
3. How is equality handled? When multiple objects have same value but different references does it mean equality?
3. Is it a Functional Language such that: functions are treated as  first class variables (Higher Order functions), all variables are immutable…
4. Does it contain features of both Object Oriented and Functional Programming languages (Scala)

Operators
logical (AND/OR etc.,)/arithmetic operators ( +-/% etc.,)

Input & Output
1. [IN] How to accept input: from a keyboard, from a file.
2. [OUT] How to display input: screen, write to a file.

Program Flow (Control)
1. How to run looped/conditional instructions: For, While, DoWhile, Switch
2. How to exit a loop condition early
3. How to try code that can possible cause exceptions

Scope & Repeatability
1. Is there a way to create repeatable code (Functions)
2. How does scope work within functions and other data structures?
3.  For functions what are the allowed return types, allowed parameters ( reference vs copy or both) for functions?
for ex: Can you return a compound type (a list of items)? Can you pass in a function as a parameter?
4. What is the scope of Static variables, Global variables?

Syntax:
What is the syntax and rules for  white space, comments, etc., Is the spacing strict like Python or can it be flexible like C or PHP?
Is there a main starting point (function) for ex: //C++
int main(){...} or //Java
public static void main(String[] args)

Standard Library and Large files:
Is there a standard library that comes with the language? (Usually there has to be if the language is useful)
How are other files, code (possibly from multiple people) and libraries included? Is there a package manager (ruby gems, pip, etc.,)

Runtime Environment
Is the language interpreted? Does it run on an interpreter (Ruby, Python, PHP), or compiled and ran on a virtual machine (C#, Java), or is it compiled to machine code (Swift, C++)?

Leave a Reply