Four technologies that may challenge Java development advantages (zz)

Source: Internet
Author: User
Four technologies that may challenge Java development advantages
Author: Bruce A. Tate; beyond Java (beyond Java) Author
Translator: lenovozhf

Copyright Disclaimer: Any website authorized by matrix.Be sureThe original source and author information of the article and this statement are displayed as hyperlinks.
By Bruce A. Tate; lenovozhf
Address: http://www.onjava.com/pub/a/onjava/2005/10/19/challenging-java-dominance.html
Address: http://www.matrix.org.cn/resource/article/44/44016_Challenge_Java.html
Keywords: Challenge Java

Bruce Tate has a surprising history of successful technology foresight. He is one of the earliest developers who can foresee the emergence of the Spring framework;
He predicted the demise of ejb2 technology a year ago when the ejb3 Expert Group abandoned the old method. In his new book beyond Java, Bruce focuses on languages and technologies, which may challenge Java's advantages in some development fields in the future. In this article, Bruce mentioned four important new technologies.

Java is an outstanding industrial development language because it brings great unity and attention to important standards that do not actually exist before. But like all languages, Java will fade in the future. Based on my research that surpasses Java, a recurring topic is that more and more people believe that Java is no longer efficient enough. The following groups of technologies can make you more efficient. They are not suitable for all projects, but they are excellent tools when applied to suitable projects.

1. Dynamic Language

Dynamic languages can be more efficient than static languages like C ++ or Java. They allow you to express more meaning in less languages. Here, I will pay attention to the latest popular dynamic language Ruby. Compare ruby's "Hello, world" with Java:
Puts "Hello, world ."

This is obviously simple and clear. You don't need to write other code to do this. The following is a description in Java:

class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello World!")
  }
}

In Java, the type is static. This indicates that the compiler needs to check all types; you must create and compile a complete program. In Ruby, the types are dynamic, so you don't need to declare them. You can write and run them immediately. The following is a sequence of Fibonacci described in two languages:

First, Ruby:
x1, x2 = 0, 1                    //1
10.times do
  puts x2
  x1, x2 = x2, x1+x2         //4
end

Note that two variables are declared at the same time in the first and fourth rows, so that you can easily express two different declaration forms.
In addition, note that 10 is an object and it supports methods, such as times. In addition, there is a code block between do and end.
The ruby code block allows you to pass the code block into the method .. This technology leads to incredible efficiency and concise code.

Next, let's take a look at the Code implemented in Java:

class Fib {
  public static void main (String args[]) {
    int x1 = 0;
    int x2 = 1;
    int total = 1;
    for (int i=0; i<10; i++) {
      System.out.println(total);
      total = x1+x2;
      x1 = x2;
      x2 = total;
    }
  }
}

You need to declare all the variables and write in detail the iterations that you implement with the for loop. Each variable is independent, so you must have a temporary variable to store total.
Dynamic Language is more concise than dynamic language. According to a common rule, if you can write less code without sacrificing readability, this code will lead to higher efficiency.
(But you cannot sacrifice readability to achieve this step. We can end with a Perl example .)

More importantly, the dynamic language performs better on important issues that Java developers want to solve, such as metaprogramming. Hibernate uses metaprogramming technology to make objects persistent.

Spring uses metaprogramming to add services to Java objects, saving you from building additional support for them. In the rails framework, the red ruby uses its own capabilities to build a certain existing
The most efficient application development framework.

Surprisingly, many Java developers use ruby. Ant and tomcat inventor James Duncan David son are using Ruby on Rails, and one of the best-selling authors of Java, one of the JSP Expert Group's
Member David Geary is writing a book about rub on rails. Many people with smart ideas in the Java Community turn to dynamic languages like Ruby. This is because this new language can better solve the most interesting problems. Dynamic languages will not completely replace Java, but they will be suitable for solving small and lightweight problems.

2. Continuation Service

WEB programming is definitely a disaster. Ten years after the birth of Java, we still cannot build a framework that makes the return button correct. Web applications are borderless, so Web applications will develop better. However, it is difficult to build borderless applications, and our existing framework cannot provide us with enough help. When you use most Java Web frameworks, you have built many
Unrelated applications that use servlets or JSP technology. Then they are integrated by manually saving objects. These objects are what you need and are used to temporarily store object sessions.

Continuation is a language constructor that allows you to quickly store the status of a thread and then execute this thread. In general, the continuation-based Web framework simulates a monitoring application to make web development easier. When your application needs to obtain data from the user, this framework uses continuation to automatically save the state of the application. If you press the return button or return to the previous page through the browser's historical records, the application can read a new continuation.

The best continuation-based framework is developed in dynamic languages. So far, the most robust framework is seaside. He is based on a Smalltalk squeak language framework. Seaside supports debugging. You can check, debug, and modify your code in your browser in real time. Borges, Iowa, and wee are both ruby-based and support for the continuation framework.

Java does not support continuations, but some Java frameworks constructed under special restrictions support simulating continuations. These frameworks have some characteristics of the continuations framework written in other languages.
. Popular frameworks use advanced technologies such as bytecode enhancement, reflection, and special class loaders. These technologies partially implement continuations using Java.
. Cocoon 2 adds continuations to the rhino JavaScript Virtual Machine to simulate monitoring status applications.
. Spring webflow uses a state machine to provide good support for response buttons and other features of the continuation service.
. Lakeshore uses a suspended thread to simulate continuations. This method is not as scalable as other methods, and lacks complete support for the return button, but these are expected to be in the future
Yes.

Every month, a new framework will appear. In my opinion, in the next three years, we will all use a web development framework that supports the continuations method, which is composed of one language or another.
.

3. Convention goes beyond Configuration

Java developers often find ways to improve configurations. More and more new frameworks are configured using Java 5 annotations. Other frameworks use a different method. Common Ruby conventions in rails are used to infer the connections that need to be configured in other frameworks. For example, at the end, a rails controller named blogcontroller with a show method will automatically submit a view named show. rhtml in the blog_controller directory. Rails also uses naming conventions to bind persistent classes in the database table. By default, the perosn class matches the plural people in English with the table.
The new framework will support conventions rather than configurations.

4. metaprogramming

As mentioned above, there are many hypes in Ruby on the rails programming framework. I think this kind of hype is correct. Ruby on Rails allows you to write your program at a more abstract level than Java. With Ruby on Rails, you can create a domain object, which can discover the content of the associated database table. For example, you can write such a simple model object:

class Person < ActiveRecord::Base
end

This type of surface looks quite limited. But once you execute it, rails will show its magic. In this way, the persistent rails activity record framework is associated with related databases, and system tables are scanned for table definitions, and columns in the database are also found. Then, the activity record adds an attribute for each column in the database, and adds a unique identifier for the ID column name in the database in the class. You can use the following classes to write code:

person=Person.new
person.name='Bruce Tate'
person.email='bruce.tate@j2life.nospam.com'
person.save

The column names and actions of the database are added to the person class after the runtime. You can easily extend the person class:

class Person < ActiveRecord::Base
  has_many :cars
end

Using a simple belongs_to method in Ruby and the Department identifier, I implemented everything I wanted to do. Activity records implicitly call Ruby's metaprogramming to add all methods and variables. These methods and variables are used to manage one-to-multiple relationships between any department. Rails users use domain languages to manage relationships such as inheritance. In addition, they can use Ruby to work at a more abstract level. Rails seamlessly extends the ruby language.

Will rails be the next generation of great frameworks? Possible. To make a choice, rails should be the first in the trend of metaprogramming frameworks using Ruby or other dynamic programming languages. Alternatively, you may see that rails serves as the hub of some loosely aligned technologies. It is based on metaprogramming. In any situation, you will be more efficient.

Summary

In the book "Beyond Java", I have expressed that Java will not be eliminated, but in the last decade, we have witnessed notable innovations beyond the Java field. These four technologies will play an important role in the near future. Please pay close attention to them.

Resources
· Onjava. com: onjava.com
· Matrix-Java developer community: http://www.matrix.org.cn/

Bruce A. Tate is a kayak enthusiast, a mountain, and father of two children. In his spare time, he served as an independent consultant for Austin, Texas. He has written four books, including the best-selling book bitter Java and better, faster, and lighter Java, recently published by o'reilly.

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.