Blog

Alfa Romeo Giulietta in Racing

This is a best effort at a list of all the ongoing, finished or upcoming projects where the Alfa Romeo Giulietta (type 940, the current one) is used as a race car.

Why am I doing that? Well, mostly because I drive that car myself (not in racing) and I was curious. But also because I can already see that history won’t be kind to this car, and will probably be cited as one of the low points in this storied italian brand. This has nothing to do with the car itself: It’s fun to drive, practical, has great styling and good marks on stuff like reliability and safety. The problem is that in 2011, the Alfa 159 got cancelled so Fiat could build more of their Panda. This made the Giulietta, a fancy-looking but ultimately harmless VW Golf rival that never sold all that well, the flagship model of one of the greatest brands in automotive history. And that was just sad.

And then Alfa Romeo is one of the great motorsport brands, winning for example the first ever Formula one championship. Alfa Romeo is literally where Enzo Ferrari got his start, and they built legendary race cars ever since. Until about 2004, when the 147 Cup ended, and there has been no works-supported racing by them ever since. Now we get rumors that Alfa might join the DTM (Alfa clearly doesn’t want to), or that Alfa might join the Formula 1 again… by relabelling last year’s Ferrari engines that some smaller teams buy. That sounds reeeeeally exciting. But the thing is: If you want Alfa Romeo racing, you can already get it, and it’s great fun to watch. And they’re racing the Giulietta! In at least seven different projects! Here’s the ones I found:

TCR

TCR is a fairly new race car specification designed to be cheap but fun, with cars that look really dramatic but are accessible to a wide variety of teams. These cars are used in a number of different championships, some for one or a few countries and a flagship TCR International series. It is also used for a growing number of endurance race series.

The car specifications are based directly on the SEAT Leon Cup, and the cars are in practice mostly designed by independent tuners with sometimes more and sometimes less support from the manufacturer. Big wings and engines tuned to go up to 350 HP are also part of the concept. Currently eleven manufacturers have cars there, with more on the way. The Giulietta is one of them, with the race version designed by tuner Romeo Ferraris (despite the name no direct relation to either manufacturer). Alfa Romeo’s support seems to have started and ended at them saying „good luck, guys!“, while e.g. Volkswagen designs the complete car and sells it to others. Despite that, it’s proven capable of winning races.

Its first use was in the 2016 TCR International championship, with the Romeo Ferraris team, where it proved underpowered and in need of major work. It skipped a few races, then ended in a new but still not that competitive version. Over the winter, a lot more work happened, and it appeared again in the TCR Middle East, a very small series that was mostly european teams testing their new cars and drivers. Here it proved competitive, getting a number of second places. Now it’s again in the international series, and it managed to win the very first race of the season outright. Since then there have been more victories and podium positions. Performance has not been quite consistent enough to be a serious championship contender, but it’s getting there.

A note on team names: In 2016 it was „Romeo Ferraris“, then in the middle-east series it was „Mulsanne Racing“, and now it’s „GE-Force racing“. As far as I can tell most operation is handled by Romeo Ferraris either way, with key personnel such as Michele Cerruti (driver, team manager and one of the people who developed this car) appearing in all these places. However, Romeo Ferraris will also sell this car and so far managed two sales to other teams.

The first is Hungarian team Unicorse, who got one car, in red. It has participated in the Hungarian round of the international series in 2017 (no interesting placement). There were announcements that it would appear in the ETCC, an earlier touring-car championship that also allows TCR cars, but so far that does not appear to have happened.

Two more Giuliettas are run by V-Action in the TCR Italy championship, starting in the second half of 2017. One of those was also entered for the final round of the TCR Germany 2017 as a guest starter. Keep the TCR Italy in mind, we’ll keep coming back to that.

In short, as of right now, I’d say TCR has the queen of the Giuliettas, and if you’re interested enough to have read through here then you might enjoy following it. You can watch it all for free on Youtube.

TCT

Here it starts getting complicated. TCR Italy also allows a second type of car called TCT, which uses the same technical specifications as TCR, but only has a national instead of international type approval. I think this means that these are cheaper. In this context, TCT does not stand for twin clutch transmission, a feature you can get for normal road-going Giuliettas, which makes googling the whole thing a bit annoying.

A team called Etruria has developed a version of the Giulietta for this and raced two of them. The overall technical data seems very similar to what Romeo Ferraris did for TCR (the specification is the same, after all), but the resulting car looks quite different, with different body kit and air inlets. Personally, I don’t like it.

These cars ran in 2016 and some races in 2017 and were never all that competitive with the TCR cars. These cars have not raced at the same events as the TCR Giuliettas of V-Action, so sadly we don’t know which team did a better job. I’m not sure they will either, since at least one of the TCT Giulietta drivers switched to the TCR Giulietta.

Apart from that, TCT also featured the car driven by Gianni Giudici, a guy who will appear a lot on this list. If you look at the picture you’ll see that this car does not look like a TCR or TCT car at all, really. I don’t know what’s up with that, but if I had to guess, I’d say this: Giudici also ran a Giulietta in the VLN before that (we’ll get to that in a bit). What if he simply re-used that car here? Since it was built for a different series, it might not fit into the lower-spec TCS category (see below), so it ends up in TCT by default. The new rear wing is actually required for TCR; I’m not sure if it’s also required for TCT or Giudici simply decided it was a good idea. Either way the car didn’t prove very competitive with the cars of any category, and it hasn’t been seen since.

TCS

TCS is yet another specification for race cars found only in Italy. In 2017, the TCS is run as a separate (and mostly Seat-only) series, while in 2016 TCS cars took part in the TCR championship, classified separately. Before that, the story gets even more complicated; at one point, the TCS was actually the only type of car in the Italian Touring Car Championship.

The fundamentals of the car remain fairly similar, though: Relatively little changes; Cars get cars fitted with roll cage, safety equipment and some tuning to engine and suspension, but no massive wings or much bigger wheels or similar. There are further sub-divisions based on displacement, but the starter field tends to be small, so e.g. TCS 1.4 has generally only had one or maybe two entries these season.

This series has featured several Giuliettas. Sadly the sources for this are all in Italian, and they’re full of people announcing things that then never happen, so this part took a bit of digging and I don’t guarantee that my information is correct. That said:

This year there are no Giuliettas that actually ran. Leone Motorsport did announce that they wanted to run a car and got it featured on websites and on the March 2017 issue of an italian motor sports magazine, but the results show that it never actually took part in any TCS race.

The team (or its driver anyway) did run before that, though, in the 2016 series, where it managed a „not classified“ in the first free practice of the first race. Later they got two „not classified“ in actual races, with different drivers as well, and rather low placements in qualifying.

Distinct from that (I think), in 2015, Gianni Giudici also raced a Giulietta in the TCS series, in Monza. I don’t know whether it has anything to do with either his TCT or VLN efforts, and he didn’t do particularly well (9th place out of ten finishers after not classifying in the first race).

For fun: In 2016, the series also had some Alfa Romeo Mitos, a car that actually deserves all the dismissal as „not a true Alfa Romeo“. I’m exaggerating a bit, but a high seat position and steering with almost no feedback make for a boring drive and it’s amazing how little interior space it has compared to how large it is on the outside. Anyway, the race version, built by Tecnodom, comes in orange. Very orange. They often won the TCS 1.4 category even when they weren’t the only ones in it (meaning they placed in front of the one Fiat 500), and were at times even competitive with some TCS 1.8 racers. They did not run in the same race as any of the Giuliettas, though.

VLN

I’ve mentioned Gianni Giudici a few times before, but this seems to be his main effort regarding Giuliettas. The VLN is an endurance racing series, meaning races that take at least six hours, organised by the group of organisers that host the 24 hours race at the Nürburgring (in german: Veranstaltergemeinschaft Langstrecke Nürburgring; this catchy title produces the abbreviation VLN).

Annoyingly, this series does actually speak my language (i.e. german), but it doesn’t provide any useful way to find historic information about placements. From what I could gather from their news and fan sites, they ran at least one race where they managed a third place in their category - out of four. In presumably a different race, the car had quite a crash. It’s still notable because one of their drivers is none other than Nicola Larini, a legend among Alfa Romeo race car drivers from the good old DTM days.

It’s also important to note that many people, including Giudici, announce a lot of stuff that never ends up happening, and I tried my best to exclude that. If you look up Giudici you will find a lot of that. Among other things, apparently he wanted to build his own TCR Giulietta at some point, and besides Larini, he also wanted to hire Nannini for the VLN series. Also, he has some good graphic designers working for him, so there are a lot of pictures of Giudici Giuliettas that never actually existed in real life.

Meanwhile, this isn’t the only place Larini has turned up. The TCR series features a balance of performance system, where all cars get evaluated and then get ballast weight added or removed to bring them all to the same level. Larini is one of the two evaluation race drivers for this purpose, and used to be the only one last year.

BTCC

This is only an announcement at this point and thus something I’m a bit wary of, but I figured I should add it for completeness anyway. The British Touring Car Championship is a series that uses its own regulations, which are somewhere between TCR and the Silhouette racers of the current boring Alfa-less DTM. The shell of the car is fundamentally from the production vehicle, but anything underneath gets ripped out and replaced by standardised sub-frames holding standardised suspension equipment, and there is even a standard motor teams can (but don’t have to) use.

In 2018, team Handy Motorsport (who are currently running some Toyota) plans to run a newly built Giulietta in this series. The high standardisation should make this relatively straight-forward, and they have announced that they will use the standard engine instead of trying to tune the one in the production Giulietta. They already have a demo car, but that is just a standard production Giulietta with stickers.

British Giulietta fans may also want to look to the upcoming TCR UK, a TCR series in the UK that positions itself as an entry-level series below the BTCC. There has been no announcement yet (not that announcements mean anything), but at least some british drivers have test-driven TCR Giuliettas already.

Targa West

So here’s a weird thing that came up on Google: Apparently a Giulietta was used on an Australian rally, and did pretty well in the „show room“ class. This answers the age-old question of „Are there Alfa Romeos in Australia?“. The one and only source I could find was the racer bragging on an internet forum, so I’m reluctant to call this the most important thing ever, but it definitely counts for this list.

Die Ostdeutschlanderklärer

Es gibt eine neue Art von Lieblingsartikel in der deutschen Zeitungslandschaft: Wessis machen eine Rundreise durch die neuen Bundesländer und berichten dann den anderen Wessis, wie „die da drüben“ so ticken und wieso „der Osten“ immer noch nicht im vereinten Deutschland angekommen ist. Es gibt viele dieser Artikel, und der Fokus variiert - mal sind drei Statistiken dabei, mal dürfen ein paar „echte Ossis“ ihre Meinung kundtun, aber das Grundprinzip ist immer gleich. (Der, der mich gerade aufgeregt hat ist hier zu finden - hinter einer Paywall, aber letztlich nicht wirklich Geld wert). Man schreibt über gute Straßen auf denen schlecht gelaunte Leute laufen, über sozialistische Sozialstrukturen die jetzt fehlen, und natürlich immer über die AfD, ohne die man sich ja die ganze Mühe, mal „rüber“ zu fahren, nie machen würde. Nur für eine Erkenntnis ist nie genug Platz: Das solche Artikel ein massives Teil des Problems sind.

Eines der grundlegenden Probleme des vereinten Deutschlands ist, dass die Einheit nie in den Köpfen der Westdeutschen angekommen ist, und dass man auch nie den Versuch unternommen hat. Diese Artikel sind dafür ein wunderbarer Beleg. Bis heute gilt in den deutschen Medien die Westdeutschlandsvermutung: Die Geschichte und Erfahrung der BRD ist der Standard; die ehemalige DDR ist eine Anomalie die man extra erklären muss. Wenn man zum Beispiel auf der „einstiges“-Seite von Spiegel Online die wichtigsten oder interessantesten Punkte der deutsche Nachkriegsgeschichte ansieht, dann sieht man Bundesliga, RAF, Privatfernsehen, derzeit sehr viel über Seenotretter, und natürlich den ersten Supermarkt Deutschlands in Köln. Immerhin wird da kurz erwähnt dass es so was auch in der DDR gab.

Wenn die DDR vorkommt, dann als die Ausnahmeerscheinung. Beispielsweise gibt es in der Serie über Seenotrettung genau einen Artikel der sich damit beschäftigt und klar macht dass es heldenhafte Rettungen nur im Westen gab, im Osten war natürliches alles Stasi. Denn wenn die DDR erwähnt wird, dann kann das nur im Kontext der Stasi passieren.

Bundesdeutsche Kultur ist und bleibt westdeutsche Kultur, egal woher die Kanzlerin kommt und wie viel in den Filmstudios Babelsberg produziert wird. Geschichten wie die DEFA-Winnetou-Filme oder Urlaub am Plattensee sind es nicht wert erzählt zu werden, so lange man noch nicht den ersten Versprecher im ZDF erwähnt hat. Das westdeutsche Wirtschaftswunder wird gefeiert; die ostdeutsche Wirtschaft ist stets ein großer Haufen von Ineffizienz in denen allen Arbeitern alles egal ist. Dass die DDR in vielen Bereichen im Ostblock technologisch führend war, die zweitgrößte Wirtschaftsmacht und den höchsten Lebensstandard pro Kopf hatte, wird ignoriert. Dass die meisten Leute dort hart gearbeitet hatten und Stolz auf das Erreichte waren passt nichts ins Bild oder ist vielleicht auch nicht bekannt. Und das ganze Themengebiet Treuhand sieht man anscheinend nicht als relevant, obwohl man doch angeblich verstehen will, wie es den neuen Bundesländern heute geht.

Hier wäre mal eine These: Könnte es sein, dass die Menschen in den neuen Bundesländern, die sich so abgehängt fühlen, vielleicht auch in mancher Hinsicht abgehängt sind? Dass die Ostalgie lebt und blüht, weil es immer noch keine gesamtdeutsche Geschichtsschreibung und damit kein gesamtdeutsches Identitätsgefühl gibt? Und könnte es vielleicht sein, dass man über solche Themen reden muss, nicht nur wenn die AfD in den Nachrichten ist oder am dritten Oktober? Ich persönlich denke, dass so was sinnvoller sein könnte, als der nächste Artikel mit dem Grundauftrag: „Echte deutsche (Wessis) erklären dem echten Deutschland (Westdeutschland) wie die Ossis so ticken“.

Eclipse E4: A Critique

At work, I’m developing on a large internal application based on the Eclipse Rich Client Platform, which is basically the foundations of the Eclipse IDE made available for everyone else, too. As platforms go, it’s alright, I guess, but it does have its share of weirdness. For example, why do I have to dispose colors once I’m done with them!?[^1](#) But with a healthy amount of helper functions, it’s all manageable.

[^1](#): For compatibility with 8-bit indexed displays. Since this is nowhere near a target for our app, I generally don’t dispose colors.

We’ve recently finished porting the application from Eclipse 3.7 to the 4.x line (specifically 4.5, planning to upgrade to 4.6 once it’s out). This may seem a bit late, considering that the first official release of that line, Eclipse 4.2, came out four years ago. After working with the new code, though, I’m starting to think that maybe we’re still too early. Eclipse 4, or e4 for friends, features a massive rewrite of some of the core parts of the platform. And I think that it’s unfinished and in parts rather misguided.

Unfinished Business

Editors are gone, as are views, replaced with generic parts. I could get behind that, but gone as well are editor inputs objects. So telling an editor what file to open and making that decision persistent requires custom logic - and possibly a lot of that if you relied on the flexibility editor inputs gave you. You might see the MInputPart in the documentation, but apparently that was never implemented and is now deprecated. I think the only reason it’s still in the documentation is to taunt people. Of course, even if it did work, an URI based scheme only brings you so far if you have an editor that is supposed to receive objects from many different sources.

Many classic services have no e3 equivalent. For example, the IFocusService lingers around, but it’s very unclear whether I can rely on it once we’re e4 only.

No documentation

The documentation for new e4 specific stuff is largely missing or automatically generated and not helpful at all. I dare you to find any information in the documentation of MToolItem that isn’t obvious from the method names. What’s particularly missing is overview information: What do the different parts in the application model actually mean? What’s the difference between a MPart and a MPartDescriptor, and which one do I need? What’s the lifecycle of a MPart exactly? What is the point of context activation?

The best source of information are the rather terse Vogella tutorials, but these are task-oriented, not concept-oriented. If you want to do something that no Vogella employee wanted to do yet, you’re largely on your own.

Loose coupling. Like Spaghetti

I like the idea of dependency injection in theory, but I’m not sure about the practice. And I have no idea whether that is an Eclipse thing or not, but it still irks me.

The basic idea suffers from two problems: You want all dependencies passed in externally instead of getting them from some global nebulous set of singletons and what not. That’s valid. But you also don’t want gigantic constructors with 200+ arguments for complex classes. Not that you should have classes like that anyway, but a complex editor implementation can reasonably require access to most services Eclipse provides, even if it is just passes them on to helper objects.

The solution is more or less to put all that global state in a map, then pass that map as the argument to every constructor, and allow it to create new versions of the same map internally. Only they chose a more complex version that also has a lot of syntactic sugar, to make sure it runs really slowly. Eclipse has a reputation to maintain, after all.

As a result, you still have no clear idea what part of the application needs access to what unless you search for type names, and now you also have no idea where it’s coming from. It’s not so much that it’s bad per se, but it definitely does not realize the advantages that dependency injection was meant to provide.

And while we’re here already: The way event handling is done via dependency injection is just insane.

Horribly bad ideas

I honestly don’t get the application model, and not just because there is no real documentation on it. I have no idea why it’s here at all, what problems it’s meant to solve, and how it thinks it has solved them. And most of all, I don’t get why so many Eclipse developers are so damn happy about it. “Look at this”, they go, “I change the window’s title in the application model, and the window’s title actually changes! And I can even do that… at runtime!” And then they’re surprised when I don’t applaud.

But hey, whatever, I’ve been able to write helper methods and helper classes to get around any problem in e4 yet. The real problem of the application model is that it seamlessly merges user state and declarative application code into one giant ball of mud. And then it makes that mud persistent, which is just as unpleasant as it sounds.

Because suddenly, changes in user state get the opportunity to conflict with changes to declarative application code. Will my new context menu show up if the user has moved any editors around? For that matter, will my old context menu continue to show up? Surprisingly often, the answer is no, and never for any good reason I could discern. By merging what absolutely had to stay separate, they built a giant bug-producing machine.

And they know it. The closest thing to an official recommendation is to simply disable persistent user state. Only during development, in theory, but they sure don’t provide a better way to deal with the problem once I release an update of my app. In my opinion, this wins the very highly contested price for least user-friendly thing ever done in Eclipse.

Oh, there’s a workaround, but it’s one that nobody will tell you about, and it’s the most WTFy thing I ever implemented, to the point that I still can’t quite believe that this is what it takes. But I’m doing it anyway: I wrote my own code for serializing the application model to an XML file and back, making 100% sure that I only touch the parts that the user can change (i.e. what editor is where), but not the parts that are declarative program code. It’s been a few months since I implemented this thing, and I still sometimes wake up in the night and shout “There must be something better! Some simple flag I missed somewhere!” Do drop me a line if you found it.

Handlers

Finally, command handlers. The new way of writing them is good. Having the validation logic in the handler itself as opposed to an XML file somewhere is better. Good choices all around.

Less good: Why can I have only one handler per command per part? I kind of need several different “delete” handlers for different parts of some more complex editors, thank you very much, and I have only limited interest in creating one giant monster handler that contains the delete logic for absolutely everything. Of course it’s possible to work around that; I’ve managed to work around every little thing in e4 except the application model weirdness so far. In this case, write one handler that creates an internal list of other handlers, then asks each whether it can execute and the first one to shout yes gets to do the job. But I don’t get the logic that says I have to write stuff like that.

I also don’t quite get why some handlers exist and others don’t, but that’s less of an issue.

No tool support

Why is it that so many new things are released without good tool support? Do people somehow think that’s optional? I don’t see it. For example, to port from e3 to e4, there is an awful lot of getting information out of one XML file, translating it, and putting it into a different XML file. It’s boring, tedious and straightforward. And the one and only tool I found for that is one I wrote myself (No; you can’t have it. Nothing personal, but I have no idea what hoops I’d have to jump through to get something developed internally released as Open Source here).

The tools that do exist regularly stop accepting copy and paste and have no useful search. Most of them aren’t part of the platform proper, but require a separate download. It all feels very experimental. I went back to editing the XML files by hand.

Overall

Overall, e4 is still very far from done, and that’s frustrating. But in a few places, even the core is wrong or at least questionable. And while it looks like Eclipse 4.6 will solve a few issues I’ve been having (Generics for Databindings! Hooray!), they don’t seem even interested in solving the big ones.

Agents of SHIELD retrospective

So I wrote this a while back, posted it elsewhere, then forgot about it, until I was reminded the day before yesterday that this wouldn’t be all out of place here, either. So let’s talk about a TV show that I found really disappointing once more: Agents of SHIELD.

At the start, I was really excited about it. Then I was disappointed. Then I got angry. Then it got better again, so by now my feeling is mostly “meh”. And what a big “meh” it is; I’ve been putting this off for more than a week after the final episode of season 1 aired and I still barely have the energy to get through this post.

The show certainly means well, although it really tries more to be a Joss Whedon show than a Marvel property. I guess the writers had prepared a checklist pretty much like the one I posted above and were trying their best to fast-track through it. This became very apparent later on when the characters basically outright stated “That bonding over a common enemy thing? Might as well do that now, nothing else interesting going on this episode”. And never forget that “the Bus”, their plane, is for all points and purposes the Serenity from Firefly. Similar looks, capabilities, identical internal layout including which character owns what space.

What it lacks is the depth and complexity that real Whedon shows have. For all of the characters, their motivations, strengths and flaws can be described in two sentences at most. Instead the show tries to keep our interest with layers of mystery and question after question. Lost has been getting a lot of shit for this, but there can be no doubt that Lost did it way better. The story of Coulson’s resurrection, for example, is in the end neither particularly complicated, nor does it mean much for his character both in how it happened or in how he reacts to it. It’s also kind of stupid. But in Agents of SHIELD, kind of stupid is probably the biggest compliment you can make, considering that the show is so very frequently extremely stupid.

For example, take the episode 0-8-4. How many trained Agents of SHIELD and peruvian military police does it take to stop one Land Rover filled with I guess about three or four insurgents? I don’t know, but it’s gotta be more than 6 and about 15, respectively, because they try and fail. Then there are things like where the “adorable quirky” (annoying) scientist guy gets to go out in the field with the actually competent person. Yeah, Fitz isn’t field-rated, I get it. But are you seriously telling me he’s never even seen a spy movie before?

It all works out for the heroes because the villains are just as stupid. Take the excavator thing: The bad guys didn’t need an excavator to open the secret SHIELD truck; it had normal doors (with some boxes stashed behind to throw anyone who opened the doors of track, so clearly they weren’t welded shut). They don’t use the excavator to open the secret compartment within the truck either; that job goes to a blowtorch. And they paid for the excavator in gold bars, which seems hardly reasonable. Of course the gold bars can be traced back to the main villain’s gold mine, something that a gold mine owner probably should have known. Oh, and the entire plot hinges on Malta not being a member of the UN or EU (it is, of course, a member of both organizations). This is some serious multi-level idiocy going on here.

Later episodes pick up the slack quite a lot, and at turns even make fun of themselves, for example when Skye reveals that her name (given to her at the orphanage) was Mary Sue, or my personal favorite: When Agent Hand sees all of Team Coulson’s incompetence and deduces they must have been Hydra all along.

But at that point the show was doing exactly the same thing as „Captain America: The Winter Soldier“, and boy does it not hold up. I get that a TV show with a limited budget can’t look as good as the Hollywood blockbuster, but the longer running time should allow it to have better human drama. It doesn’t. Captain America wins on all fronts here with Cap as an all-around good guy who never actually becomes boring, an interesting friendship with Black Widow, inspirational speeches that actually work on me (and I’m a long-standing cynic) and real pain over the thing with Bucky. Even Falcon with his amazing lack of screen time has more personality than most of the Agents of SHIELD group.

Also, somewhere before there, I think I’ve kind of stopped caring. I mean, the final resolution to “how and why did Coulson get resurrected?” was “Nick Fury did it because Coulson is a nice guy whom everyone likes”. Seriously. And my reaction to that was “eh, could have been worse”.

Finally, to wrap this up: The show doesn’t look that good. Don’t get me wrong, it looks perfectly okay in a late 1990s kind of way. But we live in an age where Heroes, Lost, Breaking Bad or further out of the field Gossip Girl have established strong visual identities on TV. Whether it is through the choice of color, editing, or other things, these shows have character. SHIELD is, visually, less exciting than Bones or Castle.

In total: Agents of SHIELD is really not worth the bother. The later episodes are at least not offensively stupid anymore, but there isn’t really anything else to get passionate about either. Season 2 has been announced, but I’ll probably skip it. Here’s hoping that these Netflix shows or Agent Carter do better.

DAG vs. Tree

I am wondering whether the data structure “tree” might be a giant mistake in the history of computer science. Almost everything that can be saved in a tree is really a DAG.

Some background: A tree is a data structure consisting of nodes, where each node has one or no parent (this is technically a forest; a tree has only one node with no parent). Each node has children; specifically the nodes that have that node as its parent. Circles are forbidden.

The best-known example for this are computer file systems. Each file is in a folder. That folder is in another folder and so on, until you reach the drive, which forms the root of the tree. Mail lists and some kinds of forums and comment systems also work like that: Each post is a reply to exactly one previous post (at most) and gets shown a layer below. However, tree structures predate computer science. The whole field of Taxonomy as well as linguistics, both with their habit of grouping things in families and sub-families and so on, do exactly the same thing.

It’s easy to process trees automatically, for example to find all children. You can also identify each child uniquely through a given path.

There is just one problem with them: Reality does not work like that. In most real-world cases things, can have multiple parents. A classic example: What folder does a file fit in? Likewise, in discussions, sometimes you want to reply to several posts that make similar points at once. In linguistics, languages don’t really belong to one family exclusively, they have influence from lost of different ones.

To get around that, one either has to pick a parent explicitly, or split the object. Splitting works for discussions well, for files sometimes, for e.g. classification of car types not at all. In either case, information about the semantic relationships is lost.

The answer to that is called DAG, for Directed Acyclic Graph. The rules are almost the same as a tree, only a node can have more than one parent as well. An example: Media library apps like iTunes allow a song to appear in several playlists at once.

DAGs represent the examples here naturally. A file can be in two folders, for example. Since a tree is a special case of a DAG, it’s also easily possible to represent the cases that actually are tree-like.

In reality many systems already include hacks to create DAG structures. For example, thanks to Hard links, most file systems actually are DAGs, they just don’t show it that often. Symlinks, Aliases and Windows shortcut files all create a “second-class parent”, which explicitly stores the removed relationships.

Another approach is through tag systems, where a file, blog post or similar can have an arbitrary number of tags. This structure is actually just a two-level DAG. That may seem like a solution, but since it isn’t possible to form relationships between tags, and because many use cases of trees can’t be modeled that way (for example discussions), it isn’t a full replacement.

Admittedly, from a technical point of view, DAGs are much harder. For example: A tree is always planar, which means you can easily show it on a screen without crossing lines, something that is not guaranteed for DAGs. Enumerating all elements without repeating any is a lot harder. Objects can be reachable through two completely distinct paths - which is of course the goal, but it means you have to look at the graph to answer the question “do these two paths end at the same object”, which is trivial with trees.

Most importantly, I know no really good UI to show and manipulate DAGs. For example, the opposite to a tree structure in forums is not a DAG, it’s a simple list ordered by time, and the relationships between posts have to be shown manually in the text.

(Of course, this does not affect the use of trees in cases where end users don’t see them, for example search trees, heaps and so on.)

What do you think? Due to too much spam, I’ve disabled the comments here for now, but you can reach me on Twitter via @zcochrane.

30 years of Mac

When I bought my first Mac in 2002 (an eMac with 700 MHz G4), I considered myself a late-comer to the party. Today, in most groups of Mac users, I am among the one who has been using one the longest.

Unlike the many people who are now posting about how they saw their first Mac and were instantly hooked, I sort of slid into the whole thing. The first Mac I ever saw was a PowerMac G4, still with pinstripes, owned by my father for layout work. It ran Mac OS 9, which was certainly different but didn’t seem in any way interesting. That changed considerably with the second Mac I ever saw: An iBook G3, the white edition, running OS X 10.1. It was rather slow, there was barely any software, but I really liked it. I’d like to say that this was because I saw the great vision and the things to come, but in reality, pretty graphics were probably the real factor. A big part of that were the free development tools: Project Builder and Interface Builder, these days both known as Xcode. Finally, I wanted iTunes and an iPod. Both were really, really impressive to someone who was used to the horrors of Winamp and burning CDs for portable CD players.

It’s been an odd ride since then. When I started, the transition from OS 9 to OS X was still in full swing. Then Apple switched to Intel, then iOS (or rather the iPhone OS as it was known back then) became a huge thing. Apple rumors used to be an important and often accurate source of information, but that scene has almost completely died. Perhaps because all the rumors that ran forever (Apple will switch to Intel! Apple will release a successor to the Newton! Apple is building a phone! Apple will make a mouse with a second button! Apple will make a tablet!) have ultimately proven true, but usually not in the way anyone expected.

Important for me: I learned basically everything I know about programming and software development on my various Macs. It’s still my biggest hobby, and its how I make money these days, and while I have no idea whether I’d be elsewhere without a Mac, I know that without it, it would have been a lot less fun.

Agents of Shield - Checklist filled

So let’s see how that checklist works out in practice then. Oh yeah, spoilers:

  • A group of people that don’t get along initially, but grow to become a family? - Yeah. Still working on that growing to be a family.
  • A scene where it looks like a tiny girl is in danger, but in reality she’s the one in control of the whole situation and the most dangerous thing all around? - Yeah. This time she’s evil. In a wider sense, the villain of the week is male but portrays that power reversal, too.
  • A “oner”, meaning a very long shot where the camera moves to a space without cutting? - Not yet.
  • An episode where information is conveyed through music? - Not yet.
  • Beloved minor characters who die? - Not yet.
  • Characters in so much pain and angst that they can barely walk? - Yeah. Charles Gunn.
  • Pop culture references? - Oh yeah. “With great power comes… a whole lot of shit that you’re not prepared to deal with.”
  • Actors from previous Joss Whedon works? - Charles Gunn, Shepherd Book, the Serenity. And a discount version of Eliza Dushku.
  • A great sense of humor? - Hell yeah. “Sorry, the corner was dark, I couldn’t resist”
  • Horrible things happening to people in love? - still too early for that