import flamewar.*;
Marc Portier discusses the current recommended practices for import statements in Java. This is a never ending argument that is so completely irrelevant to development that only fools get involved in it. So let me jump into the argument. The rule is very simple, always use .* until you hit a conflict then add the appropriate specific import. Mostly with my code that means you wind up with:
import java.util.*;
import java.util.List;
import java.awt.*; Why is this rule in place? Because my time is more important than some fool who doesn't either use a half decent IDE or know the APIs well enough to guess where a class is. I don't think about import statements when I'm coding – I've got better things to think about. Every time I hit compile and get an error back (or get a red squiggly underline in the code) that amounts to “You're missing an import statement” it's a waste of my time. I hit control-shift-O the import is added and I get back to being productive. If I use specific imports that interruption happens every time I use a new class, if I use .* imports, that interruption happens every time I use a new package. The interruption is even worse for the people who don't use an IDE because they have to manually navigate to the top of the file, add the import and then find where they were again. I'm doing them a favor! If you don't like my rule, that's fine. Just hit control-shift-O or your IDEs equivalent and it will reformat the imports to however you prefer them. While you're there you may want to hit the reformat button and the position of braces will be what you want too. What? Your IDE doesn't do that? Tough.
Egos And Opensource
It’s incredibly sad when people let their egos get in the way of developing something useful. I haven’t run into this in Apache yet but I’m seeing a really bad case of it in the on-going quest to create an opensource replacement for HyperCard, Apple’s now abandoned rapid application development system. There are now four or five different projects each struggling to get something up and running, none succeeding because the developer resources are stretched so thin. Even my latest efforts to get them to work together by saying I’m happy with any language, any architecture – just get a 1.0 out the door has been shot down because people are so insistent on writing it all themselves and doing it precisely their way that they’ll cut off their own nose to spite their faces. I’m very much on the verge of giving up on the whole idea to be honest. I’ve got enough skills in Java that something like HyperCard isn’t exceptionally useful to me anyway – I’m not sure I should waste any more time trying to create something like that anyway. It’s sad though, HyperCard is the best way I’ve ever come across to get people interested in programming and start them learning and thinking about what their computer can really be made to do. No other language provides that kind of opportunity for creativity and power to Joe User.
Profiling and Optimization
Recently there has been a very interesting and at times heated discussion about optimization on the HUMBUG mailing list. It’s worth reading the archives (look for the “Which is better?” thread) to get the whole picture.
There were two main topics being discussed:
- Whether you should look for optimizations as you code and implement them if they don’t affect readability and
- Whether or not memory allocation in Java is slow and thus efforts should be taken to avoid it.
Issue 1 – Premature Optimization
Inside The Loop or Outside The Loop?
Most people argued that premature optimization is the root of all evil, and that in Java particularly it’s a waste of time because you almost always predict what the compiler and the JITC are going to do incorrectly. There were a couple of people (one in particular) who thought that optimizations that didn’t affect readability were a good idea. The example:
To The Shows!
So I made the mistake of checking out VISA Preferred Seating, promptly followed by QTIX, promptly followed by spending money and wanting to spend more. I’ve booked tickets to go see The Carer staring the delightful Charles “Bud” Tingwell. I very nearly managed to go see it in Lismore on my recent road trip but the uncultured locals didn’t even realize they had a theatre let alone be able to give me directions to get to it. Sadly the fact that noone knew there was a theatre would have significantly improved the chances that there’d still be a ticket left, but alas despite searching every publicly available map in the town and driving around for an hour or two, I couldn’t find the theatre either. The other shows I’d like to see are:
Stupid Systems
Every so often you come across a system that is just ridiculously stupid. Telstra’s</a billing system is one of these. It means well, but just gets in the way. The particularly problematic feature is the fact that if checks to see if you’ve already paid the particular bill you’re trying to pay and warns you if you already have. That would be great, except for two major flaws: 1. It warns you even if you haven’t paid the bill already. 2. The “I know what I’m doing and you’re just a stupid computer” button, which suggests it will process your payment anyway, just loops you back round to the warning page that you may have already paid the bill before. This makes it impossible to pay your bill online. So I pick up the phone and fight my way through their phone payment system, and finally after narrowly avoiding being bored to death by the slow talking recorded voice, I successfully pay my bill. That slow talking recorded voice then tells me how much faster it would have been if I’d paid online. Sigh.
The Proprietary Catch Revealed
It seems that the proprietary hooks in .Net are becoming more and more clear. This Netcraft interview with Miguel de Icaza ends with the comment:
Longhorn has kind of a scary technology called Avalon, which when compounded with another technology called XAML, it’s fairly dangerous. And the reason is that they’ve made it so it’s basically an HTML replacement. The advantage is it’s probably as easy as writing HTML, so that means that anybody can produce this content with a text editor. This is the great proprietary catch that ties .Net solely to the Windows platform. No language is useful without a solid set of libraries to work with and the best libraries for .Net (XAML and Avalon) will be Windows only and managed solely by Microsoft, not a standards organization. It’s not like people haven’t warned about this before though…. Some people still think they can get a good deal out of the devil.
Spamassassin Knows Me Too Well
Continuing my spam theme of late. Today I received a message from “* Rochelle *” that wound up in my inbox. Since I have so many carefully crafted filters to dump mail in the appropriate mailbox anything that winds up in my inbox is immediately suspected as spam that spamassassin missed. This message hit massive alarm bells in my head and I just couldn’t work out why spamassassin had missed it. The subject line was “hey!!!” and the body of the message was bright pink with embedded images that Mail.app had blocked. Worst of all, it was from a hotmail address similar to “I’m your lollypop”. Naturally that first quick glance was enough for me to start dragging it to the spam folder. While doing so I fortunately noticed the phrase “Tom’s birthday party” and it just seemed too much of a coincidence considering I’d attended my cousin Tom’s birthday party a couple of weeks ago. Turns out the mail was legit and from someone I’d been waiting to hear from for a fair while. The moral of the story – trust in spamassassin. Or maybe, look before you hit delete as spam. Or maybe that you shouldn’t use hotmail addresses that include talk of lollipops along with HTML email and bright pink backgrounds. Yeah, definitely don’t do the pink background thing…..
More Spam
Richard Giles comments on SpamSaver, one of the worst ideas I’ve heard of in a long time. Essentially SpamSaver aims to feed a massive number of useless email addresses into the spammer’s database making it all but useless and swamping them with bounced mail. Sadly, the flaw lies in the last part – the spammers don’t see the bounced mail – the poor sap who’s email address they forged does. PLEASE don’t contribute to more of this “bounce-spam”, it’s already reached the point where I receive more bounce messages than I do actual spam. Mostly that’s from virus bounce messages, but an increasing amount is from spam bounce messages too and things like SpamSaver will only make that worse. So please don’t use SpamSaver and if you’re a sysadmin configure your servers to never send automatic emails for any reason. I don’t care if the email address doesn’t exist, I don’t care if the message had a virus and I really don’t care if the person is on vacation. Unless you can be 100% sure that the From: address is real (which you can’t) don’t send mail to it.
Road Trip!
It’s a long weekend here in Australia for ANZAC day so I’m considering going on a road trip. Not sure where I’m going yet, but my last road trip took me down into northern New South Wales and I’m thinking of heading down that way again – I figure my random selection of which way to turn should take me somewhere else this time (I don’t actually own a map of anything outside of the Brisbane region). I’m considering trying to get to a national park I vaguely remember around there, but I can’t remember the name of it or where it is so I’m not sure how much success I’ll have with that plan. Anyone got any suggestions for places to go for a day trip or possibly an overnighter around Brisbane?
Just What Iraq Needs
With all the crisis and the shooting and the killing in Iraq, it’s good to see that the American military has found a solution: an upgrade to Active Directory. I mean, once the Iraqis see how much better their life is with Active Directory instead of Windows NT 4 based networking, they won’t care if their home has been blown to smithereens, if their children have been shot and if they’re starving to death. Cue music What the world, needs now. Is Active Directory. It’s the only thing, That there’s just, Too little of….
Spam
Ian Holsman comments on a vacation responder that deletes all incoming email to avoid their mailbox overflowing while they’re away and asks if email is dead. The answer is a clear no. Email is now a critical system, it just can’t be killed, perhaps morphed into a different set of protocols but the concept of sending mail electronically just can’t die, unless you count being replaced with sending video messages electronically as killing email. However, email is no longer a time saver, it’s a great time waster. It’s a chore that you have to put up with to stay in business or to stay in touch with your widely dispersed friends. With the recent demise of our exchange mail server I’ve had to change the way I filter out spam which requires training up a new spam filter and in the process receiving massive amounts of spam. I honestly never realised just how much spam I received until I suddenly didn’t have a filter in place to get rid of it. Without that filter, email is completely unusable and with a poorly trained filter it’s a great waste of time. We’ve now outsourced our exchange server and I can go back to happily using SpamBayes with Outlook. I’ve run it over the 14000 stored spam messages that I managed to recover from our dead exchange box (massive amounts of real email got nuked, but the spam survived….) and trained up the new filter, but it’s still not as good. I’m not sure why. I’ve also found that when you receive large amounts of spam the best thing you can do for your productivity is turn off the new email notification. Noone notices if it takes you 30 mins to reply to an email instead of 5 mins and by turning off that notification you’re no longer interrupted by spam messages (or real messages) every 1-5 minutes. You check you’re email when you want not when it wants. Also, by leaving your email open you still have a reminder on screen to pay attention to email every so often and it’s quick and easy to bring the window back up and check if you have new email. The other thing you need to do is have a really huge amount of space available in your mailbox, whether that’s achieved by actually having a large mailbox or just having a fetchmail (or similar) process running to constantly download your mail to your own computer for storage, it’s got to be there. That avoids the problem of spam filling up your in box. Finally, train your spam filter to treat any bounce message as spam and discard it. At least 50% of the unwanted email I get is actually bounce messages either for incorrect addresses or virus detection notifications. If you’re a system administrator, turn off all bounce messages, they no longer serve any useful purpose and are just clogging up people’s inboxes.