class cZen
{ };

void cZen::NewsLC() // What's new, what's coming up ...

{

This first newsletter marks the release of the preview version 0.7 of the Zinzala SDK, codenamed Mano. As you will no doubtably notice, the documentation for Zinzala still has not progressed much. In actuality, it has somewhat gone backwards due to the heavy changes in the coding idioms and styles...

So, what's new with 0.7 ? Here are a few things :

The reorganisation of the SDK was most needed, and we believe that you will find the new layout a bit easier to work with.

Updating and completing the documentation, along with the work on the next preview version, codenamed Ahi, will take up most of the upcoming months. More information will be given on this next release soon.

}

void cZen::InsightL() // Advice, tips and tutorial on how to best use the API

{

This month, we are going to talk about what the migration from 0.6 to 0.7 means for developers out there .... If you are new to Zinzala do not skip this section. There is some valuable informations for you as well ;-)

So, first of all .... this new release is going to break stuff .... actually, it's going to break pretty much everything. Although the philosophy behind the SDK hasn't changed, there has been some heavy changes. The good news is that this is the last major reorganisation of the SDK. From this release on, there will be only minor changes and probably many more additions :)

Coding style

Of course, you are not forced to use the coding style used in the SDK, but you are somewhat encouraged to do so :)

The naming scheme introduced by this new version is as follows: The first letter of a name (everything but function/method names) is always in lower case and indicates the type of identifier. For examples, a constant variable will have a k as its first letter and a type will have t as its first letter. Here is a list of all the different identifiers:

aValue method and function argument
lCounter local variable
gTeam global variable
kDistanceMoonEarth, constant
eAlignCenter enumerate value
iValue a class or structure data member
dTHISVALUE a #define value
tRecord a type (stucture or enumerate)
sEnv a static class
cMyClass a class based on pBase (can be derived)
uTool an utility class (usually not derived)
pBase a protocol class (must be derived)

There is also :

kFlgUpDown a flag
kErrOutOfBounds an error

Following this scheme, the basic data types have been renamed. Check the header file Cincinella/Types.h for more detail.

Coding Idiom

This version of the Zinzala SDK introduces the basic elements for what is call two phases object construction. Although the SDK doesn't use it directly, it provides what is needed to use it in your own applications. Many of the demo files that you will find in the SDK use two phase constructors.

Simply put, using exceptions, two phase constructors and a cleanup stack can help you write code that won't cause memory leaks if objects fail to be instantiated properly. It also simplifies your code. For example, look at the following function:

tErr BuildStuff(cMyClass2 **aObject) { tErr lErr; cMyClass *lObject = new cMyClass(); if(lObject) { if(lObject->IsValid()) { cMyClass2 *lObject2 = new cMyClass2(); if(lObject2) { if(lObject2->IsValid()) { lObject2->DoStuffWith(lObject); *aObject = lObject2; return kErrNone; } else { lErr = lObject2->GetFault(); delete lObject2; delete lObject; return lErr; } } else { delete lObject; return kErrOutOfMemory; } } else { lErr = lObject->GetFault(); delete lObject; return lErr; } } else return kErrOutOfMemory; }

Using a Cleanup Stack, the above code can be transformed into:

void BuildStuffL(cMyClass2 **aObject) { cMyClass *lObject; cMyClass2 *lObject2; lObject = new cMyClass(); cMyClass::VerifyLC(lObject); lObject2 = new cMyClass2(); cMyClass2::VerifyLC(lObject2); lObject2->DoStuffWith(lObject); sCleanupStack::PopL(lObject2); sCleanupStack::PopL(lObject); *aObject = lObject2; }
All content © 2004-2007, hexaZen - Vancouver BC, Canada