Talking ’bout Code Generation

May 5, 2008 by nmusatti

In a perfect display of self-promotion, I forgot to announce here that I had a presentation proposal accepted for the ACCU Conference 2008. To get an idea of what I talked about you can read the proposal and browse through my slides.

Basically I expressed the view that code generators are a very effective means of dealing with the kind of repetitive tasks that tend to crop up when programming, especially if you use effective tools such as Python as programming language, a parser generator such as PLY for information acquisition and a templating engine such as Cheetah for the actual generation.

The Borland / CodeGear compilers and Boost 1.35.0

May 5, 2008 by nmusatti

One of the many changes introduced with the new Boost release process is a drastic reduction in the number of officially supported compilers.  Although all versions of the Borland /  CodeGear compiler were left out, it should be noted that this only means that they have been excluded from the official release branch regression tests. This is not a good thing, as it makes it likely that regressions introduced late in the release process go unnoticed until after the release is issued.

On the other hand all the specific workarounds that I’m aware of are still present in the Boost source code and compilers from 5.6.4 onward work only slightly worse with Boost 1.35.0 than they did with the last few Boost releases.

To get a more precise idea of what works and what doesn’t you can take a look at the test results for the 5.6.4, 5.8.2 and 5.9.3 compilers. As you can see the 5.9.3 compiler does somewhat better than the other two, but there are things that stopped working for all three since the last Boost release.

However, now that gcc and VC++ are both rather close to standard compliance, Boost authors tend to rely more and more on advanced techniques that are only partly supported by the latest compiler, and not at all from earlier ones. This is likely to get worse – or better, depending on points of view – with each new Boost release. Let’s just hope that CodeGear manages to keep up.

A year and a half later, the problem’s still there

March 12, 2008 by nmusatti

This is something I wrote about a year and a half ago in a previous attempt to start a blog:

“Time to go to work and I’m getting ready. Cellphone in my right breast pocket, PDA in my right one, CD player in the one underneath. Considering that I’m wearing glasses and a wristwatch, and I carry a USB flash drive in my bag, that’s quite a number of devices. Do I need all of them?
Recently I started thinking about this because my cellphone is showing its age and so is my CD player. Given the way portable CD players have gone out of fashion I might as well give in and get myself an iPod or something of the kind. Now, my PDA is capable of playing MP3 files, but I really want something that supports some lossless format, which by the way means a hard disk. With luck I’ll manage to get rid of my USB key, the less unconvenient of my portable devices; on the other hand it looks like I won’t be able to eliminate any of my other gizmos and even attaining all my desires is not going to be easy:

  • There aren’t that many media players out there that support lossless formats; the iPod looks like the best one, but it’s a bit too proprietary for my taste;
  • Assuming I was considering changing my PDA, which I’m not, PDA/cellphone combinations are either unpleasantly bulky as phones or inconveniently small as PDA’s;
  • My PDA is a diskless Palm one, not the most convenient set-up to move data around, in terms of both storage and ease of use.

On the other hand I’ll probably be able to watch photos and videos on three different devices, something about which I couldn’t care less. What am I to do?”

Since then things have changed, but not that much; most important, the number of devices hasn’t decreased. I did change my cellphone and the one I got can both play music and act as a PDA – yes, I did notice that nobody’s making PDA’s any more – but the sound quality is awful and as a PDA it’s most inconvenient.

I also gave up my CD player and got myself a portable media player. At least I was able to get something that can play lossless format and has a capacity of 16 GB, solid state. I *could* give up my USB key, if it weren’t for the fact that it is more convenient to carry around than a USB cable. The PDA’s still alive and kicking, though.

Next time around I’m not going to settle for anything less than a Linux based smartphone that is reasonably convenient as a PDA and can play FLAC files better then my current player. It shall also support removable memory cards. It’s going to take a while.

Standard C++ and GUI frameworks

October 15, 2007 by nmusatti

A very common complaint against C++ is the lack of a standard GUI library. While I agree that it would be great to have one portable, modern GUI library, I don’t think it will ever happen. Traditionally, in the Windows market, GUI frameworks are a strong selling point for tool suppliers, so everybody has their own. Under Unix not only are GUI libraries mostly C oriented, but the one that emerged at one point as the vendor backed standard, namely Motif, has since been obscured by more attractive open source alternatives.

Among the cross platform C++ specific solutions available today QT and WxWidgets are probably the most popular ones, but they don’t appear to be suitable for inclusion in the standard. QT is produced by one of the field players and uses some non standard syntax, handled by a precompiler. The fact that Trolltech, QT’s developer, is including in it just about everything and the kitchen sink is not likely to help, even assuming that Trolltech is interested in QT’s inclusion in the standard, which isn’t something I would take for granted. WxWidgets, being an open source project, appears to be in a better shape from a political point of view, but while effective it can hardly be considered a modern design.

Another factor that must be taken into account is the advent of the web browser as an alternative interface paradigm. While I’m not convinced that this is an all-round superior alternative to GUI’s, it is often a valid contender and a more “fashionable” one. This is one of the reasons why I don’t see a business case for a new commercial C++ GUI framework and I don’t expect an open source one to emerge, especially in the light of the non trivial effort that a similar endeavour would entail.

Yet another option that is mentioned every now and again is the development and adoption of a simple, bare bones library. I don’t think such an approach would be of much use. In my opinion C++ is still chosen to develop GUI based applications because it guarantees responsiveness and control over appearance and behaviour of the interface. Ease of development is important, but not enough to be traded against speed and access to detail. This makes also adopting a thin wrapper over an existing , portable framework not viable. The other reason being that requesting vendors to supply an external library in order to comply with the standard would be awkward. The fact that C++ is defined by a standardization committee rather than by the developers of a reference implementation limits the extent to which an approach such as Python’s “batteries included” may be applied.

In my opinion, however, there is an alternative approach that might have better chances of succeeding: rather than aiming for a full fledged GUI library it might be more effective to concentrate on the interface between the GUI and the application logic and forsake everything that relates to the visual aspect of the interface. The resulting library would include a framework for event handling and callbacks, which might be based on the Boost/TR1 Signals and Function libraries; paradigms for input /output towards visual components, from toggle buttons, to text fields, to combo boxes; and possibly a validation framework.

I’m aware that such an approach would leave out a good deal of GUI programming, but a sound design would encourage a clean separation of GUI and program logic, and probably lead to more testable code. A similar library could be implemented as a set of add-ons for existing GUI frameworks, without requiring the implementation of a completely new one.

My, it’s damn quiet around here!

October 15, 2007 by nmusatti

It’s been some twenty days since my last post. What has happend is that, after languishing for several months as maintainer for a project scheduled to be dismissed, I’ve been moved to something completely different.

After refining my C++ skills for almost ten years, after embracing object orientation, then generic programming, then template meta-programming (in rather small doses, to be honest), an unexpected twist in my career has suddenly brought me to the extreme frontier of software development: Cobol on System i (aka iSeries aka AS/400).

Well, yes, so it’s the opposite frontier from the one that’s usually boasted, but frontier it is, at least for me. If we discount a couple of brief encounters with menu based applications that ran on IBM mainframes, it’s been close to twenty years since I logged into, sorry onto, a system I knew nothing about, the last one being VAX/VMS, I think.

I must say I find it rather amusing to have to learn a set of technologies that were considered obsolete when I was at the university about a quarter of a century ago. I expect to post more on the subject in the coming weeks, even though blog time has become awfully scarce.

Me mug’s on the web!

September 24, 2007 by nmusatti

For those less familiar with british idiomatic expressions, my face is on the web, towards the bottom of this page. Yes, I know, I know, but, I mean, if I weren’t a little vain I wouldn’t be running a blog, would I? :-)

Rasputin ha chiuso

September 23, 2007 by nmusatti

Doveva essere la primavera del 1980, quando Giovanni, un mio compagno di classe, mi disse che aveva aperto un nuovo negozio di dischi e che non doveva essere lontano da casa mia. A quei tempi avevo da poco cominciato ad espandere i miei  gusti musicali al di là dei Beatles e compravo i miei dischi prevalentemente da Stregatto in corso di Porta Romana, che presto si sarebbe riciclato come venditore di materiale informatico per poi chiudere definitivamente, o da New Kary in via Torino, anch’esso sostituito da tempo da un negozio di vestiti. Presto però, vuoi per la comodità, vuoi per la selezione disponibile vicina ai miei gusti, vuoi per i prezzi contenuti e le numerose offerte speciali, cominciai ad andare prevalentemente da Rasputin. Bisogna anche considerare che a quei tempi, con le loro sei-settemila lire per un LP, negozi come Ricordi o le Messaggerie Musicali non reggevano il confronto con i negozietti indipendenti.

All’inizio vendevano solo LP, poi aprirono uno spazio per i CD al piano di sopra e dopo pochi anni gli LP sarebbero passati a costituire una parte sempre più marginale dell’attività. Le prime avvisaglie evidenti della situazione si ebbero dopo Natale 2006; al ritorno dalle vacanze la selezione disponibile si era drasticamente ridotta. Poi alla fine della primavera ci fu una svendita al 50%. L’ultima volta che entrai nel negozio chiesi se stessero per chiudere ed i commessi con aria mesta risposero: “No, no, è solo una promozione che facciamo…”. Rasputin è chiuso da giugno e ora sta per aprire al suo posto l’ennesimo negozio di Benetton, del quale proprio non si sente il bisogno.

Ci sarebbe molto da scrivere sulla morte del CD, sulla rinuncia alla qualità della riproduzione musicale, sull’impatto della globalizzazione sul tessuto delle città… Per questa volta voglio solo ricordare un negozio al quale ero affezionato, la cui chiusura contribuisce nel suo piccolo a trasformare Milano in una città sempre più anonima.

The Nightfly – Donald Fagen (1982)

September 23, 2007 by nmusatti

After enjoying success throughout the seventies with Steely Dan, Donald Fagen opened his rarefied solo career with The Nightfly, one of the first all digital albums. The choice of technology fits well with the almost maniacal care that clearly went into both the arrangement and the performance of each of the record’s songs: nothing is left to chance, every note is exactly where it ought to be and not one note more than necessary is played. Even from the point of view of production great care went into ensuring that no instrument ever outplayed the others. When listening to The Nightfly in your headphones you get the impression that the musicians play in a circle, with no one ever taking the centre of the stage.

Fagen appears to have total control over both music and technology, but doesn’t let himself be distracted by expertise for the sake of itself. Rather, he bends it to his own purposes in order to achieve exactly the product he has in mind. The result is an album that does sound chilly as ice – sidereal is the adjective that comes to mind – but is neither uninspired nor a sterile exercise of virtuosity. While the overall style and atmosphere are decidedly uniform and lean towards the jazzy – some of the top jazz-rock musicians of the time play in the album – the songs have enough personality to stand out from each other. The Nightfly is also a sort of concept album, centered on the dreams and nightmares of the twentieth century’s fifties.

The Nightfly starts off with “I.G.Y.”, a pleasant song about the International Geophysical Year of 1957-58 and the wonders that science and technologies will bring. It is probably my favourite song from the album, along with “New Frontier” and the slower “Maxine”. An effective cover of Leiber/Stoller’s “Ruby Baby” is another highlight from this record: The Drifters meet The Manhattan Transfer, in a way. Still, it’s rather unfair to single out specific songs, as they are all good.

The Nightfly is a record you should listen to with your headphones late at night in the dark, but it’s also very good to listen to in the background, pleasant but not distracting. Definitely money well spent.

Milenio Carvalho – Manuel Vázquez Montalbán (2004)

September 18, 2007 by nmusatti

Amiga lectriz, amigo lector, perdonad mi español un poco estrafalario, esta es la primera vez que intento escribir algo en vuestro idioma. Pero leí Milenio Carvalho en español y me parece la lengua mejor para comentarlo. Si tened gana, no hesitad en señalarme mis errores.

Al parecer la novela de despedida es un genero especifico, particularmente popular entre los escritores de novelas de detectives. Tal vez sus personajes mas que otros adquieren vida propia y frecuentemente se genera una relación de amor-odio entre ellos y sus autores.

Así, a partir de Conan Doyle, muchos intentan liberarse de sus detectives, no siempre con éxito. Algunos mueren, y de vez en cuando resucitan en otras novelas. Otros se traen consigo todo su mundo, en novelas nihilistas che parecen expresar dolores mayores de sus autores. Hay algo triste y irónico en el hecho que esta vez fue Pepe Carvalho a despedirse de Manuel Vázquez Montalbán y no viceversa.

En Milenio Carvalho Pepe va a dar la vuelta al mundo, junto a un Biscuter lleno de sorpresas. En la primera parte del libro los dos consiguen ser perseguidos por toda clase de gentuza: mafiosos italianos, agentes del Mossad y otros por el estilo. Carvalho tiene también un enemigo que procede de El hombre de mi vida. Este lado “thrilling” no es el mas bien acabado del libro y me parece algo gratuito.

Mejor éxito tiene Milenio Carvalho como novela de viaje, sea por los personajes y la situaciones con las cuales van a tropezar Carvalho y Biscuter, sea por el análisis sobre el estado del mundo a la vigilia de 2003, en la que se entreve la estatura de Vázquez Montalbán como periodista.

Muchas novelas de despedida tienen otra característica común en el revivir la vida del héroe y Vázquez Montalbán no se sustrae a esta tradición. Pero nada es lo que era y el cansancio se apodera de Pepe, hasta el final triste y solitario, pero también algo inesperado. En realidad este viaje empezó mucho antes, desde El premio; tuvo una pausa en Quinteto de Buenos Aires y prosiguió en el ya mencionado El hombre de mi vida.

Tal vez el cansancio era el del autor; Milenio Carvalho no es el peor libro de la serie, pero es lejos de ser el mejor. Desde el comienzo de los años noventa solo Quinteto de Buenos Aires esta a l’altura de los mejores. Creo que el desarrollo de Barcelona quitó a Pepe su sitio en la ciudad y tal vez en el mundo y su autor no logró conseguirle otro.

Este libro sera mas apreciado por los que amaban Vázquez Montalbán como ensayista y no solo por sus novelas policíacas; a los que no conocen aun Pepe Carvalho les aconsejo empezar por las mejores novelas de la serie, desde Tatuaje hasta Los pájaros de Bangkok.

A new release of bcbboost

September 15, 2007 by nmusatti

I just released a new version of bcbboost, 1.34.1-5.9.2-0.2 , which supports Boost 1.34.1 and bcc32 5.9.2, which is the new compiler that’s part of C++Builder 2007 Update 3 and RAD Studio 2007. It should also work with bcc32 5.9.1 and 5.9.0, as well as with Boost 1.34.0 . This release includes improved support for the Iostreams and Parameters libraries.