| |

Scary Symbian

I’m not really in the mood to revise writing communication scripts… So I will just blog about Symbian to conclude the assignment I submitted yesterday.

Symbian started as a collaborative Effort between Nokia, Sony Erricson, Samsung and several other mobile phone manufacturers to create an operating system that work for their devices. It’s certainly not the first OS, Palm OS existed long before that. The fact that Symbian collaborated development started in 1998 and got wide attention around 2000 may make you expect a modern operating system with good design while maintaining compatibility.

It’s simply scary for me.

Looking at the sheer amount of features and headers would make you confused, the documentation seems to be machine – generated with very very very few example what each function do. It’s a good thing that a single operating system support all functionality that normally only available on separate devices: media player, digital camera, gaming device… But that is a burden for the developers :(. They will have to get familiar with a multitude of data structures… You think int is just int? No, for Symbian there are 8 bit int, 16 bit int and 32 bit int, and the developer will have to decide what to write both when they design (write the header) and when they code (using the function). Failing to match the two declaration can be fatal and that lead to debug…

To debug you’ll have to install Nokia’s tool: Carbide; which in turn will require you to install

  • Perl
  • Java
  • GNU C++
  • MingW in case you use Windows
  • Phone SDK for simulation; and they install a complete set of files for each SDK

Three languages just to program in one language for one operating system! Even so, if they worked smoothly then there weren’t this post: the SDK installation has a screen in which you can choose where to install, even though you can click the button and change it; and the documentation didn’t recommend otherwise, don’t change it. It will mess up with itself! Installing the SDK in a drive different from the IDE, or different from your workspace drive would results in dumb error messages like “file not found” which unless you are familiar with *nix system, you’ll just went mad! (And even if you have the skill to fix it, are you ready to fix tens of thousands of lines of Perl code just to write a C++ hello world!?)

Expecting the resource editor? It depends on whether you've been nice or naughty…
Expecting the resource editor? It depends on whether you've been nice or naughty…

If you have installed stuff on Windows Mobile before, and ever think to yourself “why must I bring my phone to phone shops, I can do this, piece of cake!”, try using Symbian! Each program throws resource in multiple directories, together with system applications. While this is a good thing on some aspects, a developer just can’t find where his resource file is in the big mess called “sys”. If you think Windows’s window directory on windows mobile is messy because it’s full of dll and executables, have a look at Symbian’s system directory. You’ll see types of files have never seen. Open your eyes and embrace r01, l01, mbm… And because the OS is that complex, OS’s native file structures is complex, to do something as simple as replacing a bitmap, the developer will have to wait for the tools to rebuild it, and then deploy it to the phone, which is not a fast process at all…

And possibly for the same reason why you must rely on shops when your phone has problem, the documentation doesn’t have any mention for any error and how to fix it… Sometimes if you are in luck you may found it in some corner of the Internet. For example a common problem for the 3rd SDK FP1 emulator is it display a kernel failure every time it start. If you google the error, you’ll see several discussion on forum nokia (and several copy of those discussion), most of which will tell you “leave it there, it doesn’t hurt”. It’s not until one beautiful day searching for another kernel problem that I found this KB article: NCNList KERN-EXEC 3 panic when starting the S60 3rd Edition, FP1 emulator. There you go, download the file, install it, and if your phone is happy, it won’t spit a list panic =))

Small community size, clueless forum posts is what you are going to face searching for help with Symbian. I wonder how could they able write so many stuff for their phone? Magic happens among Nokia-employed developers? =))

Some part in their documentation, they mention about how Symbian is so different from normal C, it was designed before the current C++ standards were born. Oh really? How come you can design a new interface for acceleration sensor and can’t even wrap the compiler to use the approrate kind of number and character instead of forcing the developers write clueless stuff like Tint, Tbuf, Tdes, TPtr!? C++ is complex enough already! Keep in mind that you inherited that together with the language next time! Or is it just too hard to let the compiler do exception handling the C++ way instead of some “simple leaves” which make the developer throws away most of their knowledge about constructors to do the so-called “2 phase contruction” like

CBanCo::CBanCo()
{
}
CBanCo::CBanCo(TRect aRect)
{
	iRect=aRect;
	iSize=15;
	iNum=0;
	TRgb color(102,255,255);
	iColor=color;
    iWidth = aRect.Width();
	iHeight = aRect.Height();
	iSwitch = EFalse;
}
void CBanCo::ConstructL()
{
	CSettings* settings = CSettings::NewL();

	iSize = settings->iBoardSize;
	iRow = iHeight/iSize;
	iCol = iWidth/iSize;
	iFlag = false;
	iColCur = iRowCur = 0;
	iArray = NULL; // The following line may fail
	iArray = new (ELeave) CArrayFixFlat(iRow*iCol);
		for(TInt i=0 ; i < iRow ; i++)
			for(TInt j=0 ; j < iCol ; j++)
				iArray->AppendL(-1);
	if (settings->iPlayerSymbol == 0)
		iSwitch = EFalse;
	else
		iSwitch = ETrue;
	iImageX = AknIconUtils::CreateIconL(BitmapStore, (iSwitch == EFalse? 2 : 3));
	iImageO = AknIconUtils::CreateIconL(BitmapStore, (iSwitch == EFalse? 3 : 2));

	delete settings;
}
CBanCo::~CBanCo()
{
	if (iArray != NULL)
		delete iArray;
	if (iImageX != NULL)
		delete iImageX;
	if (iImageO != NULL)
		delete iImageO;
	iArray = NULL;
	iImageX = NULL;
	iImageO = NULL;
}
CBanCo* CBanCo::NewL(TRect aRect)
{
	CBanCo* myObj = CBanCo::NewLC(aRect);
	CleanupStack::Pop(myObj);
	return myObj;
}
CBanCo* CBanCo::NewLC(TRect aRect)
{
	CBanCo* myObj = new (ELeave) CBanCo(aRect);
	CleanupStack::PushL(myObj);
	myObj->ConstructL();
	return myObj;
}

While it could be

CBanCo::CBanCo()
{
	;
}
CBanCo::CBanCo(TRect aRect)
{
	iRect=aRect;
	iSize=15;
	iNum=0;
	TRgb color(102,255,255);
	iColor=color;
    iWidth = aRect.Width();
	iHeight = aRect.Height();
	iSwitch = EFalse;
	CSettings* settings = new CSettings();
	iSize = settings->iBoardSize;
	iRow = iHeight/iSize;
	iCol = iWidth/iSize;
	iFlag = false;
	iColCur = iRowCur = 0;
	iArray = NULL; // The following line may fail
	iArray = new (ELeave) CArrayFixFlat(iRow*iCol);
		for(TInt i = 0; i < iRow ; i++)
			for(TInt j=0 ; j < iCol ; j++)
				iArray->AppendL(-1);
	if (settings->iPlayerSymbol == 0)
		iSwitch = EFalse;
	else
		iSwitch = ETrue;
	iImageX = AknIconUtils::CreateIconL(BitmapStore, (iSwitch == EFalse? 2 : 3));
	iImageO = AknIconUtils::CreateIconL(BitmapStore, (iSwitch == EFalse? 3 : 2));
	delete settings;
}
CBanCo::~CBanCo()
{
	if (iArray != NULL)
		delete iArray;
	if (iImageX != NULL)
		delete iImageX;
	if (iImageO != NULL)
		delete iImageO;
	iArray = NULL;
	iImageX = NULL;
	iImageO = NULL;
}

See it? my code hilighter can’t parse Symbian C++ as C++ :))… I stray too far from the debug part, didn’t I? Yes, the debugger does not allow code view, and because it stops immediately when some error happens, you can’t see the values you are tracking at that time. Proved you are clever enough to have the debug work while winscw’s configuration just won’t start.

Guess that when the phone is sold to the rich, its developers should also be rich and have a lot of spare time to think like the rich then. At least the OS have a nice interface after all

Symbian gomoku, thanks to my instructor
Symbian gomoku, thanks to my instructor

Strangely, I can’t help noticing Nokia still has the largest market share in the smartphone market according to canalysis (51% in 2007). I just can’t find a nice chart to match smartphone sales to dumb phone’s so I can’t just conclude that most of the rich people uses an inextricably complex operating system 😛

Nevertheless, iPhone is steadily gaining its part and the first dream phone (as what Google calls it) appeared a couple of months ago also with quite a lot of function. Both of which could be interesting factors to facilitate Symbian in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *