The next two years, you may need it in five languages (reprint)

For us in the programming world, we have now reached a turning point. Ten years ago, programmers rush for dynamic languages. Most of our people, dynamic programming language not only easier, but also means a kind of fashion. Today, the dynamic language is no longer enjoy special favor, now with a new language programmers use the old language and to develop the project. I have to ask, in order to maintain their competitiveness, which programming language is most in need of permanent programmers to master?

       Before we discuss what the future will be popular programming language in question, take a look at the similarities and differences between different programming language.

Static vs. dynamic language language

       when we talk about dynamic language, this "dynamic" actually says is variable types. When using dynamic programming language, you can declare a variable, and can change the type of the variable in the program is running. And dynamic languages are relatively static language, or call strongly typed language. Such as C ++ and Java is a strongly typed language, JavaScript, PHP and Perl is dynamically typed languages.

       In C ++, declare a variable time must specify the type of variables at the same time. In the process of running, if you attempt to change the type of the variable, the compiler will report an error. The same is true in Java.

       However, JavaScript is not the same, you can change the type of a variable in a JavaScript program running. In fact, you do not need to specify the type of the variable when declaring variables, when using a variable, you can put an integer assigned to the variable, and then cover this with a string of integers, which dynamically typed languages They are allowed.

       Although popular in dynamic languages just recently, in fact this concept 50 years ago has been brought up.

Functional languages

       with the development of dynamic languages, interest in functional languages is also growing. In a functional language, the function itself may be stored in a variable, the function is stored in a variable and can be passed as a parameter to another function. Now most programming languages support function to some extent. For example, C ++, C ++ allows programmers to pass a pointer to the function. JavaScript and some language to make it easier to transfer function. It is generally believed that C ++ is not a functional language in the true sense, but think JavaScript is a functional language, Haskell is generally regarded as an excellent example of functional languages.

** garbage mechanism

       in theory, as long as you write the code correctly, you will not have any bugs. That sounds good. In fact, when you and many other programmers collaborate to complete a large project, there is a bug will often appear, which is a memory leak. You define a variable, but there is no time ** This memory after completing this variable, then we say that a memory leak. If the memory leak occurs and no time found that with the increase in running time, the program is growing, until they consume all system memory, and system crashes. sounds terrible!

       You might say, in a timely manner after each release memory variables, memory leaks do not would not have happened? The idea is good, the reality may be more complicated than that. For example, you apply for a linked list to store the data, this list is passed to another function that is written by someone else, someone else in the preparation of this function, a copy of this list will be, but you do not know, you say that this list should be deleted or remain? Based on this situation, the way programmers think of a workaround: ** the memory system of work to do. When you no longer use a variable, found by scanning system memory this memory is no longer used, and then take the initiative **, ** which is called garbage mechanism. Developed new language, this is a very important feature. ** garbage idea behind this is to make programming easier, allowing programmers to focus on creating great software.

       It should be noted that several different mechanisms do exist junk **: one is the system periodically scans memory, found that memory no longer in use; the other is a variable for each system keeps a tab, once the variable is no longer found use immediately deleted. Technically, the latter is not a garbage ** mechanism, but "reference count", but to achieve the effect is the same.

virtual machine

       When Java in the mid-1990s turned out, the people it is not directly compile the code into assembly language is very concerned about this. And C ++ contrary, Java compiler at compile-time program into a first intermediate code called a byte code. At runtime, the system calls the virtual machine executes bytecode, sometimes even just the byte-code compiled into assembly code. This compilation mode just came out, programmers complained about its slow, of course, now is not a problem. Many languages using a virtual machine running the way, such as the previously mentioned Java, C # and so on. Now this type of language has been considerable development in terms of speed.

Language

       Having said that, the programmer in the end should learn what language? Here are five of demand there is a language rich in future work. In addition, I also cited the sixth language, as an "honorable mention".

       JavaScript,HTML5CSS3:从技术上来说,HTML5并不是一种语言,而是一项技术,这项技术和CSS3、JavaScript一起使你能够构建基于Web的应用。 你可以创建运行在浏览器中的软件,这样做的好处是,你构建的应用将会拥有前所未有的移植性——几乎可以在所有的设备上运行,包括手机。几年 前,Facebook开始使用HTML5来构建他们的手机应用,他们超前了这个时代,那时HTML5还不成熟。一段时间后,他们回归了传统模式。过去两年 中,浏览器纷纷开始实现最好的HTML5技术,对JavaScript的需求随之增加。如果想保持你的竞争力,这是一项你必须学习的技术。(在服务器端, 很多大公司以Node.js的方式使用JavaScript)。

JavaScript示例:

       下面这个例子展示了JavaScript是怎么将一个函数存储到变量中,然后又传递给另外一个函数的。JavaScript方面的资源非常多,权威指南,参考Mozilla Developer Network,新手教程,参考以下网站。

 

var myfunc = function() {
      alert(‘hi’);
};

setTimeout(myfunc, 2000);

 

 

 


C#:在15年前,Microsoft创造了C#,从那时起,C#不断发展壮大。C#的语法类似于Java(同时也类似于C++)。C#编程软件首选Visual Studio,免费版和付费版都有。

       C#是一种强类型的语言,带有一个虚拟机。最初的发行版对函数式编程的支持非常少,在2006前后,Microsoft为这门语言加入了一些函数式编程的特征。和Java一样,C#也有自己的垃圾**机制。

C# 示例:

       示例定义了一个叫做Program的类,Program包含一个叫做Main的函数。程序从Main函数开始运行。Main函数定义了一个强类型的整形 变量x,并且在屏幕上打印x的值。学习C#方面的更多知识,移步Microsoft’s official site。

using System;

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

 

 

 


Java:Java即将迎来自己的20岁生日,时至今日,Java还在不断的发展、成熟。在2004年,我的一位同事说这是一门“**语 言”。经历了早期的成长之痛后,Java早已不是一门**语言:它支撑起了不可胜数的网站和数据库,开源office套件也是用Java开发的。现在来 看,Java的前景依旧一片光明。

       Java是一种强类型的语言,运行在自带垃圾**机制的虚拟机中。尽管不是一种函数式语言,还是带有一些函数式编程的特征。

Java示例:

       Java和C#在很多方面类似。在Java程序中,从main函数开始运行。像上面提到的C#示例一样,在main函数中定义了一个整形的强类型变量x,并且在屏幕上打印x的值。学习更多Java知识,参考official documentation。

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

}

 

 

 

PHP:PHP 是一种易用的通用编程语言。其语法和Java、C++类似。在一个非常简单的层次上来说,PHP用于在网页中嵌入可变化的文本内容。比如说,在你的网页中 可能存在打印当前日期的PHP代码,当你把网页代码送到浏览器,相应的PHP代码就会在屏幕上打印出当前日期。PHP能做的远比在网页上打印日期多。 PHP的类库能够操作数据库(几乎你能想到的任何数据库都能处理),能进行科学计算,能处理文本。PHP的未来依旧一片光明。

PHP示例:

       PHP代码嵌入在HTML文档之中。这段PHP代码将时区设置为Los Angeles,然后打印出当前时间。浏览器解析HTML文档的时候,PHP代码部分被代码的输出结果所取代。所以最终显示在屏幕上的是“Hello! The current time is”,后面是当前时间。学习更多PHP相关知识,参考这个网站。

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

<?php
      date_default_timezone_set(‘America/Los_Angeles’);
      echo (strftime(‘%c’));
?>
</body>
</html>

 

Swif:这 是一门全新的语言,苹果制造。一般来说我不会推荐人们学习一门全新的语言。但是要知道我们说的是苹果,并且现在你已经能使用这门全新的语言来创建iOS应 用了。事实上,已经有迹象显示Swift将会成为iOS平台编程的未来。Swift的语法非常像JavaScript,但是没有分号和括号。



       Swift是一种强类型的语言,运行在带垃圾**机制的虚拟机中。

Swift示例:

       示例中定义了一个叫做str的变量,存储一个字符串。尽管没有明确指出str的类型,但是Swift是强类型的,编译器通过赋值语句右边的字符串判断出str是字符串类型。学习Swift的更多知识,参考苹果官网的相关页面。

var str = “Hello, World!”
println (str)

 

 

 

鼓励奖项:

       Erlang是爱立信的工程师在1986年发明的编程语言。这本来是通信领域专用的编程语言,现在已经发展成一门通用的编程语言,并且在基于云的、高性 能的并行计算中大行其道。现在人们使用Erlang编写出了一些强大的软件,比如说CouchDB和Riak。这是一门与众不同的语言,其处理字符串的方 式非常奇怪,但是也很容易学习。

       我们应该学习Erlang吗?虽然需要Erlang的工作不多。但是,如果你真正掌握了这门语言,那你很可能得到一份极好的工作。这是一个抉择。在真正掌握这门语言之前,你需要投入大量的精力,一旦你学成,回报也很高。

Erlang 示例:

       下面的示例来自这篇博客,这是“hello world”示例的复杂版本。记住,Erlang是一门成熟的语言,如果你真的打算学习这门语言,参考前面提到的博客和这个网站。

-module(hello).
-export([start/0]).
start() ->
      spawn(fun() -> loop() end).
loop() ->
      receive
        hello ->
        io:format(“Hello, World!~n”),
       loop();
   goodbye ->
   ok

 

 写在最后

       程序员肯定是在哪都能找到工作,但不一定是你特别喜欢的职位,关键还在于学习真正能用得着的技术,找到那份属于你的好工作。学习JavaScript、 C#、Java、PHP、C++不会有错。如果你开始学习Swift,未来的就业形式一片大好。如果你想尝试一把高性能编程,看看Erlang,尽管需要 Erlang的工作可能不会马上出现。不管你现在在致力于哪一门语言,都要脚踏实地的学到精,这是关键。

 

转载于:https://www.cnblogs.com/Alenliu/p/3894517.html

Guess you like

Origin blog.csdn.net/weixin_34356138/article/details/93470031