Log in

No account? Create an account

Thu, Nov. 2nd, 2006, 11:12 am
I work in a factory, don't wanna be late

I've been doing a lot of Java recently. Once, long ago, I used to do Java as my day job and always found it oddly constrictive. In the intervening half decade plus my contamination^W exposure to scripting languages has only deepened so this time around the constrictiveness has been upgraded from "Like an overly tight pair of jeans" to "Like having my balls crushed in a vice".

Part of the reason is, I think, the strange and almost religious reverence of Factory classes. I often joke with my flatmate, a paid up member of the Cult of Java, that in most sane languages you can increment doing any of the following


in Java it's more likely to be

    Integer            i                  = new Integer(1);
    IncrementerFactory incrementerFactory = IncrementerFactory.getInstance();
    Incrementer        inCremenTer        = incrementerFactory.getIncrementer();

Oh how we live the rock'n'roll lifestyle, sitting round the fire, swapping programming jokes.

I understand the point of factories, especially since, I'm lead to belive, you can build apps using Beans etc etc that will automagically scale from one machine to a massive, n-way failover clustered farm, but sometimes it may go a little far.

Yesterday I was attempting to get rid of all warnings from my Java app because the little yellow exclamation marks! in Eclipse have the same effect on me as an single upside down book in a bookcase does on an OCD sufferer. I put this down to my years working at the big Y! or possibly too much time playing Metal Gear Solid (most. overrated. game. ever[*]). I finally get down to my last set.

I had been doing

    Date date = new Date()

but those methods are now deprecated so instead I have to do ..

    Date date = new Date();
    Calendar cal = Calendar.getInstance();

which for reasons I can't quite vocalise, offends me at a nigh-spiritual level.

Ah well, back to tracking down synchronisation bugs that peg my CPU at 100% and render my machine unusuable for 20 minutes.

Bonus points to the person who can tell me which song the subject of this post comes from.

[*] Apart from possibly God of War

Thu, Nov. 2nd, 2006 11:20 am (UTC)
(Anonymous): Title

Hard-Fi ?

and keep living the dream, man!


Thu, Nov. 2nd, 2006 12:52 pm (UTC)
deflatermouse: Re: Title

Sadly no.

Far older than those young whippersnappers.

Thu, Nov. 2nd, 2006 01:35 pm (UTC)
(Anonymous): Re: Title

Had to give up and google - finally found the answer here !


Thu, Nov. 2nd, 2006 11:24 am (UTC)

I have also had dealings with the Calendar/Date mess in recent weeks and it's really quite vile. Especially in J2ME.

Thu, Nov. 2nd, 2006 12:17 pm (UTC)

Dude, "Date" was being phased out back in Java version 1.3 ...

Also, what's with "System.out.println(1900+date.getMonth());", you sure do have a lot of months in your system ;-p

Well, since it does it anyway, wouldn't the following be better:

Calendar cal = Calendar.getInstance();
cal.setTimeInMillis (System.currentTimeMillis ());

rather than messing with that damn silly legacy "Date" object ...

Although I think you were offended by the having to call cal.get, sorry mate, nothing can do unless you want to subclass and then allow direct access to the protected field 'fields' (int[]) ...

Although as another learned gent pointed out (round-about), it could be worse, you could have to be programming in J2ME (CLDC esp.).

Thu, Nov. 2nd, 2006 12:57 pm (UTC)

> Also, what's with "System.out.println(1900+date.getMonth());", you sure do > have a lot of months in your system ;-p

*cough*, err, slip of the Copy'n'Paste. Fixed now.

> rather than messing with that damn silly legacy "Date" object ...

Unfortunately it's not my choice - I'm being handed a Date object by another API.

> J2ME

I dealt with that abortion way back when in 2001 or so. I can't think of a worse language for doing games programming in than the MIDP configuration of Java. It's like they actually sat down and tried to come up with the most retarded language for churning out games and instea dof using that as something to avoid they used it as the spec for the project.

I suppose they could have used ADA.

Thu, Nov. 2nd, 2006 01:19 pm (UTC)


(sorry, could not resist)

I'm being handed a Date object by another API.

Philip applies head to desk, redo, redo, redo, rdeo, rode, oder, ...

Well they could have used LISP or Schema too ...

MIDP 1.0 is just plain poor, 2.0 is a little better, but the main problem is that most devices don't actually implement them well (read buggy as hell).

CLDC is a major gripe for me, CDC is very usable (but hardly anything supports it), CLDC has all the flaws of Java 1.0 when it could have been written to take advantage of improvements in the language ... *grrl*

There are times when I think that they need to seriously think about removing a large number of classes and just call any code that use them as 'legacy' (ie remove any Java 1 features that have been superceded by something better, see "Vector" as a classic example).

Thu, Nov. 2nd, 2006 04:41 pm (UTC)

i feel your pain. i will stick a thread in my left eye as soon as i get home.
(Deleted comment)

Wed, Nov. 8th, 2006 05:01 pm (UTC)
(Anonymous): Not fair

>> Wankers.

I don't think it's entirely fair on wanking to compare it to date handling in Java.

- Rich

Thu, Jan. 25th, 2007 04:58 pm (UTC)

I'm late in my reply. I'm not worthy. :)

but, try this:

/* Format: 2007/Jan/25 */
Date date = new Date();
SimpleDateFormat fmt = new SimpleDateFormat("yyyy/MMM/dd");

Better? :)