Zheng on Java Development: New tools, new framework, new thinking "reprint"

Source: Internet
Author: User
Tags qcon java se

Original address

May 23, 1995, the official birth of the Java language, January 1996, JDK1.0 released; May 2000, JDK1.3, JDK1.4 successively released; September 2004, J2SE 1.5 released; December 2009, Java EE 6 released; March 18, 2014, Java SE 8 released . In the history of the 19, Java has become one of the world's most popular development languages and one of the most widely used enterprise languages. In the world of software development, two years a small change, three years a big change, QCon Beijing 2014 Congress, the chief consultant from ThoughtWorks Zheng reviewed the recent more than 10 years of development and changes in the field of software development, and highlighted the Java World Program Library, development methods, tools and other changes. After the meeting, Infoq made an in-depth interview with Zheng.

InfoQ: Why would you choose the topic "You should update Java knowledge" In this QCon speech?

Zheng: This topic may have something to do with my personal experience. My career was started in Java, in the middle of a variety of opportunities, I have done a lot of other different types of projects, access to a variety of programming languages. In recent years, I've been getting all the attention back to Java, and I'm surprised to find that many programmers are talking about almost exactly the same thing that I did when I first started Java more than 10 years ago. You know, the industry we live in claims to be a fast-moving one. In fact, this more than 10 years, in the field of development has been a lot of new content emerged, even in the field of Java development, there are many changes. Some of my own recent Java projects have used a lot of stuff that I didn't have ten years ago. Since I have this feeling, why can't I try to summarize it? So, last year I wrote a series of "You should update Java knowledge" in my blog. I really summed up the content is far more than written down, within the company, I did a more than 10-section of the course, to my colleagues to share. The theme of this QCon sharing is based on the first part of this series of lessons. Therefore, I also mentioned in the speech, if you want to understand the whole content, see there is no chance to share in more conferences, of course, if you want a more complete understanding, you can contact me specifically, hehe.

InfoQ: In the speech you mentioned that you recommend a lot of more useful Java open source software, such as guava, can you tell us in detail?

Zheng: My recommended libraries have a principle that they must have very easy-to-use APIs, not just for functionality. here are a few of the libraries I'd like to recommend to you in my presentation.

one of my comments about guava is that if you're doing a Java project, you should use guava. Guava to some extent to compensate for the lack of JDK, we all know that the JDK is to provide Java developers with a basic development package, but the JDK is basically located in the functional implementation. that was more than 10 years ago, no problem, but now, with the deepening of people's understanding of code writing, there is simply not enough functionality and an easy-to-use interface. To give a simple example, read a file into a string, if implemented with the JDK, the light thinking of the exception to deal with the back of the headache. Guava is a modern library that has an easier-to-use API. Of course, guava also has some new features, such as some collection classes, caches, and so on. How's guava doing? Take a look at the Java 8 documentation to know that some APIs are almost untouched from guava.

Joda time is another library that I mentioned. It's a very interesting location and we all know that the JDK has a very bad date library design, and Joda time is to get us out of Java's date library. However, because it was well designed, it was also used by the JDK, so with JSR 310, which is now part of Java 8. However, from the perspective of technology development, Java 8 is widely used, there is still a long way to go. Most people will continue to struggle with Java 6, so I'm going to list it.

Hamcrest and Mockito are two libraries for testing. Hamcrest allows us to write assertions better, while Mockito lets us write Mock objects better.

Dropwizard, we can understand a framework for developing REST services, but in fact it does nothing but integrates some existing frameworks together. It is very different from the previous libraries, and it represents more of an open approach: a lightweight deployment style that throws away the heavy application server. It may not be the winner of the future, but it is worth knowing.

In fact, there are some good libraries to recommend, such as the implementation of the Actor's Akka, but these libraries are often representative of a particular program design style, so I did not specifically listed. In recent years, in the Java world, "new" Tools "new" framework, in learning these tools framework, you have a good way to provide to everyone?

InfoQ: What are some good ways for you to learn about these new tools and new frameworks?

Zheng: The software development industry is a rapidly changing industry, although many of the ideological level of things change little, but at the specific operational level, there will always be new things emerge. As a programmer, if you do not want to be eliminated for this era, an open mind is essential. As far as I am concerned, I will always open my own radar to understand all kinds of new technologies and new knowledge. As to the specific tool framework to learn, nothing special, documentation is the best teacher. Basically, the document will tell you everything that is functional.

InfoQ: In the actual development, the same function often has a different framework to achieve, such as the implementation of MVC has Struts, SPRINGMVC and so on. How do you choose a framework when you encounter a similar situation?

Zheng: In the case of similar functions, I will choose a library that is more in line with the direction of technology development and better API design.

For example, if you are developing a WEB application, the previous practice is to write one page in Spring MVC, but I won't do it now. I would prefer a microservices-based architecture, which is an approach that is consistent with the direction of technology development. It is easier to understand that the backend provides REST-based APIs that are accessed by the foreground page. So the traditional way is clumsy, they are for the background rendering of the page preparation, so, background framework I will choose a more easy to do REST API framework, such as with Jersey plus Jackson.

Another example of API impact selection, our common log library, we used to choose Commons Logging, but the use of this library, usually our code is to formally write the log before the first Judge Isxxxenabled. Because this library was designed before Java 5, there are a number of performance considerations. Now, my preferred log library is SLF4J, which eliminates unnecessary code and is very refreshing.

InfoQ: In the speech, you also focused on automation. So, what do you do in this respect?

Zheng: For Automation, my basic philosophy is to automate as much as possible everything that can be automated. More than 10 years ago, we mentioned that automation is basically compiled, packaged, and now the scope of automation is much larger than before. In 2011, I published an article on "Software Development Foundation" in InfoQ, which discussed some of the basic automation I did in my project. After a lapse of three years to see this article, most of the content is still applicable. Now, when we talk about automation, it should be larger than the scope of the article, in my own project, we will put some environmental deployment process automation, according to the current popular saying, the goal is to do continuous delivery.

In the field of Java automation, a relatively large change in recent years has occurred in the field of tools. I mentioned in my speech that if you're still using Ant and Maven, you're out of the way, Ant does simple things and it's hard for Maven to do complicated things. The trend now is to automate scripts in full-featured languages. In the article "Software Development Foundation", the tool I used was buildr, which relies on the Ruby language. The most active automation tool in the Java world in recent years is Gradle, which is now almost the default choice for my Java project, based on groovy.

InfoQ: You talked about some of the suggestions for lightweight deployment, can you elaborate on that?

Zheng: When it comes to the deployment of Java applications, it's intuitive to think "make a package, deploy to an application server." This was the way it was developed almost more than 10 years ago. But for developers, this almost means a variety of development nightmares. In order to locate some problems during the development phase, we have to use "remote" debugging on "local".

The application server was a product of the "Big Brother" era, when large companies sold application servers and sold hardware, so they concocted complex business scenarios. However, for many teams, you may not be able to touch such a complex situation for a lifetime. In that year, the bankruptcy of EJB had let us see that this illusory demand was untenable in the programmer community. Now, it's your turn to the application server itself. In my speech, I gave an example of an unreal requirement in this application server to deploy multiple applications on an application server. Now we see that most applications are not enough for multiple application servers, one application server deploying multiple applications in addition to testing play, in the actual scenario, is almost untenable. The rise of the open source community gives ordinary programmers a chance to see how a master works, and high-level programmers will always pursue a more "simple" way of working, attracting more programmers to this approach. I am happy to see that our way of development is no longer dominated by Big brother.

In recent years, with the rise of cloud and mobile development, the concept of microservices has gradually entered our horizons, followed by the Community's reflection on development and deployment. The dropwizard mentioned above is a good example, and through it, we just have to shoot a jar package, and the traditional way is that the jar package is just a running application. Yes, it has the Main function. Having the Main function means that we can easily do everything we want to do in the IDE, including debugging. In this way, developers can be "easy-to-make" by comparing the clumsy ways of the past.

With regard to deployment, One Direction now is the automation of deployment, and there are many tools to support this, like Chef, Puppet, and I used Docker on a recent project. With these basics, we can build a complete application on an empty machine with one-click. This is a very important foundation for continuous delivery. Further, we can combine this deployment with virtualization and the cloud to deploy our applications in a single node in the cloud with automated tools. You can think about it, if I need to test my application, or add a new node to the product environment, I'll just use a single command to automatically build everything we need on a node in the cloud. The traditional approach is simply to apply the machine is a lengthy process, not to mention manual installation of applications, configuration parameters these troublesome things. This is not an imagination for a better life in the future, in fact, many of our company's projects have done this.

Combining deployment automation with lightweight deployment and microservices, our approach is to write good one services locally, debug them, deploy them to the cloud, and test them further. This is a simple way to develop. Programmers should pursue simplicity, including the simplicity of our personal development approach.

Zheng on Java Development: New tools, new framework, new thinking "reprint"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.