Those who say it can't be done shouldn't interrupt the ones who are doing it.

Disclaimer: This is a personal web page. Contents written here do not represent the position of my employer.

Monday, March 24, 2008

Unmanaged documentation hard to manage

I'm not supposed to deal much with low level technologies (unmanaged code, C language...), but in order to test things from the beginning to allow myself understand things better, I'm dealing with Atk for later translating code to C#+Atk#.

One of the things I hate more is not having the excellent refactoring options that the modern IDE's nowadays can provide. For example, how do I know where is some element defined (in my code? in a reference? in which reference?)? Sometimes I find myself copy-pasting a function into another empty test project and start adding references to it until it compiles. Someone would say: hey but there's a lot of documentation out there! Really? Take this example:

Function: g_type_class_ref- It smells like a Glib/Gobject function.- Surprisingly, calling it in a test project that has a reference to glib doesn't work.- More surprisingly, calling it in a test project that has a reference to glib and atk works.- Mmmm, but it doesn't smell like an ATK component, right? Maybe atk ref already depends on the lib I'm looking for...- Let's google it...- WTF! the majority of links provided are forums, not docs.- Finally got one from the LinuxFoundation, which tells me something about a libgobject-2.0 thingy... but that lib is not in my system.- Anyway, the page redirects me to the "Gobject 2.6.2 Reference Manual"...- But! it's a broken link which ends on main gtk.org doc page.- Well, then, let's look for "site:gtk.org g_type_class_ref"... No results!

Ok ok, this is not C language fault, but how do you guys get to know these type of things? I hope you don't download all the source code of all these libs and grep for the word you're looking for... :D

Please make me feel dumb if you want to reply, and I will learn one more interesting thing today :)

In managed code with an IDE, you just have to right-click on the method and select "Go to definition" and if the method is found in a binary reference, there are different behaviours depending on the IDE you use, if you use VS2005 or later, you get an Object Browser that shows you the API of the library, and with MonoDevelop it tries to use the debugging symbols for showing the source code or otherwise it shows a minibug.

SOLUTION of the QUIZ: I had to look for the library 'gobject-2.0', not libgobject-2.0. Of course, Mike Gorse was the unmanaged expert that made me feel dumb! :D

SOLUTION to avoid the QUIZ to other people in the future: bug 369927. Mmmm, it has been closed as WONTFIX, maybe the unmanaged side of things should not get easier :)

Another mini-quiz that I solved also recently comes from the managed world. Do you know how static constructors work? They get called automatically whenever the code flow comes in the type where they lay. Example: