Applets reloaded
foreword
It's no secret that Adobe Flash fully took its position on the Internet. According to general statistics, almost 98% of Internet users have a Flash plugin installed. The main purpose of which is the implementation of "rich UI" (eng: a rich user interface), in simple terms, a beautiful, dynamic interface. Recently, however, two giants have decided to shake his position - Microsoft and Sun. Microsoft released Silverligth technology, and Sun decided to deliver a more serious blow. Having released several products at once with a common and quite obvious goal - to shake Flash / Flex.
')
applets
In itself, this is not a new word. And if more accurately, it is quite old. In fact, the possibility of developing "applets" appeared in the distant 1995. After 13 years, the technology has not actually acquired a mass character. In fact, this is not surprising. Constant problems with security, constant problems with compatibility in browsers, problems with the display of applets, leading to a hang of the browser. The list of shortcomings can be continued for quite a long time, and what is most interesting is that it is difficult to find those who will contradict this. Ken Russel (architect of the new plug-in) on August 28, 2008, when giving a presentation to Google employees, made it clear that all these problems had long been known in Sun. But most of all the time was taken away by the main question - “how to fix everything?”. Let's see what answer they found.
According to Sun, almost all the plugin code is completely rewritten. In fact, not just rewritten, but the plug-in architecture itself is completely redesigned. Now the plugin is almost completely implemented in Java. The only platform-dependent part is the Java <-> JavaScript bridge. According to the company, they managed to develop an interface that requires a minimum number of browser-dependent methods for the full implementation of this bridge. This allowed them to solve problems that previously existed with respect to the stability of the Java-JavaScript connection, which was acceptable only in Firefox Mozilla. The insides of the plugin have undergone a really big change. Now the JVM that runs the applet is completely separate from the bruaser process and is connected to it through a small asynchronous client that is in the browser process. This is intended to ensure that the applet freezes will not cause the browser itself to freeze. In addition, new features have appeared which, on the one hand, strongly untie the hands of developers, and on the other, add questions. For example, applets on the same page can (but are not required) run in different JVMs, the developer can now pass command line parameters for the JVM for each applet. Additionally, each applet can be executed with a specific version of the JRE.
For example, an interesting consequence of passing parameters for JVM is the ability to increase the size of virtual memory available to an applet. Sounds good, isn't it? However, the author begs the question - now when opening a web page, we must be prepared for the fact that it will take 2-3 GB of RAM only because the developer decided to play it safe and allocated 512 Mb on each applet of which is 6-7 here?
However, this fact solves the most global problem inherent in the applet - the browser hangs at the time of downloading and starting the applet. According to the promises of the developers, this is now a story. Due to the fact that the applet is in a separate process, all the time necessary for launching the applet, the browser behaves normally, and as soon as the applet is launched, it is actually inserted into the web page. Here are just experiments show that in reality it is not quite so ...



JNLP
Now the plugin fully supports the new way of placing the applet on the page. The plugin fully supports JNLP which is used in Java WebStart. In fact, this fact is the most significant in the whole update. This actually unleashes programmers. First, the applet ceases to be just an applet, in fact, this means that the same component can be both an applet and just an application installed via WebStart. But even this is not the most important innovation. And the most significant is that now you can use third-party libraries and load them for an applet. For example, you can connect JOGl. That is, in the applet, you can fully use the hardware accelerated OpenGL. But hardware acceleration can be used not only for 3D, but you can also control hardware acceleration in 2D graphics. Undoubtedly, the availability of 3D graphics on a web page is an interesting perspective. This will be especially interesting for on-line games. For example, enthusiasts have ported the famous Quke 2 game to Java and with the new plugin it can be launched directly from the browser, the project is now called Jake 2 (http://download.java.net/javadesktop/plugin2/jake2/). Also an interesting development is an applet developed by NASA - it is actually an analogue of Google Earth, which can be freely used to display a three-dimensional map of the planet on a web page. (http://download.java.net/javadesktop/plugin2/wwj/).
Interesting is also a backward compatible model of embedding an applet on the page. In fact, you can embed the applet in such a way that it will be recognized by both the old and the new plug-in, moreover, you can run one applet if the old plug-in is installed, and another applet if the new one is installed. This is all available by standard means without the need to dynamically change the code to insert the applet.
What is interesting is that now virtually every applet can simply be “pulled out” from the browser with a mouse and it really installs and runs through Java WebStart. And this will happen even without restarting the applet. This is a rather interesting fact and undoubtedly quite convenient in theory. But the most interesting thing is how our “friends” will take advantage of dishonest advertisers who use the slightest opportunity to open pop-up windows. For some reason, the author has no doubt that they will come up with a way to force the user to “pull out” the applet from the browser and fully deploy on the user's computer. An important fact is that the applet pulled out of the browser is actually “trusted”, and it has access to all user data under which the JVM is running. The fact that an applet can create its windows already seems rather dangerous. Of course, the developers thought about this and all the windows created by the applet are marked with an asterisk and an additional “close” button. As far as it really effectively notifies the ordinary user of the danger - a moot point.
Another interesting fact is the new data warehouse available for applets. This storage is very limited. But this opens up interesting perspectives for “marking” the user's computer. Yes, this functionality is also present in Flash, but still, the applet gets the ability to save data without any user notifications. And if quite a few users know how to delete the data stored in the browser, how many know how to delete the Java plugin cache?
Java FX
The new plugin fully supports JavaFX. This is a new scripting language developed by Sun to create a rich dynamic interface. In fact, this is a direct response to Flash. The language is really quite simple and at the same time functional. Applets created using JavaFX really do seem to be just Flash in the first place, and only with a detailed look you can see that this is not the case. Quite interesting is the fact that, according to Sun, JavaFX outperforms its competitors in speed.

It's nice that JavaFX is a declarative language. Given the success of other declarative languages ​​(HTML, XHTML, XML), we can assume success for it. At the same time, the technology makes it possible to very well divide the work of a programmer and a designer, which in itself always represents the main problem in the development of web applications. An additional advantage is portability to different platforms, and here we are not talking about software platforms, namely, hardware. Currently, this includes mobile devices and televisions (virtually all devices for which Java ME is available). However, there is a main difference between Sun and Adobe solutions, JavaFX is not just focused on a beautiful interface, but on interfaces with a lot of animation. And this phrase has a very deep meaning. In fact, the rendering core is optimized specifically for animation, and not just for rendering complex scenes.
Conclusion
Sun pretty seriously worked on new technologies, and their connection with each other. Technologies are really thought out and therefore easy to use. The main problem for them, however, will not be their own shortcomings, but exactly how the developers relate to applets. That is why the word "applet" Sun is trying not to use anywhere. That, according to the author, is really justified, since in fact there is nothing in common with previous implementations. Now the matter remains solely with the industry that either decides to abandon prejudices and then the future for all these technologies is secured, or the headlines will disappear with time and everything will remain as it is.