Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29217

Re: java swing question

Date 2014-07-22 21:58 -0400
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: java swing question
References (1 earlier) <lqh4ul$9ve$1@speranza.aioe.org> <paint-20140720213805@ram.dialup.fu-berlin.de> <k7bps9piodba7gbvt045j9or76nobk6989@4ax.com> <53cdbef6$0$291$14726298@news.sunsite.dk> <99ydncqLpqCV_1POnZ2dnUVZ8r2dnZ2d@bt.com>
Message-ID <53cf16cb$0$300$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 7/22/2014 9:04 AM, Chris Uppal wrote:
> Arne Vajhøj wrote:
>
>> * modern GUI design where the layout is done in ML not code.
>
> I am still completely unable to see why anyone thinks this is an advantage.
> Yes, I know that practically everyone /does/ think that, but it baffles me.
>
> Why have two code artifacts instead of one, when they are necessarily
> intimately connected ?
>
> Why use two languages instead of one ?  It's not as if *ML is any /clearer/
> than most languages.  It may be that Java specifically -- with it's weak
> ability to create DSLs within it -- is something of an exception.  But even in
> that case the solution isn't to shoehorn in one of the least expressive
> "notations" every seriously devised !

This is not Java specific.

Examples of the split:
* Java EE
   - JSP view + Java controller in original MVC Model 2 [I think
     this was before CSS became common]
   - JSP view + Java action + CSS styling in Struts 1 and
     many other MVC frameworks
   - JSP view + Java managed bean + CSS styling in JSF 1
   - Facelet view + Java managed bean + CSS styling in JSF 2
* ASP.NET .aspx view + .aspx.cs controls + CSS styling
* Rails .html.erb view + .rb controller & action + CSS styling
* Flex .mxml view + .as action
* WPF .xaml layout + .cs controller
plus numerous other frameworks in various languages.

This shows that:
* the phenomenon is not caused by any missing feature in Java
* a lot of GUI framework designers think it is a good idea

It does not really show that it is a good idea. At least in
theory the majority of GUI framework designers could be wrong.

The design needs two justifications:
* one for why separating layout, action and styling is good
* one for why different languages for each are good

Separating different aspects of applications is a very well-known
technique. In Java we split up code in methods, classes, packages,
layers, source files, deployment units (jar/war/ear/rar). It is
generally accepted that code split up in logical distinct chunks
makes it more readable and easier to maintain. This applies
to classic split in presentation+business logic+data access
and model+view+controller. It also applies to layout+action+styling
in a GUI app. Those are very logical distinct:
* layout = layout of GUI widgets
* action = handling of user actions
* styling = providing common L&F in whole application or group
   of applications

Actions require imperative logic. An imperative language
like Java is well suited for that. So are C#, Ruby, JavaScript etc..
Layout and styling are non-imperative and leaning towards a
declarative model. An imperative language like Java is not
very well suited for that. Various experience from web furthermore
shows that different declarative languages for layout and styling
are better than a single languages, because layout and styling also are
fundamentally different. All this should not come as a big surprise. The
idea that a single language is best for everything is wrong. Languages
are typical good for what they were designed for and not so good for
what they were not designed for. So vastly different problems often
require different languages.

Arne

PS: There are actually cases where an imperative language is best for
     layout and that is if the layout is determined at runtime. But that
     is an exception not a typical case.


Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

java swing question Peter <mcheung63@gmail.com> - 2014-07-21 03:15 +0800
  Re: java swing question Peter <mcheung63@gmail.com> - 2014-07-21 03:23 +0800
    Re: java swing question Jeff Higgins <jeff@invalid.invalid> - 2014-07-20 15:24 -0400
      Re: java swing question Peter <mcheung63@hotmail.com> - 2014-07-21 18:34 +0800
      Re: java swing question lipska the kat <lipskathekat@example.com> - 2014-07-21 15:56 +0100
      Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-21 21:49 -0400
        Re: java swing question Jeff Higgins <jeff@invalid.invalid> - 2014-07-22 17:35 -0400
          Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-30 22:38 -0400
      Re: java swing question Luft <edamron@spamcop.net> - 2014-08-05 12:29 -0700
        Re: java swing question Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-05 15:50 -0400
          Re: java swing question Joerg Meier <joergmmeier@arcor.de> - 2014-08-05 23:33 +0200
        Re: java swing question Jeff Higgins <jeff@invalid.invalid> - 2014-08-05 18:41 -0400
    Re: java swing question Roedy Green <see_website@mindprod.com.invalid> - 2014-07-20 23:04 -0700
      Re: java swing question Daniele Futtorovic <da.futt.news@laposte.net> - 2014-07-21 14:05 +0200
        Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-21 21:34 -0400
          Re: java swing question Daniele Futtorovic <da.futt.news@laposte.net> - 2014-07-22 20:50 +0200
          Re: java swing question thinbluernime <thinbluernime3@gmail.com> - 2014-07-22 23:58 +0000
            Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-22 20:21 -0400
              Re: java swing question thinbluernime <thinbluernime3@gmail.com> - 2014-07-25 04:19 +0000
                Re: java swing question Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-25 00:15 -0500
                Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-30 22:34 -0400
                Re: java swing question thinbluernime <thinbluernime3@gmail.com> - 2014-07-31 16:07 +0000
                Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-08-02 23:03 -0400
                Re: java swing question Joerg Meier <joergmmeier@arcor.de> - 2014-08-03 12:17 +0200
                Re: java swing question thinbluernime <thinbluernime3@gmail.com> - 2014-08-03 19:25 +0000
      Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-21 21:31 -0400
        Re: java swing question Wayne <nospam@all.invalid> - 2014-07-22 00:32 -0400
          Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-22 19:50 -0400
        Re: java swing question "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-22 14:04 +0100
          Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-22 21:58 -0400
            Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-22 22:00 -0400
      Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-21 21:35 -0400
    Re: java swing question Peter <mcheung63@hotmail.com> - 2014-07-21 18:33 +0800
    Re: java swing question Jeff Higgins <jeff@invalid.invalid> - 2014-07-21 17:13 -0400
      Re: java swing question Jeff Higgins <jeff@invalid.invalid> - 2014-07-21 17:40 -0400
      Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-21 21:46 -0400
        Re: java swing question Joerg Meier <joergmmeier@arcor.de> - 2014-07-28 23:47 +0200
          Re: java swing question Josip Almasi <joe@vrspace.org> - 2014-07-29 00:17 +0200
          Re: java swing question Arne Vajhøj <arne@vajhoej.dk> - 2014-07-30 21:09 -0400
    Re: java swing question Silvio <silvio@internet.com> - 2014-07-22 02:18 +0200

csiph-web