Monday, October 25, 2004

Symbian Complaints

I work a lot with Symbian OS. It, unlike most other embedded operating systems, is completely written in C++. From the ground up, it is designed to be 100% object oriented. The class library is staggering.

For some things, the OO abstraction works wonders. I don't have to know exactly what type of object I'm manipulating, I can just use the base class interface and use objects polymorphically. But good god, there are a million and a half objects to think about at any given moment. It's just so much that doesn't fit in my brain.

Since it is OO and written in C++, the C support is not up to par with other embedded systems. There is a C library provided, but it is thin and not very completely implemented. It works for what it does, but the system really forces you to use C++ instead. C++ for an embedded system? Yeah, that's a strange one.

Symbian has this concept of a "CleanupStack". When you create an object, you push it on the stack. If an exception occurs, all objects currently on the stack get deleted. This is implemented because real C++ exception handling is not implemented in Symbian OS. No 'try/catch' blocks. Instead, if a function needs to throw an exception, it "Leave"s. An exception handler is set up at some scope of the program which catches the exception, destroys all objects on the Cleanup stack, and resumes processing. The cleanup stack is difficult to understand, and difficult to use.

Symbian provides little stack space. It is not uncommon to accidentally blow the stack with a recursive function. The documentation recommends to use the heap rather than the stack. If the system were really concerned about squeezing every last byte from a platform, would it really have been implemented in C++?

The documentation is lacking. Though getting better in the last couple of releases, the documentation still has a long way to go. The writing style is too colloquial in addition to being incomplete. Where a user would expect example code, there is only functional specifications. Symbian provides a lot of example code, actually, but the code is presented as-is without much in the way of comments or descriptions.

I'm still trying to wrap my head around the whole operating system and only have the vaguest idea of what is going on. I guess the C programmer in me is going to need to get drilled out of my head to make room for all this C++ object stuff.