On Tue, Sep 21, 2010 at 12:46 PM, Casper Bang <[email protected]> wrote:

> > You can't really avoid casting when you're reading a Java hierarchy off
> an
> > XML file. The important part is to limit this casting to its bare minimum
> > (getting the root), and Android does exactly that.
>
> I understand the impedance mismatch of deserialization, but it's still
> a smell. :) The port of Guice (RoboGuice) turns this around and avoids
> it through DI.
>

I'm not familiar with this effort, but either it still uses XML, in which
case I don't see how it can avoid the casts I was mentioning in my previous
message, or it uses 100% Java to specify your user interface, in which case:

   - It's 100% statically typed with no casts, but it forces you to write
   your user interface in Java (which is painful, see below).
   - It's not really comparable to Android's R approach, so it's neither
   better nor worse, just different.

I am the first to admit that designing interfaces in XML is not optimal, but
I've recently done a good amount of Eclipse plug-in development (SWT +
JFace) and I can tell you that specifying user interfaces in Java is
actually worse.

Eclipse's next version is moving toward an XAML approach to design user
interfaces, which I'm really looking forward to. Let's hope they can pull it
off.


>
> > I'd argue that Android's R system, which provides static type safety for
> > resources, is actually pretty solid. I can't count how many times I've
> had
> > regular Java code crash at runtime because a .properties or .xml file
> could
> > not be found... This can't happen on Android: the compiler will tell you
> > right away.
>
> Well yes, but then you are tied to the tool support of the Eclipse
> plugin - it's one of the significant hindrances from using other
> IDE's. I've often wanted a sort of dynamic Enum for the purpose (since
> same problem exists when you deal with I18N keys), but it needs to be
> baked into the language rather than be dependent on IDE/compiler.
>

It's not "tied" to Eclipse, you can build everything from the command line
(and I know a lot of people do). Using Eclipse just gives you a productivity
boost.

-- 
Cédric

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to