How to learn A new programming language ??
Table of contents
No headings in the article.
So, you have learnt your first programing language / started learning a new language and go through someone's profile who have experience in multiple languages . You wondered how they did it , again and again going through the turmoil to learn a new language to build services . Well , the thing is that it is quite easy to learn a new language if you have a knowledge in basic programming concepts , after that most of them are just the game of syntax . So, let us have a tour on the concepts here.
- Is it a scripting language ?
So, when you're choosing a second language , it is needed to understand if it's a scripting language or not . Coming from a scripting language to a non scripting language , it might be a overhead for you to understand all the syntax and concept a once . The python vs java debate is a great example here. In python which is a scripting language we can write
print("Hello world")
and it will print hello world . But in java, a non scripting language we have to write
class HelloWorld{
public static void main(String[] args){
System.out.println("Hello world");
}
}
The sole reason for the complexity in java is that as a non script and compiled language it can not compile the System.out.println("Hello world"); alone whereas though python support classes, functions and access modifiers , as a scripting language and interpreted language it doesn't surely needed any of it to run a single independent line.
2.Variables
Variables are an important part of any programming language, understanding them helps a lot . So, first you have to know how variables are declared in he language . There is three type of languages according to the variable type declarations
- Statically typed : Here we declare the variable type in the code . java , c# , c++ is examples of this type of langauges . example
int a= 67; String m = "I am string";
- Dynamically typed : Here the language infer the type of the variable from there use . python , php ,lua is examples of this type of languages . example
$a= 67; // php will take a as integer $m = "I am string" ;
The middle man : Here we have the option to choose i we want to declare types or infer from usage . golang is an example of this type of language . example
a:= 67 // go will infer a as integer and variable var m string = "I am string" // we wrote m as a variable and type string in go
many languages (javascript , golang etc) needs you to specify if this is a constant or not while declaring the variables .
Conditional statements Conditional statements are pretty easy , most of them are always like
if(condition) Do Something else if (another condition) // some lang use elif here Do Something Else Do Something
Some languages like C++/Javascript also let you do the checking with ? and : operators
a = (condition) ? satisfied_value : not_satisfied_value;
Blocks We generally declare blocks in 3 ways . Many times this 3 overlap with each other
Braces based - This generally mostly used , here we use { } braces to declare which is inside a function/loop/if else. Languages like C++ ,Java , Javascript use it.
if(a>5){ //Statements to run if the condition is true } //Statements don't depend on previous if
Indentation based - Here we use Indentations(tab or four spaces) to declare which is inside a function/loop/if else. python uses it. ``` if(a>5): //Statements to run if the condition is true (4 spaced)
//Statements don't depend on previous if
- Terminating word based - We use another keyword to terminate the function/loop/if else. Languages like Bash use it.
if(a>5) then //Statements to run if the condition is true fi //Statements don't depend on previous if ``` 5.Loops Loops are one of the most useful tool in programming . So, it is best to understand how many types of loops, the language can offer and ow we can use them . loops , loops through the block statement until the condition is satisfied. If you want to learn more please go here
- Model of the programming language Next thing you have to take note of , is it a OOPS , functional or Procedural language. Now , jumping from functional to OOPs or vice versa will be a lot more to add to your to do learning list . Learning about the implementation methods in various models (currying for functional or abstraction for oops etc.) will give a upper hand and better understanding of the language.
7.Built-in Data Structures : Built in , popular data structures of that language can save you many more hustle of implementing a complex project on the language. So, if you have time always go through the DS , the language has to offer.
8.Package Management. Let's be real , you are not going to build all the tool you need , you are going to work with libraries or frameworks. So, it is required to understand the package management tools , ecosystem and importing or exporting the packages in the language.
The much more experience have the less time , you might spend with this 8 concepts of any languages , and the less time you spend here , the more It will be clear , that languages are just a tool to build the apps. The most important things are the business logics , and the person building and implementing the logics to the software . So, please be kind to yourself , everything takes their own time .
Thank You.