Platoons of clever critics, a pit of success

I have been reading “The Transparent Society” by David Brin and a .NET book “Framework Design Guidelines” by Brad Abrams and Krzysztof Cwalina. On page 10 of the former book I found something interesting:

“In all of history, we have found just one cure for error — a partial antidote against making and repeating grand, foolish mistakes, a remedy against self-deception, That antidote is criticism. Scientists have known this for a long time. It is the keystone of their success. A scientific theory gains respect only by surviving repeated attempts to demolish it. (page 10)”

I have been closely following the criticism on Tinymail. I indeed noticed that there has been certain difficulties. The book continues with:

“Only after platoons of clever critics have striven to come up with refuting evidence, forcing changes, do a few hypotheses eventually graduate from mere theories to accepted models of the world. (page 11)”

This is why I’m a critic myself. This is what makes me want to listen to criticism for my own things. Because criticism is a partial antidote against making and repeating grand, foolish mistakes. Against self-deception.

My plan is simple: I’ll take the criticism, I’ll learn from it. I will educate myself using the .NET book and I will improve both my own skills and the framework.

I like the .NET book because of an interesting quote:

“Eight out of eight failed to read text from a file in the 30 minutes we allocated for the task. We believe this was due in part to problems with the documentation search engine and insufficient sample coverage; however, it is clear that the API itself had several usability problems. (page 17 and 18)”.

They explain that they designed the .NET API scenario driven. This means that they wrote the code of a scenario and only then constructed the classes and interfaces.

I think this is an important lesson in framework design: do usability studies on your API and you’ll learn that with your own frameworks eight out of eight will fail while performing the simplest tasks. The authors of the .NET book write that their goal was to provide a pit of success for their customers, not a pit of failure. I want the same for Tinymail: to have a pit of success for the application developers.

ps. The former book is not about a technical subject like designing a framework of course (I know, you don’t have to tell me). Rather about privacy vs. technology. The connection between the two subjects is only about these quotes: I’m reading both books at the same time.

From the dark corners of being on holiday …

Murray’s blog spurred some controversy about Evolution and the adapted Camel that Tinymail internally uses.

Having done most of the adjustments I’d like to point out that some of the changes are indeed focused on mobile use. Some of the changes alter the IMAP communication in such a way that less bandwidth is consumed. Examples are omitting the references header while downloading so-called summary information per message and the support for CONDSTORE.

CONDSTORE is a recent enhancement to the IMAP protocol that makes it possible to ask the IMAP servers for just the differences since a certain known state. Rather than asking for all the flags of an item, comparing that with your local version and synchronizing the two, you ask for only what has changed and you synchronize the recent local changes remotely.

I removed the support for the references header in Tinymail because this was poorly implemented in my opinion: a doubly linked list was used for each reference. This as you know consumes eight extra bytes per reference for the pointers (for the purists: on a 32bit computer). I think just storing the string and using strtok would be better here. The current E-mail clients being developed using Tinymail, however, don’t need the threading granularity of a desktop E-mail client.

Most modern E-mail clients are also less and less utilising this feature the way most experienced E-mail users know it: usually E-mails are grouped together based on relevance (flagging by a human and determining this with an algorithm) or on indeed the discussion thread. Full threading is often overkill: most people just want the messages to be grouped together somehow (in a flat list per group, not really the actual tree). Mind that most mobile devices have rather limited display capabilities and that a tree wastes a lot of whitespace this way. What is the use of message threading if you can only display at most five rows of E-mail summary info?

This “references information” must be downloaded and GPRS sometimes costs the end-user money per downloaded megabyte. Those reasons combined made me decide to simply not request this information. Later I might make the projection of the actual query definable by the application developer who builds on top of Tinymail.

My conclusion? Certain things can most likely be backported to Evolution. Other things might just not be interesting. Cooperating is definitely more interesting than not doing so. Right now is an internal highly adapted copy of Camel the pragmatic right solution for Tinymail.

And then there was …

I promised my precious Tinne that I was going to take two weeks of vacation. I’ll start with the Belgian rock festival Pukkelpop and after that, two weeks of holiday together with Tinne.

I promised a release candidate of Tinymail last week so I guess I will still be doing that in the evenings. Other than that I’m planning not to work on anything for the first time in .. already a few years I think (all the holidays that I took at my former employer have been going to Tinymail development). I kinda forgot how holidays feel. I’m even a little bit scared of getting bored.

Well, no. I can’t get bored! I have a bunch of things to read, A girlfriend who’ll finally get some attention and a release to make. It’s not much to do, but it’s something.

A release candidate, very soon

I’m at the point of (naively) believing that Tinymail‘s thread difficulties are all solved. The developers working on Modest seem to be telling the same thing (today’s quotes from the developers: “Modest is quite robust today”, “yes!!! it works”). Whoo!

The POP code had some difficulties too, mostly related to deleted and deleting messages. These have all been fixed too. We have bugs like a translation bug about the SSL-question text: it’s not yet translated to your locale. That type of bugs. Still too much such bugs, in my opinion. An E-mail client has quite a lot of functions to support, if you just want something very basic (you’d be amazed). We’re getting there and I have this (again naive) feeling Modest is going to please most people.

Next week will be an interesting one as I’m planning to do a release candidate of Tinymail. That’ll be an actual tarball and a branch tag in a “releases” sub directory of Tinymail’s repository. We’ll make sure Modest’s repository will be synchronized and tagged with this RC. I’ll make sure all the build information will be available. Chances are high that we’ll put some packages for N800 online too. That’s not a promise, though. Especially not for Modest (I don’t make such decisions for Modest, but I can probably prepare packages for Tinymail on N800).

I’m expecting quite a lot of bug reports. Especially if we’ll provide packages, as that will increase the amount of people who’ll try it out of course. I will make test accounts available for people who don’t yet trust Tinymail with their precious E-mail data. I will also prepare a QEmu image with an IMAP server and some test data. Although this QEmu image will only be bundled with a release officially when I’ll do the final onepointzero release.

It has been a year and a half of hard work, especially last few months, but I think it’s getting ready now for beta phase, yes.

If people want to help with all the “make distcheck” work, let me know. I’m not very optimistic that a lot people will, doing a release is really boring work. That’s because, and I repeat, all our typical development tools (autotools, gtk-doc, etc) suck and are absolutely not synchronized with how developers really work.

The book store

After I watched Krzysztof‘s lecture on API design, I decided to buy Framework Design Guidelines, which is a book he and Brad Abrams wrote.

I scanned through the first pages of the book and it indeed looks like a very interesting book full of material that I’ll in future use when designing and defining APIs and frameworks. I hope other people in the GNOME community, especially the ones working on infrastructure right now, will buy the same book and read it a few times.

I also bought myself The Transparent Society and started reading in my copy of Noam‘s Hegemony or Survival: America’s Quest for Global Dominance. I’m guessing these books will be influencing my blog content for the next few weeks. Maybe people who don’t like these subjects can filter me out? :-)

DBUS with Vala

Jürg Billeter finally has his blog setup. He finished the first building blocks of a DBUS binding for Vala and made a sample. Go check it out!

Vala, Tinymail, IRC …

Vala

A lot of people are visiting #vala on GimpNET to tell Jürg Billeter how much they like Vala. One such person already finished a Vala binding for GtkMozEmbed, another is now working on bindings for Clutter.

This is very cool indeed. Soon we’ll have solutions in place for the vast majority of our libraries. I hope our community realizes that the emerge of a new programming language can only succeed if the creators get some help with implementing required instrumentation.

There’s for example a challenge in supporting .vala files in a clean way in autotools and Makefile.am. Although the majority of people dislike autotools & co., it’s used by nearly all of GNOME’s libraries. To make things work smoothly is a good integration needed. The difficulty is that a Vala compiler, unlike a C compiler for typical C projects, needs a list of all Vala files to start generating the .c files. For Python they needed something similar using a helping script called py-compile. Java can cope with a file per class, as there’s a file-name convention.

Vala is missing documentation, a website and there’s a lot of low hanging fruit that can very easily be picked up by new people.

As for Tinymail, me and Jürg are planning to replace the TnyList and TnyIterator interfaces with the ones in libgee sooner or later (probably later, as I’d like to release a one point zero of Tinymail before that). I heard the Anjuta folks are interested in replacing their “from IDL generated interfaces” with Vala-ones too. I might just bite the bullet and rewrite all Tinymail’s interfaces in Vala. As soon as Jürg has the binding generation for Vala in place, that would mean I would get the generation of language bindings for free. Right?

This illustrates why I think Vala is such a good idea. Especially for GObject based libraries that have interfaces for their API.

Tinymail

Today I finished the work on Tinymail to make it completely “Gdk lock” aware. This means that Tinymail’s signals, observer update invocations and callbacks are all “Gdk lock” aware. In practise this means that you, as application developer, don’t need to acquire the Gdk lock yourself. For your own timeout and idle callbacks and for your own threads calling Gtk+ or Gdk subsystems you of course still need to do this.

This work will be committed tomorrow. I don’t know when Modest’s public repository will have the required changes for this (some people are on vacation, etc etc).

Documentation still has the top priority at the Tinymail project, so some new documentation items got added. Mostly about how Tinymail works internally related to the recent improvements. I have asynchronous operations, asynchronous connecting and dealing with the Gdk lock for you.

These recent improvements combined together should make Tinymail more robust against threading problems. There’s locking order, queuing and guaranteed handling of the Gdk lock in signals, observer update invokes and callbacks. The queue waits for the return of the callbacks made by the application developer, avoiding that the application developer can launch a method in that callback that would lock with the original call that invoked the callback. Lot’s of improvements like that.

All these things have delayed the release candidate that I promised to some people at GUADEC this year. I also want to let the improvements stabilize a little bit. On top of that there’s quite a lot of work cleaning certain things up. I would also like to create a QEmu image with an IMAP server and the Tinymail demoui that I’ll release in parallel. These are certainly things people can help me with, if they want me to speedup a release for Tinymail.

The make distcheck should be again working, some of the unit tests need reviewing, the !@#*@* gtk-doc scripts need to be fixed .. again, the !@#*@* Python bindings are broken .. again, the enum and flags GTypes are synchronized once more (although some don’t have documentation in gtk-doc yet), etc. I guess all these are the typical 60% of work a project maintainer has to do. A lot of work is indeed because all our development tools are completely broken and not integrated with how people really work.

Gdk Lock aware?

Right, some people have reviewed that wiki page that I mentioned yesterday. Hoping more people will do reviews.

IRC

If you can’t join a GNOME or Gtk+ channel on GimpNET because it’s invite only: /msg dorito invite #channel. The ops had to set some channels to invite-only because of spam bots.

The GDK lock

I’ll try to make it more of a habit to write about Tinymail‘s future enhancements before I commit them. This gives people who are following the project the opportunity to comment on and maybe improve the actual work.

In the good old current days Tinymail’s callbacks for asynchronous operations are guaranteed to happen in the GMainLoop of your application. Tinymail uses a g_idle_add_full and ensures that the operation itself happens in a queue that runs a single thread, and a GCond that ensures that the queue will wait for the callback to happen before entering the next item on the queue.

That’s not enough because a g_idle_add_full does not enter the GDK lock. In near future (the patch is ready), Tinymail will do this too. This will make all of Tinymail’s callback invokes behave like signal handlers of Gtk+ components.

Tinymail’s observer update functions will do the same thing. Although I know you can use glib’s signals for this, I used the original observer pattern for some situations. Usually for situations where it must be clear for the application developer what he’s doing. Just like signal emissions must these update invokes or notifies happen with the GDK lock locked. Next on my list is going after all signal emissions that happen outside of the GDK lock.

The thing with this GDK lock is that it’s completely not well documented, that nearly nobody in the GNOME community fully understands how it works (except maybe people like Tim Janik), how you need to use it and more importantly when you need to do it. It’s at this moment definitely not (yet) clear at all. I started this wiki page in the hopes that our experienced developers will continue improving it. This way we might someday have a real and full description of how to actually correctly use gdk_threads_enter and gdk_threads_leave.

FWD: Online lecture on API design

Two or three months ago Krzysztof Cwalina made one of his Microsoft Research presentations available. It’s a presentation of around four hours about how to design framework APIs.

He talks about quite a lot of subjects that I think the community of people working on future GNOME related frameworks and infrastructure should carefully listen to.

I’m one of those software developers who have very much respect for those people that Microsoft employs who are passionate and knowledgeable. I truly believe a lot of the technical people at Microsoft do want to make things better. This makes it interesting to listen to their thoughts and ideas, to be open minded about their research.

If you have Windows Media Player you can watch the presentation here. You can download this presentation for offline view here. It contains a .asf file in one of the folders. You can probably view it using one of those media players that we have. If not, in stead of ignoring the content I advise you to use your mother’s Windows computer to nevertheless watch the presentation. You’ll suffer from having to use Windows and you’ll suffer from having to watch four hours of presentation material, but I promise you that it wont kill you and that the presentation itself is quite interesting.

I know that this blog item misses real argumentation on why you should view it and waste four hours on this. Well, just do. There you have it.