In 1995, the advent of the Java language with its disruptive features quickly gained the attention of developers. Cross-platform, garbage-collected, object-oriented, which was an incredible thing at the time, and Java was perfect for this feature in a language. It can be said that Java brings the programming language design to a new height. 20 years later, the new features of the year are no longer fresh words. At the same time, there will be some new languages claiming to have some subversive features, in which the go language is a representative of the new language, it is simple to deploy, the concurrency is good, the language design is really better than Java. To understand the current development and trends of Java and go languages, Infoq interviewed the go language Daniel it.
InfoQ: This year's May 23 is Java's 20th birthday, in a blink of an eye, Java has gone through 20 years, the version number has been updated to Java 8. What do you think of the language of Java? What are some of the more impressive Java events that have impressed you in the past 20 years?
it: I think the Java language all the way to earn enough eyeballs also provoked a lot of criticism. Take it with the decline of sun company was transferred to Oracle Company. I remember a large number of Java programmers on the internet who threatened to abandon the Java language, and some of them really did. But it turns out that Oracle has developed Java better. I think starting with Java 7 This language is equivalent to usher in the second spring, in the development of a lot of growth, a variety of fresh features and libraries emerge. The most impressive thing about Java 8 is the support for lambda expressions. This allows Java to really support functional programming. This is a qualitative change. Will eventually make the Java language go further.
InfoQ: From the perspective of version iterations, what stages do you think the development of Java has gone through?
it: I started to touch it from the end of Java 1.3. So it seems to me that before Java 1.3 was a budding period (though it was already widely used). Starting with 1.4, the Java language has changed a lot, such as NIO, more garbage collector, improved performance, gradual simplification of Java EE specifications, and so on. So I think Java has entered the first high-speed development period since then (maybe there was a previous one but I missed it). By the time Java 6, the pace of development has slowed down a lot. This may also be due to the fact that Java is in the transition phase. However, I have to say that Oracle's adjustment moves quickly, and in the case of little suspended, the development of Java began to "run". This is also the "second spring" I said in the previous answer.
How do you look at these JVM languages as the popularity of INFOQ:JVM is driving the emergence of relevant peripheral languages?
it: This is where the real cow of Java is. It is not only a language, but also a platform. So far, there has been a lot of JVM language, but the best development is Scala. It solves some Java problems in the development of the program. But I think it has a biased direction. I think "simplification" tends to be more direct and effective than "rich". By contrast, Clojure language is doing well. But because it is a Lisp dialect, coding and thinking are far from Java's object-oriented thinking, so it is only accepted by a small number of Java programmers. In short, the JVM language makes Java more popular. They are imperfect, but they are not.
InfoQ: A lot of people are singing about Java, can you talk about Java's prospects in the context of Java's current development and trends?
it: any popular technology will be someone to sing, not to mention that Java has been developed for 20 of years, the middle has experienced a variety of frustrations. I think Java 9 is going to be a milestone version. I'm looking forward to it. I think that in my foreseeable future, Java will not decline. In fact, the dominance of the Java language in the field of enterprise software is unshakable. In the area of Internet software, it has been eroded by a variety of lower-cost languages such as Ruby and Python, but still has a place. This illustrates the tenacity of Java vitality. However, compared to the Java language, I am more optimistic about the future of Java as a platform.
InfoQ: When did you start to get in touch with the go language? What are the advantages compared to the Java language?
it: I'm not really early in touch with the go language, about the first half of 2013. At that time the Go language version was 1.0 and the 1.1 version was in development. My first impression of the go language is that it supports a variety of programming paradigms, provides power-giving program building and publishing tools, and extreme simplification in concurrent programming. At the time, I thought that the lack of Java language was exactly what these aspects are. So I started learning and using the go language without any return. It turns out that the go language is a new language, but it is an innovation. In addition, as with the Java language, the go language is well backwards compatible. And, to be just in case, it provides a command to automatically adjust the old version of the Go Language program source code to the current version . There are many more "convenience Dafa" and the like. Many of the things that can be done in the Java world by relying on additional class libraries or tools are extremely easy in the go language. Of course, this real advantage also has the birth time different reason. It is because Java has gone through so much that it is hard to change in many ways. I think this is a problem that all programming languages should be confronted with. Obviously, the creators of the Go language are aware of this.
InfoQ: Great concurrency performance is a feature of the go language that distinguishes it from other languages. What are the significant advantages of concurrency programming compared to Java?
it: Speaking of concurrency, the first impression that go language gives people is convenience. In this convenient, go language weigh the pros and cons of the various aspects, do a lot of work, so that we can use very low development costs to write out with ultra-high performance of the Go Language concurrency program. One of the biggest highlights is that the go language has built-in the action of "activating" code blocks that require concurrent execution. We can do this easily with just one keyword "go".
Remember how verbose the code we need to write for this in Java? Intrusive interfaces implement declarations and class inheritance declarations, complex anonymous inner classes, and difficult inter-thread coordination and scheduling. These are not negligible program development and maintenance costs. We have to write and modify such concurrent programs to keep the mind and the absolute clarity of thought, otherwise we will bury the curse, make difficult to detect and locate the bug. On the other hand, if we look at the nature through appearances, we can see that the go language does a lot of work for the convenience of programmers.
In general, the Go language incorporates the use and dispatch of kernel threads into its runtime system. However, it is far more complex than a thread pool. The relationship between the Java thread and the kernel thread is 1:1. The goroutine of the Go language (which can be seen as the entity that executes concurrent blocks of code in the Go language) is m:n to the kernel thread. This allows us to use thousands of goroutine to execute concurrent blocks of code and consume very little kernel threads. A more detailed introduction to go concurrency programming, you can see my "Turing original" book "Go Concurrent Programming Combat".
Is the use of Infoq:java and go language different?
it: There are many similarities between the Java language and the go language in terms of usage scenarios. For example, they all apply to the building of a server-side program, and it is easy to write page template files. For example, they are very stretched in terms of desktop software. Interestingly, in itself, the go language has a stronger advantage in the field of application, and the disadvantage in the field of non-applicability is even more pronounced. I will not repeat the advantages, the following talk about the disadvantages. For example, writing desktop programs in Java is at least a swing and javafx option, but the go language official has yet to have a proven solution. Of course, this is still related to the birth time. In addition, we can also write Android applications in the Java language. The go language is not yet perfect, though it is already involved. But here I am, I'm looking forward to writing iOS apps in the Go language. In fact, the go language has made some progress in this regard. In short, the two languages overlap but are somewhat different in the field of application. In many cases, we can mix the two languages.
InfoQ: What do you think is the future of language development, especially in the languages of Java, Go, PHP, Rust, Python, and more?
it: Indeed, there are countless programming languages. However, the rise and fall of programming languages can be traced regularly. The first rule is to adapt to the language of the Times to have a better development. Just as objective-c was so hot because of the birth of the iphone and ipad. And Java also because of Google's "cross-docking" and in the mobile program Development area occupied the commanding heights. Today's computer world is in the "cloud" era, and from the processor point of view is also in the multi-core era. Who can better grasp these times label, who will be more advantageous in development. Of course, there is a need for real kung fu to say "hold". Just shouting and not practicing has no effect, and it will be rejected by others. The second rule is that the language that solves the problem is good language. This is true for any scenario. I believe that every technical team will weigh in choosing a programming language. Which programming language can solve problems faster and better (this also involves development and maintenance costs), it will definitely win. From this point of view, the programming language is not good or bad points. They all have unique advantages and good things to do, otherwise they will not be born at all. and the ability to solve problems is almost the only criterion of development trend. "M.F.B. S" is the key to choosing a programming language. This also indicates the development trend of a programming language from the side. Having said so much, the other thing I want to say is: For their future, I can't predict:).
Invited guests to introduce
It, software engineer, engaged in software development work for more than 9 years. Both enterprise-level software projects and Internet software systems have been piled up. Recently in the use and promotion of the go language, "Turing original" book "Go Concurrent Programming Combat", as well as online free tutorial "Go language first lesson" and "Go Command Tutorial".
Java 20: Corner Encounter Go