You may need to publish in these five languages!

For us in the programming world, we have reached a turning point. Ten years ago, programmers flocked to dynamic languages. For most of us, dynamic languages not only make programming easier, but also mean fashion.

Today, dynamic languages no longer enjoy special favor, and programmers today use a mix of new and old languages to develop projects. I can’t help but ask, which programming languages do programmers need to master permanently in order to maintain their competitiveness?
Before we discuss which programming languages will be popular in the future, let’s take a look at the similarities and differences between different programming languages.

Static languages vs. dynamic languages

When we speak of dynamic languages, the “dynamic” actually refers to variable types. When writing a program in a dynamic language, a variable can be declared, and the type of the variable can be changed while the program is running. The opposite of dynamic languages are static languages, or strongly typed languages. For example, C++ and Java are strongly typed languages, while JavaScript, PHP and Perl are dynamically typed languages.

In C++, when declaring a variable, the type of the variable must be specified at the same time. During the running of the program, if you try to change the type of this variable, the compiler will report an error. This is the same in Java.

But JavaScript is different. You can change the type of a variable while the JavaScript program is running. In fact, there is no need to specify the type of the variable when declaring the variable. When using the variable, you can first assign an integer to the variable, and then use a string to cover the integer. This is true in dynamically typed languages. are allowed.

Although dynamic languages have become popular only recently, the concept was actually introduced 50 years ago.

Garbage Collection

Along with the development of dynamic languages, there has been a growing interest in functional languages. In functional languages, functions themselves can be stored in variables, and functions stored in variables can be passed as parameters to other functions. Most languages today support functional programming to some extent. For example, C++, C++ allows programmers to pass pointers to functions. Some languages, such as JavaScript, make passing functions around much easier. Therefore, C++ is generally considered not a functional language in the true sense, while JavaScript is considered to be a functional language, and Haskell is generally considered to be an excellent example of a functional language.

Garbage Collection

In theory, as long as you write your code correctly, you should not have any bugs. This sounds wonderful. But in fact, when you cooperate with many other programmers to complete a large project, there is a bug that often appears, which is memory leaks. You define a variable, but you fail to reclaim this part of memory in time after using this variable. At this time, we say that a memory leak has occurred. If a memory leak occurs and is not discovered in time, as the program running time increases, the program will become larger and larger until all the memory of the system is consumed, and then the system crashes. sounds terrible!

You might say that if the memory is released in time after each variable is used, the memory leak will not happen? The idea is good, but the reality may be more complicated than this. For example, you apply for a linked list to store data, and this linked list is passed to another function written by someone else. In this function written by someone else, the linked list is copied, but you don’t know it. Do you say should delete this linked list or keep it? Based on this situation, programmers thought of a workaround: hand over the work of memory recovery to the system. When you no longer use a certain variable, the system scans the memory to find the unused memory, and then actively recycles it. This is called the garbage collection mechanism. This is a very important feature for a newly developed language. The idea behind garbage collection is to make programming easier so programmers can focus on creating great software.

It should be noted that there are indeed several different garbage collection mechanisms: one is that the system periodically scans the memory to find memory that is no longer used; the other is that the system reserves a tab for each variable, and once the variable is found to be no longer used , delete it immediately. Technically speaking, the latter is not a garbage collection mechanism, but “reference counting”, but the effect achieved is the same.

Virtual Machine

When Java came out in the mid-1990s, people paid a lot of attention to the fact that it didn’t compile code directly to assembly language. Contrary to C++, Java first compiles the program into an intermediate code called bytecode when compiling. At runtime, the system calls the virtual machine to execute the bytecode, and sometimes even just compiles the bytecode into assembly code. When this compilation method first came out, programmers complained about its slow speed, but of course it is no longer a problem. Many languages use virtual machines to run, such as the aforementioned Java, C#, etc. Languages of this type have now come a long way in terms of speed.

Programming language

Having said so much, which languages should programmers learn? Below are five languages that will be in high demand in the future of work. In addition to this, I also listed a sixth language as an “honorable mention”.

JavaScript, HTML5, and CSS3: Technically, HTML5 is not a language, but a technology that, along with CSS3 and JavaScript, enables you to build web-based applications. You can create software that runs in the browser, and the advantage of doing this is that the applications you build will be more portable than ever before – they will run on almost any device, including mobile phones. A few years ago, Facebook started using HTML5 to build their mobile apps, they were ahead of their time, when HTML5 was not yet mature. After a while, they reverted to traditional patterns. As browsers have started implementing the best HTML5 technologies over the past two years, the need for JavaScript has increased. This is a skill you must learn if you want to stay competitive. (On the server side, many large companies use JavaScript the way Node.js does).

JavaScript example:

The following example shows how JavaScript stores a function in a variable and then passes it to another function. There are a lot of JavaScript resources, authoritative guide, refer to Mozilla Developer Network, novice tutorial, refer to the following websites.

var myfunc = function() {
 alert('hi');
};
setTimeout(myfunc, 2000);

C#: Microsoft created C# 15 years ago, and since then, C# has grown and grown. The syntax of C# is similar to Java (and also similar to C++). Visual Studio is the first choice for C# programming software, both free and paid versions are available.

C# is a strongly typed language with a virtual machine. The initial release had very little support for functional programming. Around 2006, Microsoft added some functional programming features to the language. Like Java, C# also has its own garbage collection mechanism.

C# example:

The example defines a class called Program, which contains a function called Main. The program starts running from the Main function. The Main function defines a strongly typed integer variable x, and prints the value of x on the screen. To learn more about C#, go to Microsoft’s official site.

using System;
class Program {
static void Main() {
int x = 1000;
Console. WriteLine(x);
}
}

Java: Java is about to celebrate its 20th birthday. Today, Java is still developing and maturing. In 2004, a colleague of mine called it a “toy language”. After the early growing pains, Java is no longer a toy language: it supports countless websites and databases, and the open source office suite is also developed in Java. Looking at it now, the future of Java is still bright.

Java is a strongly typed language that runs on a virtual machine with its own garbage collection mechanism. Although not a functional language, it has some features of functional programming.

Java example:

Java and C# are similar in many ways. In a Java program, it starts running from the main function. Like the C# example mentioned above, an integer variable x is defined in the main function, and the value of x is printed on the screen. To learn more Java knowledge, refer to the official documentation.

public class HelloWorld {
public static void main(String[] args) {
int x = 1000;
System.out.println(x);

}

}

PHP: PHP is an easy-to-use general-purpose programming language. Its syntax is similar to Java and C++. On a very simple level, PHP is used to embed variable text content in web pages. For example, there may be PHP code that prints the current date in your web page. When you send the web page code to the browser, the corresponding PHP code will print the current date on the screen. PHP can do a lot more than just print a date on a web page. PHP’s class libraries can manipulate databases (almost any database you can think of), perform scientific calculations, and process text. The future of PHP is still bright.

PHP example:

PHP code is embedded in HTML documents. This PHP code sets the timezone to Los Angeles, then prints out the current time. When the browser parses the HTML document, the PHP code part is replaced by the output of the code. So what is finally displayed on the screen is “Hello! The current time is”, followed by the current time. To learn more about PHP, refer to this website.

<html>
<body>
Hello! The current time is
<?php

date_default_timezone_set('America/Los_Angeles');
echo (strftime('%c'));

?>
</body>
</html>

Swift: This is a brand new language, made by Apple. In general I wouldn’t recommend that people learn a whole new language. But know we’re talking about Apple, and you can already use this brand new language to create iOS apps. In fact, there are already signs that Swift will be the future of programming for the iOS platform. Swift’s syntax is very much like JavaScript, but without the semicolons and parentheses.

Swift is a strongly typed language that runs on a virtual machine with garbage collection.

Swift example:

In the example, a variable called str is defined to store a string. Although the type of str is not clearly indicated, Swift is strongly typed, and the compiler judges that str is a string type through the string on the right side of the assignment statement. To learn more about Swift, refer to the relevant pages on Apple’s official website.

var str = "Hello, World!"
println (str)

another language

Erlang is a programming language invented by engineers at Ericsson in 1986. This was originally a programming language dedicated to the communication field, but now it has developed into a general-purpose programming language and is popular in cloud-based, high-performance parallel computing. Now people use Erlang to write some powerful software, such as CouchDB and Riak. It’s a different language with a weird way of handling strings, but it’s also easy to learn.

Should we learn Erlang? Not much work that requires Erlang though. However, if you do master the language, you are likely to get a fantastic job. It’s a choice. It takes a lot of effort before you can really master the language, and once you do, the payoff is high.

Erlang example:

The example below is from this blog post and is a more complex version of the “hello world” example. Remember, Erlang is a mature language, if you really intend to learn this language, refer to the aforementioned blog and this website.

-module(hello).
-export([start/0]).
start() ->

spawn(fun() -> loop() end).

loop() ->

receive

hello ->
io:format("Hello, World!~n"),
loop();

goodbye ->
ok

Write at the end

Programmers can definitely find a job anywhere, but it doesn’t necessarily have to be a job you particularly like. The key is to learn the technology you can really use and find that good job that belongs to you. You can’t go wrong learning JavaScript, C#, Java, PHP (even C++). If you start learning Swift, the future of employment looks very good. If you want to try your hand at high-performance programming, take a look at Erlang, although jobs requiring Erlang may not come up right away. No matter which language you are working on now, it is the key to learn the essence down-to-earth.