This is not my country

It’s simply embarassing when a german party makes a public request to be allowed to deny the Holocaust and publicly advertise their hate to homosexuals and foreigners, arguing that this would all be freedom of speech. I mean well, ok, it probably IS freedom of speech, but it’s simply embarassing. Those who like to see themselves as patriots are the exact opposite, they are damaging out country in the public like nobody else, well except maybe their idol Hitler. I’m pretty sure they confuse patriots with idiots. I’d like to be proud to be german, I even try sometimes, but it just doesn’t work.

Pipes and Loops

Today I spend some time studying the Java2D code of OpenJDK
(finally!). It is quite confusing when you come from other Java2D implementations that work completely different (because they are mostly AWT1.1 Graphics derived).

In GNU Classpath, the Graphics and Graphics2D subclasses are relatively specific. For example, there is one CairoGraphics2D class that renders to a Cairo surface, and a bunch of subclasses for more specific surfaces. While that makes sense from an object oriented POV, it has its problems. For example, it is a little difficult to share implementations for an algorithm (e.g. drawing a line) between otherwise unrelated Graphics implementations (e.g. a BufferedImage Graphics and a Framebuffer Graphics).

(Disclaimer: don’t take the following architecture description as authoritative, it is the result of only a couple hours of study and is certainly wrong in some places. If you know better, please comment below, I’d really like to understand all this as well as possible).

In OpenJDK the architecture is very different. There is only one final generic implementation for Graphics2D for all rendering, the SunGraphics2D class. This is the front-end of the rendering pipeline. This class is driven by a SurfaceData object, which serves as the central interface to the graphics backend. The SurfaceData sets up the pipes and loops that are used to render to the actual drawing surface. So what’s with those pipes and loops?

Pipes are the building blocks of the rendering pipeline. In a simple case, a pipeline is only one pipe. For example, if there’s no transform, no paint, no composite, etc (that is, a simple AWT1.1 like setting), then the pipeline for drawLine() (and the other primitives) in the X11 backend only consists of the X11Renderer class, which basically only calls the corresponding Xlib function. However, if there’s a more complicated configuration than that, the pipeline also gets more complicated. For example, a drawLine() would actually be drawn by creating a Line2D object, and rendering this as a generic shape, by plugging together a PixelToShapeConverter (which is a PixelDrawPipe and a PixelFillPipe, that means, it serves to draw and fill graphics primitives) with a SpanShapeRenderer (a ShapeDrawPipe) to render that shape. Another example for a pipe can be found in the OpenGL rendering pipeline, where all rendering goes through a BufferedRenderPipe to queue up rendering instructions for single threaded rendering. At the end of a pipeline is usually some call to a graphics primitive that is implemented by the graphics backend.

But what if the graphics backend has no way to implement a certain graphics primitive? An extreme example would be BufferedImage, which doesn’t even have some kind of graphics backend. This is where the loops come into play. The loops are implementations of graphical algorithms for all kinds of graphics primitives (lines, rectangles, but also images, blitting, text, etc) on different output formats. A sophisticated registry and lookup is used to find the rendering loop that is best suited for a given primitive on the source and destination rasters with the current composite setting. And then there’s always the generic fallback loops for the more exotic configurations that can render anything, but slower.

I think that this is a very flexible and efficient architecture. It allows for good reuse of the involved algorithms across different backend implementations, while still allowing to plug in optimizations for everything, if available.

As a learning exercise I will try to implement a rendering pipeline based on Escher. If that works out nicely, it could be an interesting project to use Cairo as a backend.

Please comment below if you have any additions and/or corrections on my architecture outline. Thanks.

Job odysee

Earlier this year I finished my Diploma in Computer Science and this brought with it an interesting journey of job offerings interviews and decisions, eventually leading to me beeing self-employed (not yet, but soon).

The first couple of interviews I had even before I finished my degree. In february I talked to Christian Meder from Inovex, a small to mid-size company in Pforzheim. That was a very nice interview with him and his boss, and they would have hired me in the end, but I couldn’t decide to take the job because I didn’t like Pforzheim and the whole area a lot and J2EE / .NET simply wouldn’t fullfill myself really. Anyway, thanks Christian!

Also in february I was talking to Brian Beck from Sun’s Swing team. He’s been very kind and we had some nice talks, but in the end it didn’t work out either. I think that was a bit of bad luck. As far as I can see there have been two factors that lead to that failure. First, I think I screwed the technical interview, I really didn’t prepare myself for that and it was very late in the evening in my time zone. Then there was this hiring stop thingy which seemed to prevent Brian from hiring me. Too bad, I still think that working in the Swing team would have been great fun. Later I’ve been called by Christopher Oliver from JavaFX, but that didn’t work out either. I guess we just couldn’t get warm really. He even contacted me again in July, with the same result.

In march I’ve been contacted by Leila Petterson from Google. I kindof applied for a Software Engineering job earlier (in january). The was the only job application that I did btw. At this time I’ve already given up hope to hear back from them, but then everything went really fast. They did a phone interview and then invited me to an on-site interview in Zurich. There I’ve met a bunch of very interesting people, I remember the names of Bram Molenaar (the creator of Vim), Patrik Reali (former classpath contributor) and went to lunch with Sascha Brawer (also, former Classpath contributor and project leader IIRC). All in all it’s been 5 interviews, one hour each, and I thought it went quite well (ok, it wasn’t perfect, there’ve been one or two questions where I really couldn’t say something useful). In the end they offered me an intern position, which was not quite what I was looking for. I’ve been told I lack the ability for high-level thinking. Hmm, I didn’t know what to say, but I guess these one or two questions have been important. Maybe this how they treat fresh graduates. Not sure really, and I don’t care that much.

A little while later, Andreas Tobler invited me to an interview in Zurich at Nexus Telecom. The interview went really well and they offered me a good position, but all in all it wasn’t attractive enough that I would move to Zurich (which I didn’t like that much), especially in the special situation back then, with Madeleine beeing highly pregnant. I’d like to thank Andreas for his invitation and the nice day in Zurich.

In the end, I decided to stay at aicas, the job has always been fun, hacking a Java VM, doing graphics backends, a lot of debugging, bug fixing etc. Then the JDK has been opened and this made working there even more attractive. I think this has been the best decision.

But still. One think that has been brewing in my mind for quite a long time is now getting through. Working in a company as an employee just doesn’t seem right. That’s not what would satisfy me for a longer time. What I want to do is working freely and self-determined. And that is what I am going to do now. These days I am really considering going the freelancer/self-employment route. Over the last months I had a couple of opportunities, some of which I had to decline because I’ve already been full with my work at aicas and family stuff. I think my chances to make a living as freelancer aren’t that bad, and I already have one or two possible partners and a couple of possible customers to start with. I think for the start I will be focusing on what I am best at (all things free Java), but I’m certainly not limited to that. Actually, one project I’ve already put my hands on is not at all related to free Java, but to schools and how they plan their lessons and is implemented in Python. So, wish me good luch with that and if you think you are in need of a skilled professional software engineer, don’t hesitate to contact me!

PS: Just today I’ve been contacted by Google again, now for a job in their Site Reliability Engineering team. This time I have to decline right away, unless they would work with me as a freelancer ;-).

Update: I forgot about Red Hat. Maybe because there wasn’t so much to tell about Red Hat. Their hiring process seems a little weird, they have a couple of web forms to fill out, then you can subscribe to a job search and if you find a job description that you think fits, you click on a button to apply for that job. I did that several times but never got a reply. IMO they should really improve this. I suppose they are ‘loosing’ a lot of skilled employees.

My new portable OGG player

A couple of days ago I received a new gadget that I’ve been looking for for a long time. A nice little portable OGG player. It doesn’t do a whole lot of things, I mean I cannot make phone calls, watch videos or play games with it, but it does exactly what I want (play OGG Vorbis files), has 1G of flash memory and was relatively cheap (35€ on ebay). The sound qualitly is quite good and the battery seems to last long enough for longer journeys even. Recommended.

While looking for such a device I searched a couple of stores for OGG players, without much hope that anybody would even understand what OGG is. I was surprised that OGG playing capabilities are even advertised by mainstream stores nowadays. I think that has not been the case one or two years ago.