Home > News content

At Java, has been able to eat?

via:博客园     time:2017/6/21 19:31:56     readed:1642


Editor's note: This article comes from the WeChat public

22 years old, for a technical person, is the prime of life. But for a programming language, the situation may be different. All kinds of programming languages were born, and they fought endlessly. However, on the list of TIOBE language, Java showed obvious decline. What will the old language be like in the future?

Written in the front

Since its first release in 1995, Java has gone through 22 years of ups and downs, and the latest version of Java has been iterated to Java 9. In those days, Java language cross platform advantages, now seems to be just home dishes, Go, Rust and other languages turned out, further widened the boundaries of programming language. The invention of the Java language Sun company was acquired by Oracle, Oracle is now in dire straits of the wave of cloud computing, even the father of the Java James Gosling also joined the world's largest cloud computing company AWS.

Java language development in the 20 years is the rapid development of the global Internet 20 years, Java also witnessed the wave, the wave of mobile Internet business, big data, cloud computing wave wave, so Java can see the figure in today's major Internet Co on the body.

Looking at the development of Java language, I can't help thinking of Xin Qiji's word:

Through the ages, the hero has no way to find Sun Zhongmou. Bygones are severe tests to entertainment setups. Setting sun, ordinary alleys, humanity has been sent to live slaves. Think of those years, the sun, gas, swallow miles, such as tiger. Hastily Yuan Jia, Xu Feng UN wolf, fled north to win. Forty-three years, hope in mind, beacon Road, Yangzhou road. May look back, under the temple of a tiger, a piece of God, ya, society, drum. Who asked, old say, has been able to eat?

TIOBE language list, since the beginning of 2016 Java language is obviously under the decadent trend, the developer community has some bad mouthing argument Java language editor, some questions: the Java heart is old, still can "meal"? Based on this background, InfoQ invited Java senior expert Zhang Jianfeng to explain the development and future of Java language for you.

A review of the development of Java language

The Java language originated from the Ork project led by Sun James Gosling in 1991. In 1995, Sun was officially named Java and proposed

The Java 1 was released in January 1996, provides a Java virtual machine interpreter, it coincides with the Internet began to rise, Java Applet can run in the Mozilla browser, is seen as the future of the Internet language.

In February 1997, Java 1.1 published the basic definition of the Java language, such as reflection, JavaBean, interfaces and class relationships, and so on. However, some of Java's initial goals, such as executing Applet in browsers and cross platform graphical interfaces, were quickly negatively evaluated by Awt.

In December 1998, Java's first landmark version, Java 1.2, was released. This version uses the JIT (Just in time) compiler technology, makes the language can be transferred and the execution efficiency of the optimal balance at the same time, the Collections collection class excellent design, the enterprise application development quickly and widely used. Sun has divided the Java technology system into three directions, namely, J2SE (for desktop and general application development), J2EE (enterprise oriented application development), and J2ME (for mobile terminal development). This category has a very long history, reflecting the mainstream language designer's thinking: to differentiate between different domains of application, form, API collection, and so on.

In May 2000, Java 1.3 released Corba as a language level distributed object technology in this release, becoming a technical prerequisite for J2EE. J2EE was greatly influenced by the design of Corba, and the Home, interface and implementation of the early EJB were implemented in the C language and transplanted into the Java language of Corba. The Servlet specification in J2EE has been a great success, with the rise of the Internet, and the browser directly through the HTTP protocol interactive Servlet, and a large number of MVC framework, become Web1.0 net red.

In February 2002, Java 1.4 published, Java language really mature, providing a very complete language features, such as NIO, regular expressions, XML processor, etc.. In the same year, Microsoft's.NET framework was launched, and both began a decade of hard competition. In terms of language characteristics,.NET has always been in the first place. But Java relies on a good developer ecosystem, the vast majority of large software companies and many users continue to contribute, as well as good support for the Linux operating system, and gradually gain a dominant position on the server side.

In September 2004, Java 5 released, Sun no longer use J2SE, J2EE this way of naming, and use Java SE 5, Java EE 5 such name. I think Java 5 is the second milestone version. Java language syntax has undergone major changes, such as annotations (Annotation), packing (Autoboxing), generic (Generic), enumeration (Enum), foreach, etc., are added to provide java.util.concurrent and contract. Java 5 is a huge boost to the Java language, especially with the addition of annotations that makes language definitions much more flexible, and programmers can write more descriptive programs that conform to domain definitions.

In May 2006, JavaEE 5 was released, most notably the version of EJB3.0, which was widely questioned before, and SpringFramework founder Rod Johnson in classic books. EJB2.X

In December 2006, the release of Java 6, the improvement of language syntax is not much, but made a lot of improvements in the virtual machine, a mature and stable version, today many domestic companies are still using Java6 as the main Java development version to use. In the same year, Sun made a great decision to open Java. OpenJDK branched out from Sun JDK 1.7, becoming the foundation of today's OpenJDK. OpenJDK6 is cropped by OpenJDK7 and is currently maintained by red hat to meet the needs of Redhat, Enterprise, Linux, 6.X users.

Released in December 2009, JavaEE 6, which should be the largest and most far-reaching version of JavaEE so far. Because JavaEE5 only EJB3 adapted to the addition of Java annotation syntax, and EE6 fully accepted annotations. With the addition of the CDI and BeanValidation specifications, complete semantics can be defined over POJO, and containers are used to decide how to do it. Servlet also upgraded to version 3 and added asynchronous support to the interface, making the overall efficiency of the system substantially improved. EE is divided into Full, Profile, and Web Profile, and users can choose different sets of functions according to their own needs.

Prior to this, Oracle has bought Sun for $7 billion 400 million, winning Java trademarks and Java dominance. Also acquired BEA company, access to the largest market share of the application server Webogic. Although JavaEE 6 is the release after the acquisition, but the main design work is still completed by the original Sun company Java experts.

In July 2011, Oracle released Java 7, one of the main characteristics of NIO2 and Fork/Join and the language, although no big enhancement, but I personally think that since Oracle JDK (including OpenJDK7), the stability of industrial grade Java virtual machine truly, become a computing platform and service in the world.

In June 2013, Oracle released JavaEE 7, which joined the Websocket, Batch support, and introduced Concurrency to control server multithreading. However, all of the sub specifications are optional (Optional), and there are more than 40 items. It's hard for developers to read standard text, let alone master it globally. The essence of the JavaEE specification is the condensed experience of enterprise application design, and each API has been consulted and identified by many experienced experts. Between each version can be backwards compatible, that is to say, even 10 years ago to write a Servlet program, the current developers can also smooth reading source code, part of the code after adjustment and configuration changes, can be deployed in today's. In turn, the next program written in Servlet4, browser and server communication using the new HTTP/2 protocol, but the programmer will not have obstacles in understanding, because the specification of Servlet API is very stable, basically no big change change.

In March 2014, Oracle released Java 8, the third landmark version of Java I thought it would be. One of the most striking is the Lambda expression, which has provided functional programming capabilities native to the Java language. In terms of language, large features are added: Streams, Date/Time, API, new Javascript engines, Nashorn, parallel computing support for collections, and so on. Java8 is more adapted to the needs of mass cloud computing.

According to the original plan, Java9 should be released in July this year, but because the JPMS (module) vote failed to pass reasons, postponed to September this year.

JavaEE 8 will also be released this year, with an estimated time of 8-10 months. The most important updates are Servlet 4 and CDI 2, which have completed the release and voting of the final specification.

Java community briefing

We introduce the Java community in two ways.

Java User Group (JUG, Java user group) currently has more than 100 JUG organizations around the world, distributed across continents and countries, generally named after the region. At present, the most influential two JUG are London's LJC (London Java Community) and Brazil's SouJava, are currently JCP's EC (Executive Committee) members. There are currently GreenTea, JUG (Beijing and Hangzhou), Shanghai, JUG, GuangDong, JUG, Shenzhen, JUG, Nanjing, JUG and so on. GreanTeaJUG to Alibaba R & D department members as the core, including Beijing and Hangzhou two companies engaged in the development of Java R & D personnel, the past few years has successfully held many industry influential activities, especially invited to share knowledge of many foreign Java technical experts, is currently the largest developer of JUG organization.

Java open source community, Java is an open language, and its open source community is also a large number of participants. The most famous should be the Apache community, which now has nearly 200 top projects, the vast majority of which are Java language projects. In the Java ecosphere, there are important positions such as Ant, Commons, Tomcat, Xerces, Maven, Struts, Lucene, ActiveMQ, CXF, Camel, Hadoop, and so on. Many times, a large number of Java projects to join, such as Web Velocity and Wicket JavaEE era; related Tomee, OpenJPA, OpenWebBeans, Myfaces; jUDDI, Axis, WebService times ServiceMix; Osgi Flex, Karaf period; the era of big data of HBase, Hive, ZooKeeper, Cassandra; Mesos, CloudStack and so on in the cloud era.

Involving all aspects of software development, it can be said that today, almost all medium-sized Java applications, there will be Apache open source project figure. China's earliest participation in the Apache community, based on foreign software companies, domestic R & D team members, such as red hat, IONA, Intel, IBM R & D center, etc.. Today, domestic Internet Co and software companies are also involved, especially in leading Apache projects such as Kylin.

The JBoss open source community, contains more than 50 Java open source project, including Hibernate, Drools, jBPM and other well-known open source projects, there are Undertow, Byteman, Narayana etc. fame is not large, but it is the corresponding areas of the industry's top elite project. At present, JBoss open source community is mainly based on enterprise application middleware software, and RedHat is the main technical contribution.

The Eclipse open source community, before the main contains the Eclipse IDE project, then gradually extended to many aspects such as the OSGi server, etc., at present some well-known projects such as Jetty, Java, Vertx are Eclipse open source organization members. In addition, IOT is currently a key direction of Eclispe, where you can find the complete IOT Java development program.

Spring open source community, with SpringFramework as the core, including SpringBoot, SpringCloud, SpringSecurity, SpringXD and other open source projects, has a wide range of applications in the country.

Current big players

Java language and brand are all owned by Oracle company, so Oracle company is the most important manufacturer of Java. The vast majority of the JSR (Java standard proposal) leaders are employees of Oracle.

Java is a huge ecosystem, the vast majority of software and Internet Co worldwide are Java users, but also can participate in promoting the development of Java language. Any organization or individual may join JCP (Java Community Process) and submit JSR to submit a new API or service definition to JavaSE, JavaEE, JavaME, etc.. Java has today's most comprehensive language ecology, and almost all the range of applications that can be expected have been standardized by software vendors, many of which have been accepted as JSR proposals. Today, the total number of JSR has been more than 400.

JCP is the international organization for the development of Java, in which the Executive Committee (EC) votes in the form of a vote on the JSR proposal. At present, the EC includes 16 contract (Ratified) seats, 6 election (Elected) seats and 2 partner (Associate) seats, and Oracle's permanent seat as owner. Non permanent seats are re elected every two years, with each election being half of the 24 seats, or 12.

The most important role for Java in the current EC committee is undoubtedly the Oracle, IBM and Redhat three companies. Oracle natural needless to say; Redhat led JavaEE8 in two JSR, and in the operating system, Linux, virtualization, cloud computing and other basic software product leader; IBM is a soft hardware largest manufacturer, has its own Unix operating system and JDK version. These three software vendors are also strong middleware vendors, and their impact on Java is critical. The JSR 376 (JPMS) modular proposal, which was recently voted down, was Redhat and IBM, which had voted to vote against it, and finally failed.

Several other important Java participants including: giant Internet Co, represented by Twitter; large financial companies, with Goldman Sachs, Credit Suisse as representatives; hardware manufacturers, strong Intel, NXP, Gemalto etc.; large system manufacturers, HP, Fijitsu; of course, master the advanced Java technology companies, such as Azul. Hazelcast, Tomitribe, Jetrains and so on. These companies play a key role in the development of Java.

Advances in GC

The main GC categories in JDK are:

  • Serial, a single thread for GC, when it is garbage collection, you must pause all other threads of work until the end of its collection.

  • Parallel, compared to the Serial collector, the main advantage of Parallel is the use of multithreading for garbage cleanup, which takes full advantage of multicore features and drastically reduces GC time.

  • CMS (Concurrent, Mark-Sweep) is a garbage collector that gets the shortest recovery pause time at the expense of throughput. GC threads and application threads are implemented concurrently without the need to pause all application threads.

  • G1 (Garbage, First, Garbage, Collector), G was designed to minimize the pause that occurs when dealing with heaps (larger than 4GB). Relative to the advantage of CMS, memory chip production rate is greatly reduced.

Currently, more than 4 GC can be used in JDK8, while in JDK9, G1 GC will become the default garbage collector.

In terms of OpenJDK, Redhat and Shenandoah GC. with open source which is a new kind of Java virtual machine GC algorithm, the goal is to use modern multi-core CPU advantages, reduce GC in large amounts of generated during the pause time. Use in the application of large memory, such as

The high performance GC without pause is the C4 (Continuously Concurrent Compacting Collector) Azul of GC Corporation, but only the commercial version is used.

In addition, the Balanced J9 in IBM GC performs very well, ensuring a relatively consistent pause time and avoiding destructive long pauses. Balanced GC is used in all kinds of IBM middleware products.

Java 9 features that have been identified at present

One of the most interesting new features in Java9 is the modular technical nature of the Jigsaw project.

Java language has been lack of language level modular capabilities. At present, modular technology has been widely used in server-side programs through OSGi, JBoss, Modules and other projects. The introduction of modularity at the language level of Java will greatly facilitate the modular and modular transformation of Java applications. Through modular resolution, applications can be more flexible to introduce, load, remove components, take up less memory, and be better suited to the requirements of the cloud computing era. In the JDK9 EA (preview version), the original rt.jar has been divided into several jmod, declaring the reference relationships among modules through the module-info.java file in the module.

However, modular transformation is a gradual and modest process, and Java9 makes a lot of concessions to be compatible with the run of Java8's previous applications, and the module definition is not so rigorous. Manufacturers also have their own existing system can seamlessly run on the Java9 commercial appeal. The Java modular proposal also takes more time to discuss and revise.

The jshell tool in Java9 implements REPL, which reads, evaluates, prints, and loops. This tool allows developers to interactively use Java to facilitate system management, debugging, and use. You can imagine, with jshell, Java language more suitable for beginners to start learning.

Jlink tools and AOT (pre compiled techniques). Java has always been run by compiling a program into a class file and then running through jvm. This work can be done across platforms in the early era, a variety of Unix and Windows on the desktop prosperity of the unified situation, to occupy the market to play a decisive role.

Today, however, both the large Internet Co and the enterprise, the X86 platform, 64 bit server has become the main choice. Considering the efficiency, you can compile Java programs into executable binary files, which is more suitable for the development of cloud computing and container technology.

Using the jlink/jaotc tool, you can compile a Java program into executable files, and only java.base modules support AOT when Java9 is launched.

Security enhancement. The introduction of SHA-3 the new algorithm, the built-in ALPN support HTTP/2 protocol provides better, DTLS (packet transport layer security protocol), UDP can guarantee the security of data transmission, PKCS12 format to replace the original JKS as the default format for keystore.

In addition, the unified JVM log (Unified JVM Logging), multi version coexistence jar (Multi-release jar files), the interface internal private method (Interface provate) is also very important new features.

Compared with other languages, Java has the advantage

Is Java the best language? No, because there is a more appropriate programming language in every field.

C language is undoubtedly the king of modern computer software programming language. Almost all operating systems are written in C language..C is an object-oriented C language, and has been continuously improved

JavaScript is a language that runs in browsers, and the rich front end needs Javascript's credit. Node.js in recent years has a place in the back end. Python is used for system management, and through the high performance pre compiled library, provide API for scientific computing, text processing, Linux is an interpreted language required.

Ruby is stronger than DSL (domain specific language), and programmers can define rich semantics to fully express their ideas. Erlang is designed for distributed computing that ensures robustness and stability in large-scale concurrent access. The Go language has built-in concurrency capabilities that can be compiled into native code. At present, a large proportion of new network related projects are written in Go language, such as Docker, Kubernetes, etc..

Write web pages with PHP, functional programming, there are Lisp, written iOS program, there are Swift/ObjectiveC.

In a word, the language that can stay on top of the list is good language and can do the best in its field.

Well, what are the advantages of Java language, which can occupy the first place in the rankings?

First, the syntax is relatively simple, learning computer programming developers can quickly get started.

Second, it has a strong competitive edge in several areas, such as server programming, high-performance network programs, enterprise software transaction processing, distributed computing, Android mobile terminal application development, and so on.

The most important thing is to meet the engineering requirements, we know that the modern software is collaborative development, so code maintainability, compile time checking, the operating efficiency of the more efficient, cross platform ability, rich IDE, testing, project management tools. Java has become the first choice for enterprise software companies, but also received many Internet Co favor.

No short board, easy to find Java software engineers from the market, software companies choose Java as the main development language, then use the other language collaborative programming in certain areas, such as portfolio selection, will not have a big problem.

So in general, the Java language is the best all-around.

Java outlook for the future

Today's Java has become quite functional, with Java 8 adding to the Lambda feature, and Java 9 adding modular features, and important language features seem to have been incorporated. If you want to say something worth considering, I think there are some of the following:

After the modular transformation, there may be more professional JDK software vendors to provide distribution, in the aspect of function, such as for distributed computing, machine learning, graphics, into function library related documents as. In this way, the professional industry customers can choose the fully optimized version of JDK.

Java semantically pairs

Multithreaded concurrent processing, Java has done very well. However, I personally feel it can be improved and optimized in multi process, multi thread coordination, and language level data pipeline representation.

JDK9 will have HTTP/2 client capabilities, but there is no doubt that there will be more and better three party libraries, and JDK can work with these three party libraries to provide a better API interface and SPI reference implementation.

At present, the biggest problem that Java encounters in cloud computation still is to occupy memory to be too big. Personally, I think in two ways:

  • If the application is indeed a long running service, you can consider a well structured single structure, and the total memory consumption doesn't take up more than a few micro service processes.

  • Micro service applications can be compiled in native code in the future, and use optimized three party libraries, and even local so files, to reduce the excessive memory footprint of a single process.

  • The security framework is more clear, and SPI allows three party libraries to provide more powerful and efficient security features.

  • There are more improvements in the direction of JavaEE:

  • EJB refactoring the current Corba distribution communication base, referring to gRPC for remote system calls.

  • The decomposition of the EJB specification, the characteristics of JVM related processes, such as injection / strengthen / / security affairs are unified into the CDI specification; cut to EJB, retain the remote access properties and distributed object as independent executive subject ability.

  • Strengthening JMS and MDB is comparable to Akka's current capabilities.

  • JaxRS moderately optimized does not need to rely on Servlet, or a modest adjustment to provide greater capacity.

  • JPA draws on JDO and incorporates part of its features to better support NoSQL.

Some personal experiences and experiences are shared

The software industry has a Hype Cycle model, many technologies have been sought after by the market and become stars, and some people do not meet, sometimes cold.

EJB is a widely misunderstood technology, and EJB gives a very complete technical framework for enterprise applications in distributed computing. At present, all application servers are not good enough. As for architects who plan to change micro service design, EJB is also a very valuable technology to learn from.

The slowness of Java is relative, and some of the current implementations are not good enough. For example, the original questioned network IO performance on Java, but the Netty framework stable, no one can doubt the ability of IO Java network, even in JDK8 the NIO is quite good. You know Java in order to realize the cross platform ability, the ability of each subset is a common operating system, and its design philosophy is to give the API framework, implementation is that it is self realization and loading service.

Java handles Swing and Swt in a remarkable way in dealing with interfaces (Idea and Eclipse's graphic base libraries), and JavaFX has been applied to a wide range of industry software. In the browser interface, the SpringMVC in the template to render the page the user most users; GWT seems not much, but the GWT based Vaddin in the overseas enterprise many users, and many server management software written in GWT; JSF is widely used in enterprise software, information management directly on the back end, with JS the front frame, can give full play to the advantages of various technologies.

The CDI specification is similar to SpringFramework in server programs, and Spring is a well-designed and complete framework for CDI that is more scalable. By defining the semantics of annotations, a company can maintain a set of its own component description language to enable rapid reuse of software between products and projects. CDI is the best way to define the internal model of a software component, but unfortunately few software engineers know it.

Micro service architecture in Internet applications, rapid development, operation and maintenance management, with the use of container technology, has a strong advantage. But not all application scenarios are suitable for micro services: strong transaction application systems, software architecture using a single body structure, easier to maintain from the overall level, but also to achieve better performance. Java has a mature and stable software architecture for both micro and single services.

Author: Zhang Jianfeng, Yong yuan middleware co-founder, member of the original Red Hat Inc JBoss application server core development group. He graduated from Beijing University of Posts and Telecommunications and Tsinghua University. He worked in Kingsoft, IONA technology and red hat software. Familiar with the various specifications of JavaEE enthusiasts; open source technology, love exposure to various open source projects; in distributed computing, enterprise application design, mobile applications, Devops technology has a wealth of experience and opinions.

China IT News APP

Download China IT News APP

Please rate this news

The average score will be displayed after you score.

Post comment

Do not see clearly? Click for a new code.

User comments