martes dic 13, 2005

Super Humanes, Mini minimals and idiot users.

I agree with Linus: KDE is more usable

If you think your users are idiots, only idiots will use it. I don't use Gnome, because in striving to be simple, it has long since reached the point where it simply doesn't do what I need it to do.
Linus Torvalds, at the gnome usability mailing list

And, sorry by that, I partially agree with Linus. Gnome is either too simple (mini minimal) or too complex (super humane). It's not a reasonable user interface. I've been using KDE for several years (with Mandrake and with Kubuntu) and I have to admit that every new release is just an improvement in user experience. I fully recommend KDE too. (And there's no intention to begin a Gnome vs. KDE war. If you like Gnome then go ahead and have fun, but please respect my opinion and let me express it. Otherwise, if you're a Gnome developer, you may find good hints to improve your GUIs here).

The fact is that Linus' comment may as well be applied to the distinction between Minimal and Humane interfaces that caused all these comments in the web lately. As well as Minimal interfaces and Humane interfaces I would include two more extreme variations of API design: The "Mini Minimal" approach and the "Super Humane" one.

Mini Minimal Interfaces, by example

Let's try to see an example of "Mini Minimal" interface design. "Mini Minimal" interfaces are an extreme of "Minimal Interfaces" and their defect is being so simple that they become useless. To see a real-life example of "Mini Minimal" interface design we will need "The Gimp v 2.2". (Beware that you'll have to install tons of weird libraries. In my Ubuntu 5.04 box this software requires linux-sound-base !??).

Once you get to get "The Gimp" v 2.2 then create a new image and try to save it as a PNG image. This is the "Save" dialog I'm getting:

Save dialog, simple

This is an example of dialogphilia, a disease that makes you re-create, re-design new file dialogs on every single release of your product. The fact is that the dialog is just too simple for me to use because it doesn't allow me to properly select a folder to save the image into. So, to select a folder on where to save the image, I am forced to click on that little, tiny small white arrow at the left of "Buscar otras carpetas" (search another folder).

From my point of view this is a nice example of "Mini Minimal" interfaces. Interfaces that trying to be simple become simpler, and fail to meet user expectations and, as a consequence, lack functionality and are just not usable.

The fact is that the dialog violates two usability laws: don't hide/show things to the user and don't create new weird widgets (such as that little tiny arrow there). But, wait, there's even more. Let's keep on clicking and investigating. Once you click on that weird tiny white arrow here's what you get:

Save dialog, simple

And this is just another example of dialogphilia. It's the most weird dialog I've ever seen to select a folder. I understand that it's a good idea to innovate new ways to do things. Gnome may be a good place for somebody to experiment innovative dialogs. I appreciate this. I probably like it from a technical point of view. But the fact is that I just want to save a PNG image. I'm not a guinea pig to experiment dialogphilia with. I'm a frustrated user. That's all.

So I manage to select the folder. Wow. That was hard. Let's click on the "Save" button. Wait. There's even more!!! We're reaching the...

... Super Humane Interface

Once you manage to click that "Save" button you get this last example of dialogphilia:

Save dialog, simple

Well, the fact is that the dialog is too wide to fit the screen (!!??) so here's the part of it that's falling through the right part of my monitor (note that the "OK" button is not visible without scrolling the dialog !?):

Save dialog, simple

And this is the perfect example of a Super Humane Interface. An interface with too many buttons, too many controls, too many widgets that are just... useless!! Trying to be too much humane makes the interface just plain useless.

The fact is that this "Save as PNG" option dialog is just out of place. (By the way, the whole process has to be repeated, including the painful folder selection, for every single PNG image you want to save). I'd prefer a little tiny tiny small "yellow" arrow in the previous dialog to be presented with the options for the PNG format. Or even move all the PNG stuff into a "Preferences Dialog" (Gnome developers tend to love preferences, see this message at the Gnome usability mailing list for screenshot examples). But I don't want to set them now! I don't mind if I want to save the PNG file with an "Entrelazado (Adam 7)" format or not. I don't even know what that means. This dialog is getting in my way.

So providing too much methods, buttons, dialogs and options trying to make things simpler makes things just more complex.

As I said in my previous entry, desigining user interfaces is a hard task. Humane and Minimal interfaces may be the way to go but both have their extremes. Keeping things under control, using our common sense to avoid extremes such as Super Human or Mini Minimal is probably the way to go.

After all, it's not about Humane Interfaces or Minimal Interfaces. As Aristotle said, "Virtue lies in the middle".

Happy API designing,
Antonio

jueves dic 08, 2005

Simple KISSes and surprises

Wow. Elliotte's criticism to the so called "Humane Interface" API design "school of thought" has spawn an Internet wide discussion (meme?) about simplicity in API design.

So I decided to review yesterday's entry, and go take a look at the Internet, to try to see what makes an API a good API. At least for me. And this is what I've found (and, as always, all feedback is welcome).

Surprise, surprise...

Yesterday I talked about the importance of following idioms and language conventions. Today a principle backs up this idea. The so called Principle of minimum surprise (or "Principle of least astonishment") states it clearly:

In user interface design, programming language design, and ergonomics, the principle (or rule) of least astonishment (or surprise) states that, when two elements of an interface conflict or are ambiguous, the behaviour should be that which will least surprise the human user or programmer at the time the conflict arises, because the least surprising behavior will usually be the correct one.
Principle of minimum surprise

And the fact is that Ruby's array API is all but "least astonishing" to a Java programmer. I couldn't stop laughing while reading Elliotte's review of Ruby's array api!!. (And, well, all respect due to Ruby programmers, but please understand that Elliotte has a point here, and he's so funny I couldn't resist).

Another example is C++ operator overloading. If you wrongly overload the assignation operator then your implementation fails to follow the principle of minimum surprise, and you can end up with a class that makes memory leaks. That's one of the reasons why I wouldn't like to see operator overloading in Java! ;-)

So, to summarize, point one is that an API should follow the minimum surprise principle.

Minimal interfaces: what is reasonable?

Martin Fowler introduces the Minimal Interface style of API design. He defines "minimal" as the smallest reasonable set of methods that will do the job.

And I think that's a nice definition. "smallest" and "reasonable" balance each other quite well and give the definition the part of ambiguity it needs.

Take, for instance, lists. The list abstract data type requires just one constructor and four operations. Just that and you can do whatever operation you want with lists (including "first()" and "last()"). So the "smallest set of methods that will do the job" for a list is four (and a constructor).

Well, of course a list interface with just 4+1 methods would result spartan to everybody. That's where "reasonable" fits in nicely in the definition (making the definition subjective and, thus, unusable, by the way ;-) ).

So, what is reasonable? Can we improve Martin's definition a little bit? What are the forces, the non functional requirements a Minimal Interface must meet so as to be a "Minimal Interface" with a smallest set of "reasonable" operations?

Reasonable means "as usual"

This is, a reasonable interface (to me) is one that follows the minimum surprise principle. For a Java list a reasonable interface (to me) is one that uses "size()" to get the number of elements, and that uses indexes starting from 0. And that uses Iterators to iterate over elements of the list. That's the principle of minimum surprise applied to (Java) lists. At least for me.

But a reasonable interface is one that keeps backwards compatibility. What would happen if Sun decided to remove the "Enumeration" interface in Java API? Wouldn't that break lots of existing programs out there?

Reasonable means easy to implement and extend

I wouldn't like to extend a list interface with 78 methods. That's nightmare. As Martin states it a minimal interface "reduces the burden on implementers". (Well, at least for languages such as Java, where non abstract classes implementing an interface have to implement \*all\* methods of the interface).

Reasonable means easy to learn

And again Martin introduces the importance of the learning curve in API design. Note, as well, that the more an API follows the Minimum Surprise Principle the easier the API is to learn. I don't need to go take a look at the java.util.Map API to know that I can retrieve the size of the map by invoking "size()" on it. (and yes, I admit Java API has evolved a lot and we still suffer from things such as length(), getLength() and size() burden in Java APIs).

Reasonable means easy to test

That's another important point, of course. APIs are to be maintained, and the smaller the public API the less things to test, right?

Reasonable means encapsulated, modular, providing information hiding

Which are basic principles to follow, aren't they? As Elliotte points out, is a Ruby array ...

... Is it a List? Is it a stack? Is it a map? It's three, three, three data structures in one!

And, please, note that I wouldn't like to make any critics to Ruby people, but I think the example servers quite well as a counter-example of the encapsulation and modularity. Wouldn't it be better to have separate Map and Stack classes? Is that reasonable? I think so. So, for me, a reasonable minimum interface is one that follows the principles of encapsulation, modularity and information hiding. The ones that make an array an array, and not a map, a ternary search trie or the mother of all data structures ;-)

Reasonable means ... minimal!!

APIs don't usually change. Changing a public API is asking for trouble to all people using it (remember those deprecated classes we have in APIs?). It's probably easier to augment a public API than to reduce it. Adding some new methods to a public API is much easier than removing methods people is already using. And that's why a reasonable API is a small one. The smaller the less prone to be reduced in the future, right?

To summarize

So, to summarize, I like minimal interfaces too. "Reasonable" minimal interfaces. They're easier to use, easier to learn and easier to maintain. Minimal interfaces can be augmented without too much hassle. But minimal interfaces are probably harder to design. You cannot measure the qualities of an API until you release it out. And then it may be too late to change it to make it even better. All we can probably do is use some good old common sense.

Sorry for this long post. And happy API desigining,
Antonio

miércoles dic 07, 2005

Harold, Martin and kisses

Elliotte vs. Martin: Elliotte wins

Yesterday Elliotte Rusty Harold showed disagreement with a recent Martin Fowler article. Elliotte basically says (at least this is what I understand) that APIs should be simple to use, but should not be filled with useless methods, such as "List.last()" and "List.first()" and things like that. Quoting:

More buttons/methods does not make an object more powerful or more humane, quite the opposite in fact. Simplicity is a virtue. Smaller is better.

(read more)

Elliotte says that a class with 78 methods is difficult to use. Why would you want a method such as "List.first()" when you can do "List.get(0)"?

I've been reading Martin's article too. He basically says that he "leans to" the "Humane interface", this is, having lots of methods in a class, but he admits that this is harder.

So, what's the best way to follow the KISS principle? What's better? Having an API with a "reasonable" minimum of methods or have an API with lots of methods, making things easy to use?

This is a tough question, and I think nobody can have the final answer. As human beings all of we have preferences, so our answers will always be subjective.

Anyway I think Albert Einstein was right when he said "Make it as simple as possible, but not simpler". That citation applies quite well to the discussion. Following Albert Einstein's advice would lead us to stick with Elliotte's opinion. We don't need an API that makes things simpler than simple. Simple is simple enough. Simpler is more complex.

Simple or simpler? Kisses are idioms, right?

So what makes an API simple? What simpler? Let's try to see an example. Take, for instance, the DOM API for XML Parsing.

Elliotte was not very satisfied with that API. And I also stick with his opinion: the DOM API is not very easy to use. So he decided to build a new API himself:

XOM is designed to be easy to learn and easy to use. It works very straight-forwardly, and has a very shallow learning curve. Assuming you're already familiar with XML, you should be able to get up and running with XOM very quickly.

learn about XOM

So, why is that? Why is DOM not "easy to use"?

Let's make Elliotte answer that for us. At his slide number 9 we can read:

[... the DOM API ...] Just plain ugly; does not adhere to Java programming conventions.
What's wrong with the XML APIs (and how to fix them)

So Elliotte answered our question two or three years ago. A simple API is one that adheres to Java programming conventions (whether those conventions are right or not we don't mind, after all they're just conventions).

A simple API makes indexes start from 0. And run until X.size()-1. That's simple.

So having a List API that contains a "first()" is not simple. It's just "simpler". Having a "last()" method is "simpler" (and thus more complex) than using the simple "get( size()-1 )".

But, for a Ruby programmer, having "first()" and "last()" is really simple. The other way round is more difficult. Each programming language has its idioms, and an API that follows those idioms is a simple API. An API that tends to be "simpler" and make things against the idioms is an API that makes things more difficult. As Elliotte says the more the buttons the bigger the difficulty.

So that's just my opinion: I like simple things, but not "simpler" things (because those are more complex to maintain).

Make things as simple as possible, but not simpler.

Now, I should apply that myself and forget about thinking of using annotations for everything. But, wait, are annotations a new Java idiom? (Mmm, that's more food for thought during the next holidays ;-)).

Any (simple) opinions out there?

Cheers, ;-)
Antonio

martes dic 06, 2005

Cooler, faster SwingWorkers

Do you remember our experiment with Amdahl's Law? Do you remember Jeffrey's table with the results of running a Swing, multi-threaded, application in a dual core system? (He measured a reduction in running time in those tables in his dual core box). Do you remember when I talked about Herb Sutter (of C++ world fame) urging people to go multithread?.

Well, the fact is that the time has come for us to be able to run up to 32 simultaneous threads within a single chip. It's not dual core, but dual-dual-core. This is, it contains four cores. It's not hyper-threaded, but hyper-hyper-hyper-hyper threaded. Each one of those four cores can run eight threads. That means that you can run 1+1+1+1+ 1+1+1+1+ 1+1+1+1+ 1+1+1+1+ 1+1+1+1+ 1+1+1+1+ 1+1+1+1+ 1+1+1+1 threads at the same time.

That-is-impressive. I'm delighted. But wait, there's more. For those of use worried about Global Warming news are even better. The beast runs with a low power consumption. Since high frequency signals don't have to travel long distances out of the chip, there's little radiation overhead (well, there're much more technical reasons for low power consumption, of course). I've got a bulb around consuming 60 Watts. The chip consumes just 73 Watts. Probably less than this Intel Pentium IV I'm running now. (By the way, I've been trying to find about Pentium processor power consumption without success, has anyone got any details on this? A comment would be greatly appreciated).

I think today is a great day for Sun and for us enjoying multithreading. (And well, of course, for all Sun customers wishing to save some bucks in the elecricity bills and in real state bills. There's even a savings calculator here.)

Now I'll start saving those $3000 to buy one of those boxes. Or, even better, I'll try to think about a good idea for the coolthreads project at java.net, so that I can earn some cash and get one of those flipping servers. What about reading 32 RSS feeds at once and caching them? (Oh, well, that's just what bloglines does).

Any ideas, anyone?
Thanks,
Antonio

lunes dic 05, 2005

Fighting Windows, fighting Linux

Arf, arf, arf! What a pair of weeks!

I'm sorry I haven't posted lately. Too busy traveling to Sevilla and installing Linux.

The fact is that I have a new computer at home and, of course, I wanted to install Linux on it. That's what I've been doing during some of my spare time these last two weeks. And it has kept me very busy indeed!. I now have a working system. Let me explain the whole nightmare I've been suffering trying to do that, just for you to be aware of this (and, well, for my records so I don't make the same mistakes in the future)...

Windows? No thanks. Where's my money?

This computer was sold with a preinstalled Windows partition on the hard disk. The rest of the hard disk is NTFS formatted, you you're stuck with it. There exists a Windows CD, but you cannot use it if you erase that (hidden) partition on the hard disk. Peculiar. They're selling me a CD that does not work. Or, you can see it this way too, they're selling me a 100Gb hard disk that I cannot fully use.

I don't think this is legal. I know this is legal in Germany. But I don't think it's legal here in Spain. I'll try to contact someone in the European Union since I see this as a direct attack (from Microsoft) to the freedom of choice of operating systems. This is probably a trick from Microsoft to make it difficult for users to install Linux.

Although it seems there're ways to extract that Windows from your hard disk to a CD, I didn't do that. I just formatted the whole hard disk. Within 15 minutes of owning the box. After all I own another Windows CD from a previous computer (that I've definitely installed aftewards on my box). How does that feel, Microsoft? Your tricks are not working with me, guys. You cannot stop me from installing Linux in my box and from installing previous copies of Windows onto my new brand computer (Microsoft is welcome to sue me because of this, of course). I don't mind if Microsoft hides your operating system on a NTFS partition. I think I'll try to sue Microsoft in some European Union place later on.

Linux, going the Microsoft way?

I've posted, a long time ago, about what I think it's one of the main Linux problems: the lack of uniformity, distribution fragmentation and, most worrying, vendor lock-in. Let me explain my experiences with all the different distributions I've tried out.

Mandrake 10.1... where's my CD-ROM?

As a previous Mandrake user I wanted to try to install Mandrake 10.1. That was my first choice. The fact is that Mandrake 10.1 didn't install. It correctly booted from the DVD-ROM but, after booting the kernel, it told me it couldn't find... the DVD-ROM!! I was astonished! I couldn't believe it. Well, I assume this new box is using SATA and Mandrake 10.1 is probably too old to correctly recognize my new box. So I moved onto latest...

Mandriva 2006 RC1: trying to lock me in, guys? No way!

... to the latest Mandriva 2006 RC1. I just burned the CD1 (just to give it a try). Installation was not bad. Anyway they should improve that. I couldn't "go back" to recheck whatever I entered in the previous screens. That's bad from a distribution you're supposed to pay for. Installation should allow you to "go back" and review whatever options you entered. But, anyway, I kept on going with it and installed it on my hard disk. During the installation phase I couldn't add another partitions I had there. So after the install I could only boot Mandrake. That's bad. I couldn't stand it. Mandriva installation should detect automatically whatever other bootable partitions I have there and include them in my "grub" menu for me to choose at boot time. But I could only boot Mandrake. I mean Mandriva. I tried to use the install CD-ROM as a rescue disk to boot another partition but I couldn't. So, to summarize: after installing Mandriva 2006 RC1 I could only boot Mandriva. Trying to lock me in, guys? No way!. I removed Mandriva from my hard disk and decided to try out...

Suse 10 Evaluation Version: But, where're my compilers?

I could get my hands on a Suse 10 evaluation version. Good. I've always heard good things about Suse. And wanted to experiment whatever Novell has been doing with Suse after they adquired it. The installation process was the best one I've ever seen in a Linux distro. I would say it's even better than a Windows installation process. Both for novice and for expert users. I could choose partitions with the mouse. It also detected my other bootable partitions (several other linux distros) and included them in the "grub" menu for me to choose at boot time. Good.

But, to my surprise, the evaluation version didn't include the GCC compiler. I mean, it includes no compilers at all. And I didn't know how to install them. The administration tool (they call it "yast") didn't allow me to choose a C compiler.

So the evaluation finished. Well, of course! How is it I am expected to evaluate a Linux distribution that contains no compilers? Ha! No way, guys. Novell has done a good job in the installation process, but trying to lock me in by giving me no compilers is a bad trick. No way. Suse's evalutation version had to be deleted from my hard disk too.

Slackware 10.2

The very first version of Linux I tried out was Slackware. Once upon a time it was the only Linux distribution on the planet, I think. So I burned a Slackware 10.2 CD-ROM (the first CD out of 5, I think) and booted from it. A text installation was presented to me and, sorry guys, I just removed the CD-ROM. That easy. I didn't even pass the very first screen.

Kubuntu 5.10... and Kubuntu 5.04

So my next try was the recently released Kubuntu 5.10. I burned (just another) CD with it and, well, it hang at boot time. It seems the box contains a brand new sound card that's not fully supported by Linux. (In fact none of the linux distros could make any sound at all). This is an Intel High Definition Audio card (alsa 1.0.10 is including drivers for this card but they're having all sort of problems at the moment). Which is a very good card, by the way.

So since 5.10 didn't work I moved onto my old 5.04. The one I was using. The one I'm running now. The one I'll be using in the future.

So, to summarize

I don't really like wasting time doing Linux installations. But this was a good chance for me to evaluate the status of these different distros. I wanted to know how well they were going. Commercial vendors (Mandriva, Novell) didn't do very well and, from my opinion, wanted to lock-me in their distributions. But, why is this so? Are they becoming Microsoft like? Isn't it ashaming trying to lock-in people into their distributions? Using free software?

And, as a summary, kernel 2.6 is not as sound as I expected it to be. The box keyboard bounces as mad if I plug-in an USB mouse. It seems that bug comes from the new input mechanism they've included in 2.6. So you have to modprobe psmouse rate=40 to solve it. Weird. I know the Linux kernel is growing bigger and bigger, so I assume it's becoming more and more difficult to manage. And I understand it when Linus warns about last-minute check-ins into the kernel. There's a difference between a bazaar and a mess. Well done, Linus.

So, to summarize: Kubuntu won the competition. I like Kubuntu's freedom. It does not try to lock-me in. Full of compilers for me to choose from. I like it being Debian based (to me Debian is probably the most sound, most free, most capable Linu distribution, but it's somewhat slow for my linkings in the GUI area). Kubuntu combines the power of Debian with a nice user interface (and easy installation).

(So, Antonio, please remember: do not ever experiment any more with Linux distros and go straight into the newest Kubuntu release).

OpenSolaris, Kubuntu (and, well, Windows just in case. I'll probably install Windows as a VMWare image in the future, so I can install and reinstall as soon as it gets full of spies and viruses and the like).

Time for two holiday days here in Spain. With a working (silent ;-)) box at my fingertips.

Cheers,
Antonio

miércoles nov 23, 2005

Survey: Your preferred Swing Eye Candy?

I was wondering what your preferred Swing application is. Please add a comment with your preferred one.

Thanks!!

Antonio

lunes nov 21, 2005

Swing Eye Candy

I've seen some Swing applications that have really impressed me. And I wanted to tell you all so that you can enjoy that eye candy as well.

First one is Sun Java System Creator. There's an IMPRESSIVE and funny flash demo here.

Note that, since Sun Java System Creator is based in NetBeans 5.0 (beta 2 released recently, by the way, and it's really cool), most of the kudos should go to the NetBeans people. (Hint: go through all the demo and then wait a few minutes after it's done. I couldn't stop laughing!)

Second one is a Graph Editor you can Java Web Start from the yWorks site. It has an interactive hierarchical layout that has indeed impressed me. Cute app.

I'm presenting XML and Java/XML at a local University in Madrid in a few days so, yes, I have to go back to work.

Grrrr, ;-)
Antonio

domingo nov 20, 2005

Todo: 2005-12-06, join Sut at Hilton Metropole

If you're worried about Global Warming you may be interested in joining us at the Hilton Metropole in London on 6th dec. 2005.

I wish I could attend. :'-(

Cheers,
Antonio

jueves nov 17, 2005

Bloglines is cool

Live from Sevilla. Foggy this morning, but lots of sun in the afternoon!

Someone suggested buildling an RSS Feed Reader/aggregator as a sample Swing application, just to experiment with different ways to organize the model, the view and the controller.

And, since I don't really like any RSS feed readers around, I thought it could be a good idea.

The fact is that, as in Jonathan's case, I need a high mobility RSS feed reader. I switch computers all the time, so I need to store my preferred RSS feeds somewhere in the Internet. I can't rely on a local hard disk, either.

So I happened to pass by bloglines and I noticed their excellent REST services. Really cool. They keep all your RSS feeds for you, and cache them, and then allow you to retrieve them using a simple HTTP call.

And that's exactly what I need. They provide a simple RSS storage mechanism for me. For free. They keep all my RSS feeds there. And, more interestingly, they parse them for me. They worry about RSS 0.91, RSS 0.92, RSS 1.0, RSS 2.0, Atom 1.0 and whatever-the-version-is version and parse them for me. And they produce clean RSS 2.0 instead.

So I think that it may be a good idea to build a Swing rich client application that consumes bloglines REST services.

That rich client application could then be stored somewhere in the Internet. And, being downloaded using JNLP, I could then have a truly mobile RSS feed reader.

Cool.

Greetings from Sevilla,
Antonio

sábado nov 12, 2005

Eco Responsability

Worried about Global Warming? Want to know about Sun's Eco-Responsibility Initiative?

Good to know we're moving in the right direction. Let's try to change things. Let's try to build a Better World for the ones to come. It's we that can do it. It's our responsibility. It's our duty.

viernes nov 11, 2005

Let's get it organized

What a week, dude. Lots of things to do. Little time for funny activities. And the coming one is even worse, much more traveling (back to Sevilla again). I'll try to post some photos of Sevilla and the "tapas" they have there.

The fact is that I've received different emails through my blogging alias. Apart of omnipresent spam I've received a couple of mails asking about the event bus, and about the organization of the model, the view and the controller in Swing applications.

Let's get organized

So I thought it could be a good, illustrative idea to show different ways to organize things in Swing applications. Different ways to architecture the internals of a GUI application.

And, before going any further, I thought it could be a good idea to ask you all what you think of this. Say I am to write an application using the Presentation Model paradigm, and then rewrite it using the Model View Presenter approach. And then rewrite the first one using an event bus, and do the same with the second one. Something like this:

  • Presentation Model, no event bus.
  • Model View Presenter, no event bus.
  • Presentation Model, event bus.
  • Model View Presenter, no event bus.

(Any other suggestion is, of course, welcome).

And then, after watching those four, see how things could be further improved. Or even write a comparison of them all. Some sort of guidelines for choosing which one better fits your needs.

So, my questions is, is it worth the effort? What do you think?

Doing what?

The application should be useful, of course. I suggest doing some sort of easy to use bookmark manager. Since I use different computers I have different set of bookmarks in different places. I'd like to store those in, say, Google's gmail (as a plain jar file, say). Any other ideas about useful (little) applications are welcome, too.

Thanks for any ideas and have a restful weekend (I will ;-)),

Antonio

jueves nov 10, 2005

Graph drawing with NetBeans

One of my interests is graph drawing. Graph drawing is a nice mixture of maths and computer science.

The fact is that drawing a graph automatically is indeed a complex thing. I am specially interested in drawing directed graphs, either cyclic or acyclic ones.

One of the most famous algorithms for doing this is the Sugiyama algorithm, that I'm slowly implementing myself as time permits.

One of the most famous tools for automatic graph drawing is Graphviz. There're different commercial libraries for drawing graphs, too. JGraph has recently included some layout algorithms (that, by the way, failed to work in the demo I tried several months ago).

So, why am I telling you all this? Well, because some guys at Sun have contributed a graph library to NetBeans. And, although it seems not to have an algorithm to layout nodes, it does have an algorithm to automatically route edges (quite effective, indeed). It seems this is the library being used to display those nice graphs in NetBeans Mobility Pack, like this one:

Sample Graph built with the NetBeans graph library

So I thought you could be interested in trying out the Java Web Start demo available at that page. Cool stuff.

And, by the way, there're some nice screenshots here of applications built on top of the NetBeans platform, just in case you want some eye candy.

Cheers,
Antonio

Update: The NetBeans Graph library does have an algorithm for automatically laying out nodes too.

martes nov 08, 2005

Book on Swing?

I've been traveling to Sevilla lately and so it's hard to keep on blogging. I beg your pardon. I'll write on the EventBus by the end of the week.

The fact is that a friend of mine is thinking of buying a book on Swing.

I bought a book on Swing ages ago. At that time Swing was prefixed with "com.sun.swing" or something similar, and was not yet integrated in the JDK.

Since then things have changed a lot (I can travel on a high speed train to Sevilla, for instance ;-)). So I thought it would be a good idea to ask you what you think.

Would book would you recommend? Do you know about a good book on Swing? Or, even better, would it be a good idea to write just another book on Swing? If so, which topics would you like to see covered? Is it threading? API? JDNC? JDIC?

All advice will be greatly appreciated.

Cheers,
Antonio

viernes oct 28, 2005

To annotate or not: that is the question

It seems there is a diversity of opinions regarding Java 5 annotations. So I decided to write a little bit on my (current) thoughts on this. Maybe you want to express your ideas too. I would appreciate that. That would help me make my mind on this.

Annotations, by accident

The fact is that I happened to read my favourite Scheme book lately and I found this by accident:

"The contrast between function and procedure is a reflection of the general distinction between describing properties of things and describing how to do things, or, as it is sometimes referred to, the distinction between declarative knowledge and imperative knowledge."
Structure and Interpretation of Computer Programs 2nd. Edition, page 22. (Nice read)

And I thought this could say it all about annotations. I mean: since annotations contain declarative knowledge of things they should be used to describe the properties of things (but not how things work).

Let's rewrite this. What does "things" mean? What can I annotate in Java? Well, it seems we can annotate annotations themselves, packages, classes (interfaces), constructors, methods, method parameters, class fields and local variables.

That's a lot! ;-)

So, rewriting the paragraph above, we end up with:

Annotations usage idea I: describing properties

Annotations should be used to describe the properties of annotations, packages, classes (interfaces), constructors, method parameters, class fields and local variables.

So that's what I understood about annotations, too. And this is a Good Thing to have in Java. JAXB2 annotations and EJB 3.0 annotations conform to this rule: they contain a description of the properties of things (properties of entity beans, for instance).

Annotations and that little footnote down there

So I kept on reading my favourite book and happened to read that little footnote down there. I mean this one. Let me quote a little bit:

In a related vein, an important current area in programming-language design is the exploration of so-called very high-level languages, in which one actually programs in terms of declarative statements. The idea is to make interpreters sophisticated enough so that, given ``what is'' knowledge specified by the programmer, they can generate ``how to'' knowledge automatically. This cannot be done in general, but there are important areas where progress has been made.

Structure and intepretation of Computer Programs 2nd. Edition, footnote # 20 on page 22

Oh, ah! This is very interesting! It seems you can use declarative programming to specify how things work too!!. So you can use annotations to "generate "how to" knowledge automatically". (and this is where the apt annotation tool fits in).

Well, this is nothing new if you think of it. Take, for instance, the Spring framework. In Spring (I'm not a Spring expert so I may be wrong here) you build things declaratively. You end up programming things with XML. Indicating how things work. Which beans are "SimpleUrlHandlerMapping" and which beans are "org.springframework.jms.support.converter".

So annotations (or Spring declarations, or XDoclet) can be used to generate "how to" knowledge automatically. This is very important for those of us responsible for defining frameworks. By using annotations the "how to" is generated automatically. You can include best practices and best of breed, high quality, field-tested patterns automatically. This reduces development time, reduces the probability to do things badly and thus augments the probability of success in your software.

So we end up with another idea:

Annotations usage idea II: automatic code generation

Annotations can be used to generate code automatically, so as to automatically include (bugs? ;-)) best practices in your software for you.

But this automatic code generation is a double-edge swiss knife. What happens if the automatically generated code is a bad one? Will the automatically generated code correctly address your non functional requirements? Is it scalable? Is it performant? Can it be distributed in a cluster of application servers? How easily will it be maintained within two years from now?

This is, if you automatically generate code with annotations, is it being correctly generated??...

... To annotate or not to annotate: that (whether the generated code is good or not) is the question!!

Have a good weekend,
Antonio

miércoles oct 26, 2005

Smart guys around

We are WE nowadays. With capital letters.

Family is getting bigger. We are more. And we are smarter. ex-StorageTek and ex-SeeBeyond people around. Great people, great products.

Take, for instance, David Lee Todd's blog, explaining how SeeBeyond products used Lisp. Welcome, David, and nice post.

(Oh, I admit I'm a Scheme fan. I usually dream of substituting Ant's XML with Scheme and of building a NetBeans plugin for Scheme).

Cheers,
Antonio

About

swinger

Search

Archives
« abril 2014
lunmarmiéjueviesábdom
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Hoy