Hacked a bit Thursday and this weekend and put together Hotwire 0.444. For the impatient, you can skip directly to the Google Group and download. The cool thing about this release is that it has initial undo support. I’ll talk more about that in a minute.
Sometimes, writing applications for the web is quite nice, compared to traditional desktop UI toolkits. It can be very easy to bang together something that looks awesome, is functional and usable. In particular, one of my favorite features about the web is javascript:alert(). Wait a second you say, javascript:alert() sucks! Exactly. It’s so bad that no self respecting web developer uses it in the normal app flow. It’s impossible to make it look decent, and it just feels clunky and weird in a normal web page. Therefore, most web applications tend to avoid dialogs, and (hopefully) use better solutions like undo or whatever makes sense for the situation.
I think in general, there are 3 possible reasons you might add a modal dialog that requires a user action or choice to your application.
- Need username/password – Ok, but you better remember what I type.
- List infos – Things like the Eclipse new-class dialog. This one could be done inline too but it’s mostly fine as a dialog.
- It’s probably wrong – everything else.
In particular, I often notice that where a lot of the confirmation type dialogs (“Do you really want to foo?”) are used, it would make more sense to just do what I asked, and if it wasn’t what I really wanted, allow me to undo.
I am going to take a relatively extreme (and topical) example here; the default Fedora root .bashrc which has alias rm='rm -i'.
It asks you this for every file by default
Is there a better way? Yes.
Click to undo!
This took all of maybe 20 minutes to implement for the cd and rm commands; it should be relatively straightforward to add undo support to Hotwire’s builtin mv command, and cp will likely have it once it’s written.
Some other new features for this release:
A help display so you don’t need to read the source to know what commands there are
For more details, see the Google group post.