About

Michael Zucchi

 B.E. (Comp. Sys. Eng.)

  also known as zed
  & handle of notzed

Tags

android (44)
beagle (63)
biographical (87)
blogz (7)
business (1)
code (63)
cooking (30)
dez (7)
dusk (30)
ffts (3)
forth (3)
free software (4)
games (32)
gloat (2)
globalisation (1)
gnu (4)
graphics (16)
gsoc (4)
hacking (434)
haiku (2)
horticulture (10)
house (23)
hsa (6)
humour (7)
imagez (28)
java (224)
java ee (3)
javafx (48)
jjmpeg (77)
junk (3)
kobo (15)
libeze (7)
linux (5)
mediaz (27)
ml (15)
nativez (8)
opencl (119)
os (17)
parallella (97)
pdfz (8)
philosophy (26)
picfx (2)
playerz (2)
politics (7)
ps3 (12)
puppybits (17)
rants (137)
readerz (8)
rez (1)
socles (36)
termz (3)
videoz (6)
wanki (3)
workshop (3)
zcl (1)
zedzone (21)
Saturday, 06 December 2008, 18:56

Swings and rounabouts.

Ok, back to a bit of hacking. There's something about spending all day chained to a windows xp desktop and a visual studio session that simply sucks the life out of you. Leaving little time or energy to pursue other hobbies or interests. But with the lengthening days and a lack of TV to watch, I've found time to look back at Java again.

The last time I did any Java was 1998-1999, so it's been a long time between drinks, so to speak. Although I have tried to like eclipse, I never really did get to like it. And the last time I went looking for plugins all the interesting looking ones (for what I was looking at) were out of date, or had nothing but dead links in them - so that put me off even bothering. So this time I tried netbeans - and by chance 6.5 had just been released.

Well, I was mostly impressed actually. Swing actually isn't that bad. And it's a breath of fresh air to have some decent documentation for a change after dredging through the crap for WPF. Or even to look at the source-code! Wow! Almost like the 'good old' GNOME days where I built everything from glib up locally so had a much better time of debugging. At first the GUI editor seemed as crappy as the WPF one - defaulting to using hard-coded layouts. But then I couldn't find any table or v/hbox/stackpanel's and thought the whole system was really stuffed. But then I discovered that the layout container can automatically snap to theme-specified offsets, and can align columns and rows, and actually aligns baselines rather than bounding boxes. Wow. I don't know if it'd be easy to use from code, but with the netbeans editor it is quite nice. Far better than gtk+'s (and WPF's) fixed-sized crap and having to worry about whether it's an inner or outer margin, it just does that automagically, and even scales for different themes. Nice. Anyway, after struggling with vbox/hbox/table (ugh), and then grid/stackpanel (sigh, even worse) for years, I instantly fell in love (I think it's a GroupLayout, or maybe it's a netbeans-specific AbsoluteLayout).

Oh, and it all runs quite snappy too. Not that it isn't a bit of a pig (but machines are so much bigger now - so it isn't really an issue), but UI apps seem just fine - infact netbeans is a lot faster than visual studio, in every way. A lot faster. I do wish you could set bitmap fonts though - I'd love to just use 'fixed' as my font.

I thought i'd miss 'delegates' - as a C coder I littered my code with function pointers all the time, I really couldn't get enough of them, and c-hash delegates are much the same (although I don't use them the same way). But using anonymous classes actually looks neater for some reason - it's basically what c-hash is doing 'under the bonnet', and often the delgate callbacks do so little they don't warrant their own function anyway. Properties are sort of nice - but they are only syntactic sugar, they don't actually do anything at all differently to what a getter and setter does - they provide no additional facilities automatically like property monitoring. c# events are quite nice though, again they are really only syntactic sugar, but they do save a lot of boilerplate code.

Apart from that, it struck me just how much like Java that c# really is. In true ms fashion all they did was copy and complicate. The simplicity of the Java language is nice.

Some of the libaries are also nice too. Simple. But others - you just wonder what people are thinking. The JSR for binding properties is awful. It looks complicated and messy to use - much of it in the name of 'type safety' - but then they go and use some scripting language for binding expressions that isn't checked till run-time anyway. Sigh. Everyone seems obsessed with standardising and formalising every little thing too. Sometimes the smaller simpler stuff can just be left to the implementor. Some of the 'design pattern' guys seem to have gone off the deep end - adding over-doses of complexity upon complexity.

The application at work is a single-user destkop application that uses a SQL RDBMS as a backend. One thing we've contemplated is moving it to a multi-user, server-based system. Now i would simply not consider using .NET to do this. So that was another reason to re-visit Java. Ahh j2ee 5. Well one thing that can be said for Java. You've got a lot to choose from, a lot of it is free, some of it is extremely good quality. It's really like another world completley from the closed money-grabbing greedy eco-system in the stagnant cesspit surrounding the outflow from microsoft. There just isn't any comparison - they're not even in the same league, perhaps not even the same sport.

I'm still trying to get my head around the persistence framework. I kinda liked the older Entity model, because things were coded directly, at least initially it seems easier to understand (or at least, I figured out how it worked at one point, although I never used it). The newer model does a few things unfamiliar to me, but i'm sure I could get used to it. Our .NET code uses a custom entity-like system and a lot of custom SQL (lots of messy joins), which would be quite difficult to move to the persistence query language, but most of it could be moved to views or stored procedures as well (and probably should be at that). I'd considered nhibernate, but it was a bit immature at the time, and quite frankly I didn't see the worth in investing all that time to learn another meta-language to re-describe what was already in the database (and I still dont - i'm glad as hell that j2ee 5 uses xml meta-descriptors sparingly).

The new EJB stuff is quite nice in some areas. Last time I worked on Java this stuff didn't even exist. We were using CORBA directly. The automatic CORBA servant generation from interfaces is ... well it's nice. But there are some `strange' limitations. Well they're not really strange - it forces a particular architecture which will scale transparently. But if you don't really need that it does limit things needlessly - like passing around client-hosted interfaces. Although facilities like JMS can often be used to implement the same sort of things anyway. JMS is nice.

One problem is that although all of these really nice facilities exist - it can be a real pain getting them to actually work. I was playing with JMS and even though I was using the 'correct' mechanism for sending messages, I was running out of connections. Bug in the app server perhaps? I'm not sure. Not knowing is a bit of a problem. And with a distributed application I was hoping to re-use the persistence objects remotely, but that doesn't really work. Ho hum, back to the (manual) grind of load--copy to mirror object--return, etc. In another case I tried changing a persistence object from being LAZY to EAGER loaded - it crashed with what seemed to me an interface mismatch between server and client. Couldn't work that one out. Actually in general netbeans+glassfish seems terribly unreliable at consistently rebuilding dependencies. Maybe i'm doing something wrong, but even with less than a dozen files I often have to run it twice, or shutdown everything and clean+build to get new code loaded (this is something that affects visual studio too).

I shall continue to tinker.

Tagged hacking, java.
Summer | Sackboy, alias The DRM Kid
Copyright (C) 2019 Michael Zucchi, All Rights Reserved. Powered by gcc & me!