Promenada dominical
Il ha multe flores in le parco, ma non un grande varietate. |
Un seniora in expectation de un filio necessita de multe attentiones. |
ia: Benvenite! In mi blog io scribe in interlingua, italiano e anglese.
it: Benvenuti! Nel mio blog scrivo in interlingua, italiano e inglese.
en: Welcome! In my blog I write in Interlingua, Italian and English.
Il ha multe flores in le parco, ma non un grande varietate. |
Un seniora in expectation de un filio necessita de multe attentiones. |
Pro retornar a Oakland nos curreva pro alicun horas longe le costiera del oceano Pacific. Le costiera es usualmente montaniose, e le strata curre multo alte proxime al oceano:
(Si vos es interessate in le processo de creation de iste photo, vide un explication in mi blog photographic.) Ma il ha anque alicun punctos ubi illo es plus basse, e il pote anque haber plagias.
I decided to blog about my experience of transitioning from being a GLib and GObject enthusiast to a Qt (and QML) fanboy. :-) I'm not writing this with any specific goals, other than sharing my own experience and hopefully making the life of those developers who are forced to learn and use Qt less painful and a bit more rosy; in particular, I'm not trying to be a Qt evangelist here and convince you, hardcore GObject developer, to switch to Qt: I'm indeed sure that if my current self tried to talk my 3 years younger self into Qt, it would be a useless and tiresome (and maybe violent ;-)) discussion.
Just a bit of background on myself: I've been developing on Linux and Unix for more than 10 years now, mostly using GObject based libraries, such as Gtk+. I had a short encounter with Qt in about 2004, just for a few weeks, which left me with a bad impression (mostly because of the uic). Other than that, I was simply not interested in Qt, mostly because I hate C++ and love C and anyway all my needs were perfectly met by GLib, GObject and Gtk+. I remember that the first time when I read about GObject, I was fascinated: the power of OO programming on top of my favorite language, all open source and hackable. In autumn 2006 I started a new job in Nokia, in the maemo team, working on a middleware component in the Telepathy VoIP framework; I enjoyed it a lot, and (if possible) grew even more fond of GObject and GLib. On early 2008, the big news: Nokia acquires Trolltech (the SW house developing Qt); for me, as for most of the people working in the maemo team, this came as a complete surprise, and not as a really good one. Indeed, we were afraid that we would have to abandon the C/Gtk+ work and switch to C++/Qt — perhaps not coincidentally, several GNOME developers working in Nokia even left the company around that time. Luckily though, nothing really changed for us for more than one year, and even later, when more people joined to work on Qt-related stuff and I moved to another project, I could still avoid touching Qt code and continue using only my beloved GObject. However, like all good dreams, this also came to an end: eventually, I had to refresh my C++ knowledge and change my most typed character from "g" to the hated "q".
So, here my Q story begins.
It was painful. My first task was to create Qt-bindings for the GLib-based library I was developing. There was no UI involved, so on the tools front the experience was not as bad as I remembered; but on the pure programming side, I was horrified: I felt extremely limited, many programming paradigms I was used too couldn't be applied, or I was just told (by people more expert in Qt) that “you shouldn't do like that, it's not the Qt way!”. Urgh.
The biggest issues I had were the lack of reference counting in QObject (!!) and the veto on using C-style function callbacks for asynchronous operations (you should use Qt slots, and in order to have a slot you must have a receiving QObject). How could I take Qt seriously? Sure, there were also a few nice things about it, like the fact that QObject comes with child-parent lifetime handling out of the box (when a parent object dies, all of its children are automatically deleted), and that signal connections are automatically broken when either the emitter or the receiver object dies (yay, no more explicit signal disconnections — or random crashes!). But still, this could in no way compensate for the lack of the other low-level features I was used to.
I cannot really say that I enjoyed the first months of using Qt. I was still trying to work as much as possible on the GLib-based parts of the project, and twisting my head around to figure out what was “the Qt way” of doing all the things that I was used to do almost instinctively with GLib/GObject.
Now that I think back and try to find the moment of time when I finally started liking Qt (or just not dislike it too much), I cannot really point out a definite time. It was a very slow process, that surely wouldn't have completed if I hadn't been forced to use Qt because of my work. But indeed, the moment when I realized that Qt was not so bad after all is when I started writing new original code with it. In retrospection, I would say that my experience with Qt was so bad because I started with a completely wrong task: as an inexperienced Qt developer, creating binding for a GObject-based library couldn't possibly make me appreciate Qt; I was just bound to notice all the GObject features that were not present in Qt, and suffer their absence. And I wouldn't notice almost any of the niceties that Qt offers to application developers, because there is not much code you can write in a wrapper library other than some trivial glue code.
So, my first suggestion for those GObject developers who start using Qt is: do not write a Qt wrapper to your favorite GObject library!, you are going to hate it. Leave it to someone who is more experienced than you in Qt; it can be a very pedagogic task, indeed, but chances are that it will be the last time you are going to use Qt. If you can, start with writing new code.
That said, there is a big difference between not disliking something and loving it. But again, I cannot tell when I started loving Qt. What I surely can tell is when I realized that I loved it: and that was when I started porting some GObject-based code to Qt (not as a line-by-line port, but more like a functional rewrite) and found out that the resulting code was not only more compact and easier to write, but — and especially — easier to read. And of course, when I realized that my enthusiasm was not the same as before, whenever I had to do some programming in C+GObject.
Let me begin with a couple of statements which could dispel some myths or anyway clarify some doubts that the Qt-virgin might hold:
That said, here's a list of things that I came to like about Qt; I'm obviously not mentioning those things that are also in GLib/GObject, unless there are significant differences.
QMap<QString,QVariant> map; map.insert("string", "string value"); map.insert("integer", 12);while to iterate the values you have the handy foreach macro, which lets you write
foreach (const QVariant &value, map) { QDebug() << "Value:" << value; }And if you remember what I wrote above about QString: Qt container classes are implicitly shared too!
No way you will. ;-) Joke aside, there is some truth in that answer: first of all, you will never like Qt until you try it; and you won't try it unless you are forced to, or have some very good reasons to start looking into it. In my case, in fact, I was forced to, and — at that time — I had absolutely no reason to try Qt on my own: I already had some bad memories with it, I didn't like KDE, the skype Linux client and, most importantly, I was totally happy and satisfied with coding C and GObject.
However, I believe that nowadays there might be two reasons why even a hardcore GNOME developer could, in an unforgivable moment of weakness, decide to try programming with Qt: QML and application portability. QML is the new cool stuff (it was not there when I started with Qt), there are plenty of nice demos and examples out there, and they do pretty amazing things. Especially given that setting up the environment is an easy task (just install the Qt packages from your Linux distribution) and running the demos is in most cases just a matter of typing qmlviewer <file>.qml, and that you are a very curious geek, it's not so unlikely that you'll want to have a closer look to the demos; and since the source code consists in most cases of just a few lines of JSON-like text, it won't take long for you to understand it and maybe start playing with it. Especially because I still believe that GNOME developers deserve something as cool as QML. :-)
The other reason why trying Qt nowadays is not so absurd as it might seem is portability. Yes, Qt has always made portability his flag, but who does really care about Windows and Mac? However, what you might care about is Android! What has changed here in the last couple of years is that Qt and QML run on Android, with GL acceleration and multitouch support, enabling you to develop modern applications which can be run on millions of devices; you can also target the best smartphone ever, Symbian smartphones and whatever devices Nokia will come up with for the next billion.
I don't think there is much more I can write to stimulate you to try out Qt or, if you have already started using it, to support your efforts to master it. What I can tell you, with no fear of being contradicted, is that eventually you will like it; there is no way that this won't happen, if you continue learning it. At some point you will realize that going back to C (or even Vala) and GObject is not going to make your programming more productive, or even more enjoyable than how it has become with Qt. It's just a matter of enduring the difficulties and unpleasantness for a long enough time; which can be even several full months if you are, like me, one who takes technologies, programming languages and libraries next to your heart.
Al initio de april nos moveva nostre domicilio de Lauttasaari, que es in le municipalitate de Helsinki, a Viertola, in le municipalitate de Vantaa. Vos pote leger multe informationes utile super Viertola in su pagina de wikipedia — si vos comprende le finnese, naturalmente. :-)
Certemente io e Yulia esseva triste de lassar nostre amate insula, e specialmente le scuriolo que sovente io poteva admirar del finestra de mi officio; ma le parve apartamento (e le costos prohibitive de apartamentos plus grande in le mesme region) mal se conjuga con le planos de aggrandimento de nostre familia. Le nove casa, que Yulia ha promittite de describer in futuro in su blog, es capace de hospitar usque a 2000 personas con un densitate simile a isto, si on plena le sauna e le banios. Isto me da bastante spatio pro laborar in un camera totalmente mie, al minus usque le resto del familia non va reclamar lo.
Viertola forsan non es tanto belle como Lauttasaari, ma certemente il ha su fascination. In loco del mar, nunc nos ha un rivo; in loco del scuriolo, nos ha aves con un belle canto, e io anque audiva un pico; il ha bastante de locos pro promenar se in le natura, e parve arbores cresce durante que io scribe:
De mi casa, io pote attinger le centro de Helsinki in 35-40 minutas (autobus plus traino) e le aeroporto in 20 minutas. Le botecas es a un kilometro de distantia; non tanto proxime como antea, ma pro un persona que labora sempre claudite in un camera de su casa, un parve promenada de tempore in tempore certamente non va facer mal.
In cambiar completemente subjecto, io vos informa que io ha create un nove blog dedicate exclusivemente a mi activitate photographic: photoblog.mardy.it. Nunc illo es solmente un copia del contento photographic de iste blog, ma illo devenira melior in futuro. Iste blog, que vos lege nunc, continuara como illo es: a parlar de me, de mi viages, de programmation e anque de photographia; le differentia es que photo.mardy.it tractara solmente de photographia.
Le secunde septimana de januario io viagiava a Budapest, pro labor. Io non habeva multe tempore pro visitar le citate; al contrario, quasi nulle! Alora, un die io decideva de eveliar me de bon tempore pro promenar e prender photos, como omne respectabile tourista.
Le die non esseva bellissime; le sol appareva e dispareva continuemente, e le celo esseva gris.
Io percurreva le mesme stratas que io habeva vidite duo noctes antea, quando con alicun amicos nos cercava un restaurante pro cenar. Io ha anque alicun photos de ille nocte; iste es le mesme subjecto, prendite de quasi le mesme puncto (isto demonstra que io es un photographo multo coherente :-) ):
Le photos es visibile in le galleria.