Thoughts about software development

Archive for July, 2006

I know there are hundreds of World of Warcraft screenshots out there, but it
just so happens that I felt compelled to take two of these myself within a
half-hour time, which is rare enough, so I thought I’d share my experience (and
said pictures).

I took these two screenshots in Alterac Valley, which is one of WoW’s three
player-vs-player (PvP) areas. In these areas, members of the main two
factions are pitted against each other and assigned certain goals. In
Alterac Valley, the goal is to conquer the enemy’s fortress and kill its general
before your opponents do the same.

Alterac Valley is a big battleground with various buildings and constructions
that you can choose to conquer or skip, depending on your strategy. The
Alliance put up a good fight in one of their advanced bunkers and it took us
numerous attempts to finally capture it. The fights were fierce and all
classes of combatants were involved. I died several times myself along the
way, but since the graveyard was nearby, I was able to come back and continue
the fight.

Finally, we were done, and when the flag eventually converted to our color, I
emerged from the bunker, still pumped with adrenaline and ready to move on to
the next target, but the landscape outside just stopped me in my track.
The moon was rising behind the hills and a pond way down below the valley was
reflecting its silvery rays. The entire scenery looked so peaceful and it
contrasted so starkly with the intense scrimmage I was just submitted to that I
paused and took this picture. The two blue banners in the distance are set
on the Alliance fortress, which is our next goal.

The moon rises over the Frost Wolf FortressClick for the large version (3 megs)

There are various ways you can make the fight for Alterac Valley more
interesting. One of them is being able to summon various elite characters
or animals that will help you in your fight against the other faction. You
need to fulfill certain conditions before you can do this (such as turn in items
collected on the dead bodies of your enemies), but once you’re done, it’s
definitely worth making a quick run for the altar and do the summoning.

While the Horde can summon a creature called the Ice Lord, the Alliance can
invoke the help of Gryphons, which hover high above the fight scene and have the
ability to cast a powerful knock back that will throw all the troops under it at
a distance. It doesn’t harm anyone, but it causes chaos that is very
valuable to the attackers.

The Gryphons fly so high that you usually never notice them until you feel
yourself lifted in the air for no reason. This is exactly what happened to
us during that fight and the group reacted immediately by concentrating their
firepower to the harmless-looking creature flapping its wing over our heads.
Again, the sight was so taking that I stepped back on a nearby hill and snapped
several pictures to immortalize the instant…

A Gryphon becomes the target of a Horde group in Alterac ValleyClick for the large version (3 megs).

Say what you want about World of Warcraft, but I have yet to come across a
game that, one year and a half after I started playing it, is still making me
live such intense and gratifying moments…

The game of the week is Dice Wars. It looks a lot like Risk but with simpler rules: your armies are dice, and when you attack another country, all the dice involved are rolled. If you lose, all your dice but one are eliminated, and if you win, all your armies but one move to the conquered territory.

That’s it.

Well, almost: after your round, you receive a new supply of armies based on the number of conquests, which are then randomly assigned to your countries (and incidentally, I still haven’t figured out how this number is calculated, so if you know, please share!).

Don’t be fooled by the simplicity of the rules, as they allow for some singularly sophisticated strategies. For example, you might be tempted initially to pick a pile of six dice and plow through enemy territories until you run out. This will get you a nice supply of new armies, but it will also leave a wake of countries protected by only one dice, which will undoubtedly be taken back by the opponents at the next round (which will also allow them to insert a wedge through your possessions, another bad thing). However, you also quickly realize that a pile of eight dice is useless if it’s only surrounded by friendly territories, so in some way, you want to invite the enemy to come nearby so you can unleash your stockpile…

The game allows for two to eight players, but I strongly recommend starting with four and work your way up from there…

A lot has gone into this release, and instead of boring you with a standard
product announcement, I thought I’d try something new by giving you not only the
list of the new features (at least the most important ones) but also a quick
explanation why this feature was added. Read on, because this is no
unusual product announcement!

Let’s start with a quick overview of the main TestNG 5.0 features:

The configuration annotations are now called @BeforeTest, @BeforeSuite, etc…

The reports are now created in their own directory (one per suite) and a main index file shows a list of all the suites that were just run.
They have also received a series of improvements in appearance and content.

It is now possible to specify the suite and test names directly in the@Test annotations, which allows you to do without a testng.xml.

expectedExceptions has moved inside @Test.

TestNG shows you friendly stack traces.

Lightning Bolt: Mana cost reduced approximately 17%.

Okay, I was just kidding about that last one. Just making sure you’re
paying attention.

Let’s go into details now.

Configuration annotations

In the early days of TestNG, the idea of an annotation that would indicate
that a method has a special role was obvious to me. What was not obvious
was: what should it be called? Believe it or not, I was already
hesitating back then between @BeforeSuite and @Configuration(beforeSuite
= true). That was two years ago.

I could find virtues in either of these approaches, but I eventually opted
for the latter because of IDE support. I thought that if all the
configuration options can be gathered under one convenient annotation, it would
be very easy for an IDE user to have a list of everything that’s available:
they can just type @Configuration(<ctrl-space> and they would get the
full list.

I still think this argument holds, but one can argue that it’s equally easy
to type @Before<ctrl-space> to get a list of all the "before types"
that you can use. On top of that, the newer style has two extra benefits:

It’s less verbose (compare the two versions above).

It is more obvious that configuration annotations should not mix with
each other. That’s a downside of the approach I initially chose:
while it is legal to specify several booleans (@Configuration(beforeSuite
= true, beforeTest = true)), it doesn’t make a lot of sense, and the
shorter version makes this a bit clearer.

Of course, the old annotations are still recognized, but they are now
deprecated.

New report structure

While TestNG lets you invoke multiple test suites easily (e.g. java
org.testng.TestNG testng1.xml testng2.xml), the reports didn’t maintain
this distinction and bunched up all the results in the main output directory.
I thought I would take advantage of this release to clean up this structure and
have each suite create its reports in its own directory (named after the suite
name). Additionally, the output directory now contains a single
index.html that gives a composite view (and links) of all the suites that
were run along with their outcome.

Also, the reports are now using a CSS file and their appearance has been
improved. They also contain additional information, such as a pointer to
the testng.xml that was used for a particular suite.

suiteName and testName

These two attributes belong to the @Test annotation and they can be
used as follows:

This feature will be of interest to users who don’t want to use a testng.xml
and, instead, prefer to use the command line or ant to invoke their test suite.
With these two new attributes, these users can now get the benefit of seeing
their test suites end up in a specific report.

Of course, classes that use these attributes will have their reports
generated in the structures as described in the previous paragraph.

expectedExceptions

This attribute used to have its own annotation (@ExpectedExceptions),
but it was pointed to me that this annotation made little sense if it wasn’t
coupled with a @Test annotation, so this was definitely a design
mistake that needed to be corrected. As of 5.0, @ExpectedExceptions
is deprecated and you should now use the new expectedExceptions
attribute from @Test:

This was another heavily-requested feature. Whenever a test fails, it
does so with an AssertionException which shows the entire stack trace, including
TestNG’s internal frames, reflection, etc… These stack traces will now
be hidden by default so that the report only shows what you really care about:

Before:

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:396)
at java.util.Properties.setProperty(Properties.java:128)
at org.testng.xml.XmlSuite.toXml(XmlSuite.java:318)
at
org.testng.reporters.SuiteHTMLReporter.generateXmlFile(SuiteHTMLReporter.java:81)
at
org.testng.reporters.SuiteHTMLReporter.generateReport(SuiteHTMLReporter.java:72)
at org.testng.TestNG.run(TestNG.java:613)
at
test.configuration.BeforeTestOrderingTest.verifyBeforeTestOrdering(BeforeTestOrderingTest.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:411)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:785)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
at org.testng.TestRunner.privateRun(TestRunner.java:687)
at org.testng.TestRunner.run(TestRunner.java:567)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:242)
at org.testng.SuiteRunner.run(SuiteRunner.java:148)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:899)
at org.testng.TestNG.runSuitesLocally(TestNG.java:861)
at org.testng.TestNG.run(TestNG.java:611)
at org.testng.TestNG.privateMain(TestNG.java:999)
at org.testng.TestNG.main(TestNG.java:936)

There is something really beautiful about transparency on a computer screen.
I can definitely remember the shock of seeing transparent waters in Far Cry or
some of the numerousoperatingsystems that support alpha-blending. But
the sad truth is… it’s never worked for me.

I’ve tried to use transparency in many different ways (transparent terminals,
transparent dialogs, etc…) but it always ends up looking ugly, and I always
end up making all my windows opaque again. Maybe it’s because I’m a
proficient windows switcher and that I can do so extremely fast with keyboard
shortcuts, but the bottom line is that the few times when a window is partially
obscuring another window that I’m trying to read, I find it faster to Alt-Tab
twice than trying to make sense of the blended backgrounds.

But maybe it’s just me…

Are you using transparent windows on your desktop? How? (and feel
free to post links to screenshots if you have any)

I’d like to come back to my initial observations on Mac OS’ handling of window management because the more I figure it out, the less it makes sense.

You will notice that comments on my initial blog entry on this topic are usually along the lines of “I use Exposé all the time, I’ve never had any problem” and “Just use the right side of the dock, that’s what it’s for”.

The problem is that both these answers are wrong, and I’m beginning to understand why. The first hint I got was my realization that sometimes, pressing Alt-~ would only cycle through three FireFox windows while I’m pretty sure that I have more than six windows open. Where did the other three go?

And then, the same remark with Exposé: I know I have six windows, why do I only see three when I press F9?

The answer is probably obvious to Mac OS veterans but baffling to anyone else: Exposé and Alt-~ will only show you windows that are not minimized. If you want to pick a window that was minimized, your only choice is to click on an icon on the right side of the Dock.

This is bad for two reasons:

There doesn’t seem to be any keyboard shortcut for selecting a minimized window (this is part of a more general problem: Mac OS is quite hostile to keyboard shortcuts, which is very irritating when you are a proficient Windows keyboard user).

If you are looking for a window, you first need to remember if you minimized it or not, and then you know in which location you should look for it.

This latter part is really a momentous UI error, and it’s known in the UI field as a “mode”. Modes have been deemed evil a long time ago and most modern UI interfaces avoid them like the plague, Windows Office applications being a pretty good example of how to achieve that goal. When your application has a “mode”, you are putting a burden on the user and you are forcing her to remember what the current mode is before she can decide what a certain command is going to do. One of the first (and worst) offenders is the famous vi, on which every single letter will have a different action depending on whether you’re in edit mode or not.

This also explains some of the comments I have received on my previous entry, such as “I rarely ever minimize, I just leave all the windows open all the time”. I initially thought the person who wrote that was kidding, but I know now that he was serious, and the reason is obvious now: when you have a mix of minimized and open windows, finding the right one becomes a challenge, so your only bet is to always minimize or to never minimize. Coming from Windows, this is a philosophy that’s extremely hard to embrace.

I understand the initial intent of trying to separate “applications” from “documents”, but this metaphor is completely broken nowadays. Is a FireFox windows with many tabs open an application or a document? Well, this is actually the wrong question, you should really ask “Did I minimize that window last time I saw it or did I just move it in the background?”.

Again, Windows gets it right by putting all the windows in the same stack. Whenever you need to look for one, you look in one place, and some third-party utilities let you refine your search.

Well, to be honest, Windows only gets it partially right as well, since it won’t let you narrow down your search to only windows of the current application, hence my confessed love for TaskSwitch XP.

The ultimate window switcher?

So what’t the solution to this window management mess on Mac OS? There actually is one, and interestingly, it was never suggested by any of my expert MacOS buddies: if you right click on the icon of the application on the Dock (the left side, not the right side), you will get a list of all the open windows, minimized or not.

Right-click for the win!

This is exactly what I need and my experience with window switching has become a lot smoother since I discovered this.

It’s not perfect, though, and this leads me to my second main gripe with MacOS X, which I will address in the next entry. Until then, feel free to share how you switch windows on Mac OS in the comments, since I’m really curious to learn about the working habits of veteran users.

I have recently been “forced” to start using a Mac Book Pro, so I thought I’d take this opportunity to write down a few notes as I begin my journey toward a world that’s supposedly filled with milk and honey. But before I do that, let me say a few words on my background, so you know where I’m coming from.

I’ve been using computers pretty much since the age of 10 and since then, I have moved from programmable HP calculators to small computers (PC-1211 anyone?) then Apple ][, Amiga and finally, Windows pretty much ever since. I have spent a lot of time on Linux as well in the early days (back then, we were already saying that Linux was going to break through any day now) but gave up on it in despair five years ago after I realized how much it was stagnating.

At my work, I now find myself constantly switching between Windows, Linux and Mac OS. And I’m not exaggerating. I’m using at least two of these operating systems every day and more and more often, all three of them.

Finally, I don’t succumb easily to the fan syndrome and I try to keep a technical and objective judgment on everything.

Now that this is out of the way, here are my impressions after one week of diving into Mac OS.

I can only resize from one corner and the cursor doesn’t change. Windows has let me resize windows from all four corners and even from all four edges of windows since the early 90’s. What’s taking Apple so long?

Overall, Mac OS shows an extreme lack of affordances. For example, the menus on the top right corner of the menu bar
1) don’t look like menus at all (they look like icons) and
2) when you move your cursor over them, you still have no idea that a menu will unfold if you click them.
This inconsistency is even more surprising considering that the close/minimize/maximize icons in the top left corner have a hover animation when you move your cursor over them

QuickTime is as crappy on Mac OS as it is on Windows. It’s impossible to maximize the window, it doesn’t give you any indication of the total length of the movie, it doesn’t let you bookmark your views, it has the infuriating menu items preceded with “Pro version” that you can’t pick (they probably took a page off Real’s book… nice. How about a little of “Do no evil”?). In short, the simplest Windows open source player you can find on sourceforge, such as Media Player Classic, run rings around QuickTime. For now, I have switched to VLC, which supports Full Screen but unfortunately, is not recognized by the remote.

Front Row and the remote control look neat, and I still hope I can get VLC to work with them.

QuickSilver is nice, but no better than Google Desktop Search. Actually, GDS is better in my opinion because it also acts as a file searcher (for which I need to invoke SpotLight).

Not being able to maximize a window fully or even in a consistent manner is driving me nuts. Some applications maximize at half the screen, forcing me to resize them, and others will… well, do whatever they damn please. Apple should buy a Cooper book and read up on the concept of sovereign applications.

Mac OS forces me to double click everywhere. I haven’t double clicked on my Windows desktop since 1995, when Active Desktop came out. Fitt’s law and double clicks were revolutionary findings when the first Mac came out in 1984, but come on, this is 2006. We know how to select a menu and countless studies have proven that double clicking was one of the most confusing features of today’s user interfaces for new users. It doesn’t have to be the default, but at least, let me configure this, like Windows does.

MacOS is very schizophrenic with respect to the Control and Apple keys. For example, bold on Word Mac is Apple-b while the rest of the world uses Control-b. And actually, quite a few other programs on the Mac use Control-b for bold. Eclipse uses Apple also everywhere instead of Control.

Having said that, it was easy to remap Caps to Control. Even Windows XP still doesn’t know how to do that without a third party program. Also, I have to admit that the Apple button is a better location than control is, but the train has left the station on that one and 98% of the population is used to having their control button under their pinky.

The Alt key doesn’t work on XEmacs (a define-key will probably fix that).

The Alt-Tab behavior takes some time to get used to. As opposed to Windows, Alt-Tab only switches between applications. Once you are in the desired application, you still need to use Alt-~ to select the right window. This would be acceptable if Alt-~ gave me a minimized version of the various windows available to me, but it doesn’t: it raises all the windows to the foreground one by one. This is not only annoying (since it messes up the Z-order of your windows), it’s actually downright silly and completely inconsistent with Alt-Tab. I can still select the individual windows in the right part of the Dock, apparently, but I still want to be able to do this from the keyboard. In short, switching windows on Mac OS is a pain. The ultimate task switcher in my opinion is Task Switch XP, which lets you switch between all windows but also allows you to switch windows only within the current application with a different hot key (Alt-Control-Tab).

The Mac Book Pro is hot. Very hot. And I don’t mean that metaphorically. It is hot as in “put it in your lap for a few hours in a row and you’ll go sterile”. Use a protection on your lap if you are going to use your Mac Book Pro for extended periods of time.

There is no right mouse button on the laptop. Are you kidding me? Yes, I know that you can plug in a mouse and the right button will work right away, but I never use a laptop with a mouse, so I find myself doing the insane Control-click all the time. This is preposterous. And coupled with the absence of a Delete key (see below), I am finding myself doing finger aerobics much more often than I should.

The keyboard backlighting doesn’t work at all. If anything, it makes the keys less readable. Which also mades me realize that I am looking at the keyboard, something I haven’t done in more than ten years. Hopefully, I’ll be familiar enough with this new keyboard soon and I’ll stop looking at it like I did on Windows, but until then, I turned keyboard backlighting off.

Mixing up the quicklaunch bar and the taskbar is a mistake. The little arrow under the icons to indicate which ones are open are confusing, and I find Windows’ solution (two separate and distinct-looking bars) much more intuitive and more practical.

Speaking of the Dock, I can click on an icon to show the window for that icon, but if I click again, nothing happens. I’d like the window to be folded back in the Dock when I do that. Right now, I have to go to the window and click on its “Minimize” icon.

And while we’re on the subject of minimizing, there doesn’t seem to be a shortcut to minimize a window from the keyboard (it’s Alt-space-m on Windows, and I use it all the time).

The backspace key is called “Delete” but it really means “Backspace”. I miss my Delete key, I used it all the time on Windows to delete files and folders, and right now, I have to use the insane Control-Click to do these simple operations.

Okay, that’s it for today, and that’s just after one week of usage.

While Mac OS contains a decent number of tools for power users (I really love having a native UNIX shell on my laptop), its newbie-oriented interface still shows in a lot of the operations that I do on a daily basis: big fonts, big colored buttons, primitive task and window switching, shortage of keyboard shortcuts (e.g. minimizing a single window), double clicks everywhere, no delete key, no right click, etc…

Unfortunately, Apple hasn’t really shown any good sign nor will to modernize their operating system in these various areas. This might not be a bad idea, since the biggest audience remains the casual user, but until these details are addressed, Mac OS will never be the ultimate hacker operating system (which remains Windows, in my opinion).

Finally, I’d like to say that despite these gripes, the experience has been fairly pleasant so far and I’m looking forward to exploring Mac OS further, but this initial foray shows that while Mac OS has some distinct advantages for hardcore geeks like me, it’s still not the ultimate combination of hardware and software for geeks.