Shout Myths or Java with a Human Face

    I decided to write a short note on this topic after I read here on Habré, a discussion about choosing a development language for a new desktop application. With an enviable constancy, the moment was mentioned that visually, Java applications look clumsy. So I decided, slightly, to clarify this issue.

    So, what is the peculiarity of the implementation of desktop applications in Java and why can they be very beautiful? And also, where did the myth of inferiority come from (some exalted personalities sometimes even tend to use the word 'wretchedness') of the Java GUI, read below. I tried not to go into subtleties, not to write any code, and indeed not to use any knowledge specific to the Java world. I would like the note to be understandable to people far from this technology.

    Most erudite programmers do know that ... a Java application should be as cross-platform as possible. Also, as a rule, the most erudite of them know that the appearance standards for different operating systems are slightly different. So the question arises, but how to actually achieve that the application would look beautiful, in the sense of beauty, how are users of specific operating systems used to evaluate it?

    That's how. Apparently, I will not be mistaken if I say that any of us knows what Winamp is. And most likely he knows what skin is. We are all used to the fact that this program may look completely different if you change the “skin” of it. Of course, many other programs also have this feature. Now, back to our ba ... our Java. The main software framework that is used to develop Java desktop applications and comes standard with the platform is Swing (hussars keep quiet!). This framework is generally a good example of designing OOP applications, but now, we are interested in only two of its features.

    Feature number one - all the visual elements that we see in the application are drawn directly and only by this framework, using the most elementary graphic primitives of the system.

    Feature number two - all this drawing mutoten, carefully and neatly placed in a separate layer with its clearly postulated and open interface. This layer, in an intelligent way, is called Look & Feel. And here, I ask you to pay special attention to the words “clearly postulated open interface”. What does this mean in life? But in life, this means, not much, not little, that we have a kind of “software skin” (skin) that absolutely any developer who knows this wonderful Java language can implement to his taste. Round, translucent buttons with Windows logos jumping inside? No problems!

    But that is not all. The main thing is that a market for these same Look & Feel has long appeared. That is, there is a large kodla of enthusiasts who enthusiastically began to paint these Look & Feels from the point of view of their personal understanding of the nature of beauty.

    Of course, to warm up, at first there were peels that make the appearance and behavior of Outlook (all versions can be found), Windows XP, like well-known interfaces from the Unix world and ... let's go. As you correctly understand, there has long been Look & Feel that give Java programs the appearance of applications and like in the Apple OS. Including the operation of standard keys for accessing interface elements.
    There are several different Look & Feel implementations in the standard Java library package. People who have access to the Internet can find good samples, for example, here:

    www.jidesoft.com

    or here:

    www.incors.com/lookandfeel
    www.javasoft.de/jsf/public/products/synthetica/themes

    As you understand, all this also means the following - any Java program written using Swing can have a-absolutely any imaginable visual interface that will look exactly the same in any operating environment. On the other hand, any program can come with several visual interfaces that can be switched directly from the menu during operation. And these beautiful interfaces have long been done for you and are being handed out for free. Or give away for a fee. Those are sometimes even better than free ones. Although not always. It is also obvious that all these visual components are inherited from one common ancestor and, therefore, relying on it, you can come up with your own visual component that will be drawn and work the way you personally like it. Given all of the above (and verified by me in practice), the statement that Java is ugly, it’s probably the machinations of microsoftware that failed to quickly (in the presence of the customer) distinguish Java Windows XP Look & Fell from native Windows XP. Another explanation is hard for me to find. :-)

    Here, apparently, aesthetes will object to me, but is it not for a very long time that all this beauty is drawn, so it turns out that every pixel needs to be drawn in Java? And they will be partially right. This is indeed a few milliseconds longer. For aesthetes, in the Java world there is a different approach and a different framework. It is called SWT (Standard Widget Toolkit). Of course, open and free. Well, that's clear.

    This framework is built on other principles. It makes maximum use of the graphic elements of the operating environment in the context of which the application is launched. They are drawn, if possible, by the means of the operating environment itself, and look as is customary in this environment. That is, a button, it will everywhere be the button that users of the system where the application is launched are used to seeing it. Everything is drawn a little faster. It looks more standard.

    Everyone chooses what is closer to him. But ... In terms of interface speed, there are two good examples. These are the most popular Java IDEs to date. Frankly, these are very powerful IDEs. Probably the most powerful IDEs that currently exist on the planet in the world of software development. IntelliJ IDEA and Eclipse. The first is written in Swing, the second in SWT. I didn’t notice any striking difference (what’s there, just - no) in the speed of work. Moreover, there is another well-known development environment - Visual Studio, you yourself know from whom (calmly, this is not A. Lebedev), written by yourself you know what. So, subjectively evaluating, it also, for some reason, subjectively, does not work faster. Well, such things. :-)

    And now, a few words about where the myth of wretchedness comes from. As I think. The standard examples of the 'Hello World' level in Swing are written so that they can somehow be run in any environment. Somehow ... Nobody puts a Tahoma font to display text. There are generally three to four fonts available on any system. And now this disgrace starts with gray, ax-hewn buttons and ..., it works. Everywhere! But in Spartan elegant and uncomplicated. The developers look at all this, scratch their turnips, and issue a verdict - shit ... (crossed out) not a good GUI for this your Java, let me go and try Erlang or Haskell. That's all there, stopudovo, better done. And on Habré, campaign, I will tell what shit ... (crossed out) this Java is not very good. Well, do not read the same nonsense about this Look & Feel interface in the documentation. There are enough other worries. :-)

    Also popular now: