Of course, I know that java is used mainly for creating enterprise applications, and each language has its own areas of application. Just from programming languages, I am familiar only with C, but writing desktop applications on it is “AD”. Therefore, I decided to learn the OOP language for creating desktop applications. C # I do not like because of the binding to Microsoft products, I just sit under Linux, but mono does not like it. Scripting languages ​​did not take into account, although the cross-platform Python and Perl pleases. C ++ is difficult to learn, and requires a lot of practice, there is no protection from curved hands. Therefore, the choice fell on Java, books on the language of the sea, completely OOP, static typing. But, what about writing desktop GUI applications in this language? Is it convenient to develop? If there are other options, use the X language, instead of Java for these purposes, I will be glad to hear!

  • one
    What mono does not like? My opinion is to write under .net it was created for desctop. Under windows faster than java. And on unix-like it is unlikely when your GUI is useful. There, too, there are two approaches WindowsForms (old), WPF (also old but more sophisticated). - Vladislav Pyatkov
  • one
    @Vladislav Pyatkov WPF junk? What then do you think is new? @danpetruk [please] [1] I don’t know how correct the tests are, but judging by this article, .NET has a noticeable performance advantage in a number of positions [1]: habrahabr.ru/post/120090 - DreamChild
  • 2
    @DreamChild on Habré often appear articles from schoolchildren in the spirit of "Scandals, intrigues, investigations." There is no benchmark, and for both platforms (IMHO). Java is "slower" because: it does not sit constantly in memory as .net -> a long start JIT does not compile right away, but collects a profile -> a long exit to the working mode No matter the GUI (AWT and Swing), does not fit well with JIT -> unresponsive inhibit "interface - IronVbif
  • one
    @IronVbif I do not intend to protect this benchmark (or argue that java is slower than .net), but your complaints about an article about java that is not in memory and features of jit compilation look somewhat illogical, because if we are talking about performance , then the programmer, in general, no matter what the reason, for technology A, shows lower performance than technology B. Performance itself is important. Well, here is [another test] [1], although an old one, but it says about the same [1]: rsdn.ru/article/devtools/perftest.xml - DreamChild
  • one
    @danpetruk: only the right generics give a solid performance boost. - VladD

4 answers 4

It seems to me not so much. Existing frameworks do not allow you to easily make a beautiful UI of the native view, and the lack of first class delegates and events in the language makes you write a lot of unnecessary “binding” code (Java is generally quite verbose, and only with the GUI ...).

I especially do not recommend Swing: terrible layout management, no speed, no styling and data binding, not to mention goodies like commands, animations, transformations and a declarative language like QML - in general, you have to write everything manually.

The C # / WPF bundle is much more advanced in this respect, but there is no WPF under Mono, so you lose cross-platform. (On the other hand, Windows is still the leading desktop platform by a wide margin.)

    Java is certainly suitable for desktop applications.

    There are many applications using Java in the desktop. One of the most famous ones is the Vuze (Azureus) multiplatform torrent client and the famous OpenOffice unixoid.

    Common to all of these applications, Swing is rarely used for GUIs. Vuze uses the SWT Eclipse framework, and OpenOffice generally has its own AWT-based version.

    With other things being equal, I would advise to pay close attention to SWT, the framework is mature enough, it will be faster and more colorful than swings. A brief comparison of SWT vs. Swing here

    Still, I recommend that you look towards C ++ / Qt. Developing, fashionable, well-documented, cross-platform, fairly easy to use Qt framework (which can do more than GUI (work with the network, database, threads and processes, XML, etc.)). For all this, all the delights of compiling into native code, the power and the sea of ​​available C / C ++ libraries.

    Why do you write yourself to neosilator in such a way? The complexity of the language - a fee for wide opportunities. Crooked hands will fall into place with experience, the eye will swell into subtleties that distract at first, then you just stop noticing. C ++ 11 and all sorts of buns like std :: shared_ptr will help write high-level code comfortably. And these divine patterns ... how can they be abandoned?) And const correctness and const methods? On this occasion, Carmack wrote a month ago on his Twitter account that the absence of these things in Java / C # is a step backwards compared to C ++.

    • one
      @Free_ze: I did not see Carmack’s statement, but I think that const in C ++ is a rather weak thing. The fact is that const does not give you (and the compiler) guarantees that the object will not be changed. It does not even guarantee that you will not be able to change it (no one has canceled const_cast ). This means that neither you nor the optimizer can use this to improve the code. Much more interesting and powerful semantics would be deep immutable. However, +1 for Qt. - VladD
    • @VladD, (only in the sense of the concept) and the mutable in deep immutable objects should work? - avp
    • @VladD Certainly, but if it became necessary to do a const_cast to remove the const modifier, was there any point in putting it initially?) There are mutables that, together with const methods, provide the logical constancy of the object. If you, say, decided to break something in this way and take advantage of this undocumented opportunity, then this is your problem, not an abstraction. - free_ze
    • one
      @Free_ze: certainly, to support invariants, const is useful. I actually mean that it does not give a guarantee : the compiler does not guarantee, for example, the absence of non-const alias, the programmer must follow this. --- And why is const_cast an undocumented feature? The standard is described, supported by all non-toy compilers, it does not call for warning. Common language feature. - VladD
    • one
      @VladD I understand you, but I do not consider this a disadvantage. Who, if not the programmer, can monitor the integrity of the abstraction?) Well, if the object is initially marked with const, it will not be possible to change it, it will not take any const_cast and it can be optimized well. - free_ze

    Try reading about JavaFX. It is designed to develop desktop GUI. You can certainly learn the good old Swing. All of this is included in the standard Java SE 7 distribution.

    • On swing found a book Portyankina, I think for a start will come down. Thank you! - kirar
    • Learn better JavaFx. Of course, he never shot, despite the efforts of Oracle, but as they say, there will be only one at the end, and this is unlikely to be Swing. - IronVbif
    • 2
      @kirar surname of the author of the book saying: Portyankin -: lol: - Barmaley