Archive for the ‘IT Stuff’ Category

Developer.com article on Code Reviews

Thursday, January 26th, 2006

There’s a worthwhile article on code reviews at developer.com at the moment called Effective Code Reviews Without the Pain.

Its a quick read, and the title says it all. The article’s focus isn’t so much on what your code review should cover, but how your code review should be carried out – how to make what can feel like a very adversarial, negative process into a postive, learning process. There’s tips for both the code reviewer and reviewee, with points like “Avoid ‘Why’ questions” and “Remember that the code isn’t you”.

Good, common-sense stuff. Its rare to find a development area that doesn’t use code reviews nowadays (even if only intermittently! ;) ), so it should be worth a read for most developers.

Comment on Slate Article – “Keeping Secrets”

Wednesday, January 25th, 2006

I’ve just read an interesting article at Slate called “Keeping Secrets“, where the author, a Professor Tim Wu makes some interesting points:

  • We have to assume that the US Government (and others) will one day succeed at getting at Google’s search data (which includes semi-identifying information like a searcher’s IP address)
  • While this identifying information has some value in improving the quality of search, that does not outweigh the potential privacy implications
  • Seeing as there is little hope in reforming the Government’s attitude towards protecting freedom, the public should demand this protection from Google and ask them to stop storing the information.

(This isn’t a complete summary by any means – I encourage you to read the full article to get the complete context)

Its an interesting argument, but overall, I’m not convinced. The point that jars me the most is the last one, which he puts thusly:

Recent events suggest that relying on the present administration to protect such basic freedoms may be, shall we say, unpromising. Other governments are just as bad if not worse. That’s why the public’s demand must be of Google—not the state.

That really strikes me as back to front. Democratic Governments are our representatives. Their job is to represent us. If they are behaving in a way that goes against our wishes, then we get to fire them (come the next election). In this age of massive election campaigns, spin doctoring and presentation over substance, that concept may seem a little idealistic – nontheless, that is the principle on which most Western systems of government are based. (I happen to be an Australian, not an American, but the same principles apply).

I’m also not convinced of the argument that the disadvantages of storing the data outweigh the advantages. While Google (and the other search companies) are doing this purely out of self-interest, I’m the one who eventually benefits – I get to find what I’m looking for quicker and more efficiently, in an increasingly disorganised Internet. If you like, I’m trading – “you get to see where I’m going, in return for you providing me with better service”. And importantly, if I decide that I don’t wish to do that trade (some, or all of the time), there are third party services (anonymising proxies) that will let me keep my identity cloaked.

Just my idle thoughts on a pretty weighty topic….

First impressions of J2ME development with Netbeans and the Mobility Pack

Monday, January 23rd, 2006

With my recent interest in J2ME development, I found the time to download Netbeans and the J2ME Mobility pack. I have to say I’m quite impressed.

I’ve downloaded both version 4.1 and the 5.0 Release Candidate (RC2). One of the first things that impressed me is they both perform quite well on my (slightly …mature) laptop. Once things start up, its all quite snappy. I can find Eclipse a bit laggy at times. Of course I haven’t really put these tools through their paces yet with any advanced projects – this is really just a summary of my first inspection.

The big drawcard though (for me) is the Flow Design screen. Here’s a sample screenshot:

NetBeans J2ME Flow Design

Basically, this tool helps you set up the skeleton of your applications. You drag all the different screens onto your workspace, and connect them to illustrate program flow. For example, the default project comes with a “Hello World” program that has an exit option. The screenshot above shows me inserting an “Are you sure?” screen when a user chooses “exit”. So, the exit option now connects to the new screen which presents them with OK and Cancel options. Cancel directs you back to last screen and OK takes you to the “Exit” state. Took me 20 seconds.

This is a great idea for mobile development – compared to a Swing application, a mobile app is likely to have large number of different screens/forms that all interconnect due to the limited screen real estate. This feature really takes the drudge out of that.

You also have a Screen Designer for placing widgets (“Items”) on your screen. Also great, although not as ground breaking as you may think – J2ME’s layout capabilities are pretty simple, so there’s less advanced formatting required (or even possible!). Very handy nontheless.

Once you have your rough architecture sketched out, adding your code is pretty straightforward – the generated code is reasonably clean and well thought out. Versions 4.1 and 5.0 differ slightly in their approach as to how you integrate your custom code:

  • In version 4.1, the generated code is “locked” and uneditable. One of the forms allows you to insert some code in the generated sections (with which you might do a “callMyMethod()”). You can then go to the code view and fill out the implementation. This feels a bit limited, especially as the form doesn’t seem to be able to do intelligent auto-complete.
  • In version 5.0, the generated code is “kind of locked” ;) . You can’t change it, but you can add to it. So, you generate your code structure, open it up in the source view and add whatever behaviour you want.

(At least thats the way it appears after a 15 minute look, without reading any of the help doco!)

I think it all looks pretty cool. The biggest thing holding me back is that I’m an eclipse guy, so I’ve got a bit of a hurdle getting used to the new user interface, keyboard shortcuts, etc. But its compelling enough that I’m going to have go at using NetBeans as my J2ME development tool, while still keeping Eclipse as my normal Java IDE. I’ll keep you posted as to how I go…

Doxygen – Javadoc for the C++ brethren

Thursday, January 19th, 2006

Typically, I work in Java. When I’m not working Java, I’m working Perl. Sometimes I even do work in Prolog (no, really!). But once in a while I venture into the C++ world.

I’m not a fan. Having my classes split across multiple files. Having the parent class decide what I can and can’t subclass. Trying to decide whether the caller or callee has responsibility for deleting an object. That said, there is a Perl-ish “Theres More Than One Way To Do It” (TMTOWTDI) thats kind of nice.

But with all the complexity inherent in a C++ program, documentation is all the more important. A work mate put me on to doxygen. It can be summarised as Javadoc for C/C++. Technically, its more than that – it can handle a range of languages and input files (even Java!), but the largest use appears to be the C/C++ arena.

Just like Javadoc, you create special comments throughout your source code, which get turned into documentation. And, you can insert special directives in these comments which have special meanings. Some favourite examples are:

  • @todo to flag a To Do item – your documentation will include a TO DO page summarising all these items
  • @version to detail what is in a particular version
  • @bug to flag a bug. Again, your documentation will include a bug page summarising all flagged bugs

In some ways, Doxygen is more powerful than Javadoc, out of the box. It can generate HTML and LATEX formats (Javadoc can do LATEX, but you need a custom doclet). The default pages show the class hierarchy, as well as providing links to the source code, neatly colourised and formatted. And most impressively, it can integrate with DOT from GraphViz to do graphical representations of the class hierarchy, as well as simple “has-a, is-a” type diagrams.

The flexibility comes at a cost – typically you have a big config file to tell Doxygen how to run (It reminds me of the “less is more” nature of Java versus C++ – Java may have less language features, but is more straightforward to debug and use as a result). And the nature of C++ in particular, with a class definition spread over multiple files can make some of the documentation decisions tricky: Do I put the method summary and method detail in the header file, or the cpp file? Or one in each? Whichever I pick, I always end up swearing once a coding session and having to flip around source files to find the info I need.

Niggles aside, this all makes C++ programming a lot more manageable. On larger projects, I can hand over the source to another developer and know they have reasonable documentation from the start. And on smaller projects, I can keep track of the issues, and architecture more easily. If only my IDE supported it, like Eclipse supports Javadoc…. :)

J2ME Development in Eclipse – EclipseME

Tuesday, January 17th, 2006

I’ve been playing around with some J2ME development lately (thus my earlier posts on Sudokulet). The whole process has been pretty painless, thanks in large part to EclipseME.

EclipseME is a plugin for Eclipse to let you use Eclipse for J2ME development. And it fulfils my idea of a good design by changing very little about my Eclipse experience. I use Eclipse like I always do – its just I’m using a different set of APIs and the end result will run on a mobile phone. But all the normal Eclipse-y things like refactoring, etc work as normal.

As well as making J2ME “just work”, it also simplifies some of those tasks specific to J2ME. JAD files in particular (which are used to describe various aspects of your J2ME Midlet) are given a special editor so you don’t have to worry about the format of this file, or its various permitted keywords.

Also of great use is the new right menu option “Run on Emulator” (and “Debug on Emulator”). Its really handy to be able to do this from within Eclipse, rather than have to get out of the zone (and the IDE). That was one thing that used to drive me crazy in my old days when I used nothing but the Sun Wireless Toolkit to develop in.

(A note for new players – you still need the J2ME libraries which you can get from Sun, but also from various mobile vendors like Nokia, Sony, etc. The vendor SDKs also include special emulators that are more “true” to their particular phones. EclipseME supports a variety of these, and I’ve never found one that I couldn’t get to EclipseME to play with at all. However with at least one version of the Nokia SDK, I couldn’t get the “Run in Emulator” to work. It wasn’t a total loss though – I configured a “Run External Tool” setting to accomplish almost the same thing).

The development of EclipseME is nice and active, and it also integrates with other tools. ProGuard can be used in particular to obfuscate (and thus shrink) your J2ME midlet – which gets all the more important on limited storage mobile phones.

So, well worth checking out if J2ME is an area you want to get into. Its not the only option though – in particular I’m reading great things about NetBeans with the Mobility pack. As I understand it, this offers a slightly different model of graphically showing you the Midlet’s life cycle – giving you the option of more of a graphical based development process. I hope to get some time to play with it – expect a post soon! And Nokia are getting into Eclipse in a big way – an Eclipse-based tool for developing native C++ code is due out soon, and theres been talk of them contributing J2ME tools to the core Eclipse project.

WordPress 2.0 plus….. Ads

Monday, January 16th, 2006

What a day! Upgraded the site to WordPress 2.0, and introduced Ads. Its a surprise I have any time to do my paid job!

Well, not that surprising. The whole exercise has taken around 30 minutes – love that! The WordPress upgrade is a doddle. The hardest part is doing all the backup steps “just in case” – the actual upgrade is soooo simple! (And, touching wood, after 4 WordPress upgrades I am yet to need my backup files :) ).

Hard to tell from the look of the site that much has changed, but the back-end admin is much improved. AJAX really lifts the bar for what we expect from web-driven apps nowadays. Deleting comments is particularly nice – seeing them go red then fade away is kinda fun, and really satisfying when it happens to be comment spam.

As an added bonus, the SecureImage plugin I use to get Captchas (a means of preventing comment spam) worked straight away with the new version.

I’ve had ads on my company web site for some time now, to support those resources I make available for free, so I was already a member of the AdSense program. I thought I’d trial ads on the blog as a bit of an experiment. I’m using the Adsense Deluxe plugin, which seems really nice so far – this post will be the first real test of it. It seems to be under active development – last update was only a week ago.

If nothing else, the experience has been an eye-opener about the size of the WordPress community. There’s a real wealth of extensions and experience out there!

Sudokulet 1.1

Sunday, January 8th, 2006

Sudokulet (a Sudoku solver for mobile phones) has now been upgraded to version 1.1.

The changes are pretty minor:

  • A proper “Exit” option. Some Nokias automatically add an exit option to a J2ME midlet but many devices do not… There is now always an exit option :)
  • An “About” option to get the version information, and web address for the product

The program is still free, although you have the option of making a small donation should you be feeling generous!

As before, it can be downloaded from the AITC web site at http://www.asman-it.com.au/products.html

Sudoku Solver for your Google Home Page

Sunday, December 18th, 2005

Now that Google have release documentation on how to write widgets (or “modules”) for the Google Home Page, it seemed only logical to port the Sudoku Solver across.

So, you can now sign into your Google home page, read the headlines, check your stock quotes, check the weather, and solve that Sudoku you were working on during the trainride in!

You can find the details here. As the page discusses, we (AITC) have some plans for a more fully featured Sudoku “workshop” in this format. But, in the spirit of “release early, release often”, we’ve decided to make this simple version available now.

My Sudoku Solver can also take calls…

Wednesday, December 14th, 2005

AITC has just made available the first version of “Sudokulet” – a Sudoku solver (and player) written in J2ME which, for the layperson, means you can run it on your Java-enabled mobile phone. At last, a use for the pesky mobile phone!

You can get it from http://www.asman-it.com.au/products.html.

Its an early version, but hopefully some people will find it useful, or at least entertaining for a short while…. :)

(And the observant will notice that the 6 year old Asman IT website has changed its look. I can’t really claim its changed for the better, but at least its different! And, thanks to the complete absence of colour, should you ever choose to print out a page, you won’t run out of one particular colour in your print cartridge ;) )

Farewall interactivity

Thursday, December 1st, 2005

Anyone who knows me will know thats it not such a good idea to try and set your watch by the regularity of my blog postings… ;) My enthusiasm (and spare time!) kind of comes and goes…

Nontheless, I spend at least a couple of minutes a day on my blog. Why? *&^*&^Y&*&^ Spam comments! Even though 99% of the comments go to moderation (depriving them of their valuable link count for search rankings), I still need to go in and clean them up. What seems to happen is their automated tools post an innocuous comment like “test” (which gets through the comment spam filter), and when they see that postings go online, they hammer away adding link after link (which goes straight into limbo, awaiting moderation).

When I have an infinite amount of spare time, I might try and get some captchas working. In the meantime, comments are now turned off. :(