Guest lecture on ‘Software Engineering Insights’

A month or two back I was contacted by Will Billingsley, a lecturer at the University of Queensland (which I happen to live pretty much over the river from). I met him at JavaOne 2010, given his interest in JavaFX. He asked me if I’d like to give a guest lecture to a class of third-year software students (specifically, CSSE3002 The Software Process). All up there was somewhere between 50 and 80 students, so it was a far bigger turnout than I expected (especially compared to back when I was in third-year a few years back). To quote Will’s initial email to me:

“Essentially we invite people from industry to pass on to students their wisdom and experience from producing software commercially.  The title for those talks this year is “how is software engineering more than just design, code, and test” – but you needn’t feel constrained by that — most guests use it as a segue into what they’d really like to talk about.”

“I thought you might be an ideal person to give a talk as your experience working in distributed teams, working on a product where the customers are other developers, and working on a team that’s survived changes in company strategy and ownership, would give you very valuable insights to pass on.”

I thought I was totally unqualified to give a talk, so I tried to push back, but Will convinced me. I decided to cover the lecture topic directly – I had nothing to sell or segue in to. Therefore, this was the first talk I’ve done in a really long time that didn’t have any code in it, which felt rather odd. Unfortunately, given how busy I am with my day job, I didn’t have a great deal of time to actually create a decent slide deck. I basically threw up a bunch of bullet points, and expanded on each slide over the hour or so my talk went for. I actually had enough content to cover another hours worth of topics, but I knew I wouldn’t have time to cover everything, so this is all I presented. Totally bad presentation-foo, but it’s the best I could do.

I doubt there will be much interest in the slides from most visitors to this site, but I thought for the sake of the students that I presented to that I’d post up a PDF of the slides here.

I hope in general that most other software engineers, who decide to read these slides, can agree with what I say. The suggestions are based on my experience – but I invite others to leave comments with their own suggestions and/or suggestions on where I’m wrong.

Firefox add-ons you should consider

I’m one of those people that likes to tweak my software to get it to work as well for me as possible. Firefox makes this very easy, as in most cases an add-on exists and it’s a simple matter of downloading it and configuring it. This post outlines some of my most favourite firefox add-ons – hopefully they may also be helpful to you. I’ll spend an inversely proportionate amount of time on each add-on, relative to how likely it is for you to already know about it. I also don’t plan to cover all of them.

Adblock Plus: Blocks annoying ads. Useful, but I’m waiting for people to tell me I’m cheating the Internet.

Blank Your Monitor + Easy Reading: One thing I really don’t like doing is reading white text on a black background (despite it theoretically being better for the planet, e.g. blackle). With this plugin, and a teeny bit of configuration, you can easily toggle any site you come across to use alternative colours, for example the more natural black text on a white background (or any other combination depending on what your eyes like to see).

Download Statusbar: Moves the download progress bars to the south of your web browser, saving you from having to have a separate window stealing focus / space in the taskbar. You can always bring up your old download window by ctrl-J.

Echofon: This is my preferred way of interacting with Twitter, given that it’s always visible in my browser, and doesn’t take up any further system resources. I have tried to use alternative, standalone applications, but I always feel more distracted with them as they pop out of my system tray. At least with Echofon I can ignore it when I’m in my IDE, for example. I imagine this is the exact problem with Echofon for many people, but it works well for me.

FaviconizeTab: Simple Firefox plugin to shrink tabs when double-clicked (or alternatively, but double-click is my preference), such that only the favicon is showing. I find this add-on incredibly useful and constantly have certain tabs set to automatically shrink when loaded. Very highly recommended.

FireFTP: This is all the FTP client I need, and once again it’s one less application I need to have installed on my system.

Read It Later: Want to know how I collect my list of Java desktop / JavaFX links of the week? I just store them all on Read It Later and load them all up each Monday morning. This is a great tool for this purpose, as it’s quick, does what it needs to, and doesn’t get in the way. If you are like me and always coming across interesting sites / articles to read, but don’t have the time to read them right now, just store it in Read It Later and load it up when you have a spare minute.

TabGroups Manager: Often times I have a tonne of tabs open, but they are split between bug reports I’m working on, work stuff, news sites, etc, etc. Often there are logical groups, and this add-on allows for exactly this. You basically get another row of tabs in Firefox, within which you can open other tabs. This allows for you to have a tab for bug reports, a tab for news / time wasting, a tab for work stuff, etc. Whilst it does cost you a few extra pixels of vertical chrome at the top of your Firefox window, I think it pays for itself if you’re anything like me.

My Firefox Chrome
My Firefox Chrome

Tiny Menu: I’ve rearranged my Firefox chrome quite a bit. In fact, you can see what it looks like to the right. You’ll note that rather than have the traditional ‘File’, ‘Edit’, ‘View’, etc, that I instead have collapsed this down into a single ‘Menu’ menu, which when clicked will show all other menus. I justify this simply by realising how infrequently I need to access these menus. Tiny Menu allows for precisely this functionality, and with a bit of toolbar rejigging, you can easily get back the space taken up by the TabGroups Manager. Of course, if you don’t need the TabGroups Manager add-on, you’ve just got a free ~25 pixels of vertical space that can go towards website content, rather than wasteful browser chrome.

Stop-or-Reload Button: You’ll note in the screenshot I don’t have a stop button. This was initially just because I had deleted it from the toolbar entirely, but then I came across this add-on that does the Smart Thing (i.e. what Google Chrome does I believe). This plugin hides the individual stop / reload buttons, and instead has just one button that shows the stop button when the page is loading, and the refresh button when the page has completely loaded. That’s one less button to have on the toolbar.

I thought I would end by mentioning that I make use of the Chromifox theme, which is basically a Google Chrome knock-off, but it looks clean and simple.

Finally, for what it’s worth, you’ll also note in the screenshot above that I’ve done away with buttons that I don’t need from the toolbar as well. You should seriously consider looking into this – you can get to the toolbar options by right-clicking in an empty space and choosing customise. You’ll be surprised what you don’t actually need.

Well, that’s it for now. I hope that this list helps others, and perhaps it’s a bit more useful than the all too common “Top 100 Firefox add-ons that you aren’t using” lists that seem to pop up all the time. Feel free to leave your thoughts in the comments of other add-ons you like.

Control iTunes using keyboard media keys

Just a quick post: I have had a really bad programming itch ever since I got my new Dell laptop recently. It has a row of media keys to go back, forward, play/pause and stop my music. Unfortunately, these keys only work when iTunes has the focus, which kind of sucks. I decided, finally, to do something about it, and wrote a small program that lets you control iTunes using these media keys, even when it doesn’t have focus. The program lives in your system tray, and you can exit it by right-clicking on it.

There are a number of issues with it, and things I could improve, including:

  • It only works on Windows.
  • It requires Java 6.
  • It only works on x86 computers, although if anyone wants, I can make it work on x64 with a little testing.
  • It allows for multiple instances to be run, meaning that if you have two instances running, clicking back on your keyboard will take you back two songs.
  • It doesn’t give any song notification, etc – it is just a controller. If people really want song notification, let me know.

As you should note, the amount of code written is actually minimal: this project is mostly just tying together two other libraries, and of course the iTunes COM interface.

There is a zip file here that contains everything – libs, source code, and a batch file that you can use to start the program. Normal lazy programmers license applies: if your computer crashes and burns, send me photos, but please no complaints. If you use it and (dis)like it, let me know!

Jonathan Giles

Java Swing 2.0

I believe that there is a need for a proper Swing 2.0 which is not JavaFX-based, but a true, desktop focused, Java (the language)-based framework. My vision is one shared by numerous others, and in a brief discussion (via twitter no-less), a number of us enumerated what we believe a Swing 2.0 needs. The following list is a brief overview of what Swing 2.0 should be:

  • Generics-based. No more should we put our objects into various Swing data models and components only to receive Object back. It should be possible to create swing data models and components with the data type specified. There is work in this direction already with the Swing-generics project, although progress is slow. Swing 2.0 should include this project instead of duplicating work.
  • Support for enumerations where obvious. There are numerous places where public static final ints could be replaced by enumerations. This leads to a cleaner API.
  • Support for varargs. Once again, there are places where varargs could be used to clean the API.
  • Improved support for collection frameworks. That is, we should not still be requiring Vector lists, unless syncrhronization is absolutely necessary.
  • Stricter enforcement of event dispatch thread (EDT) rules. Swing is slow (or so the saying goes). This is untrue, but is unfortunately the perception. This perception exists because developers don’t understand how to deal with the EDT. There exists code out there now that can enforce the rules surrounding the EDT by essentially throwing exceptions when components are handled off of the EDT, and when tasks take too long that should not be run on the EDT. By default, Swing 2.0 would enforce EDT checking, throwing all exceptions discovered. This may make developers unhappy, but the end result is better programs and happier users. It is worth it.
  • Improved support for bean binding and validation. I won’t go so far as to say we need properties, largely because I don’t know enough to have an informed opinion, and I know that by saying we need properties Swing 2.0 instantly becomes far less possible without major Java language updates. But, I know that projects such as the JGoodies beans binding and validation tools are very useful, and make creating data-driven user interfaces far easier and rapid. It may make sense to incorporate these kinds of frameworks into Swing 2.0 to enable users to focus on the business logic, and not getting data to and from the user.

What you may note is missing is any mention of new components, new Look and Feels, etc. That is not my interest – in my opinion Swing 2.0 is a cleanup of the code beneath the existing Swing components. It would be ideal if Swing 2.0 could be API compatible with Swing 1.0, but I would not be adverse to Swing 2.0 becoming a separate Swing library in its own package (i.e. javax.swing2). This would allow for API cleanups, and repurposing of existing API method names.

What  do you think? Do we need a Swing 2.0 that has the roughly the above features (make any suggestions you have). Is it too little too late for desktop Java (personally I think not, obviously)? Please, leave any comments or thoughts that you may have – let’s get the discussion started.

Advanced Java

As I think I noted recently, I’ve been doing study towards a Sun Certified Java Programmer (SCJP) certification. It is progressing well, and I’m learning a lot. I really should publish the study notes that I’m hand writing as I learn new things some time…

Anyway, I thought I’d link to a few documents that I have read recently that are quite interesting.

The first document discusses Java generics, introduced in Java 5. Most people get the basics, but there are some interesting issues with generics such as erasure, wildcards, and generics inheritance. This is a very good article to read if you are programming in Java 5 or later (which you should be if at all possible!).

The second article is shorter, but discusses convariant return types, and how Java 5 changes the rules compared with earlier releases. Once again, very interesting if you wonder what the rules are when it comes to overriding methods in Java 5 and later.

Unfortunately I haven’t been keeping track of earlier documents, so I have no more links – but I’ll try to keep posting any interesting documents here in the future.