Feeds

Symbian's Utopia - and why it was an impossible dream

Cruel and unusual? No, merely misguided

The Power of One Infographic

Andrew's mailbag This is a story of how a complicated and obscure technical detail shed light on the fate of an industry. The industry here is smartphones, and we begin with a hairy technical subject - memory management. But don't worry if you don't know what a malloc and sprintf mean - and according to Dominic Connor that's most CompSci graduates - I shall provide plain English translations along the way.

Our correspondent requests anonymity, so we shall call him Jay. He takes exception to an aside made recently in my story Nokia ends cruel and unusual 'Symbian programming' practices. I had made the claim that Symbian was well designed. But one experienced industry insider demurred, emailing this observation:

"Symbian is the only platform that has to spend one day teaching people how to use strings before they can code in it. The approved method is that you create an HBufC (a Heap allocated, BUFfer that is Constant), then Call Des() on it (which returns a TPtr - a pointer to a writable descriptor)," he says.

"So writable strings in memory, and constant? Blows your mind."

Jay writes:

Anybody can write plain C strings that then buffer-overflow and corrupt memory. It takes a little more effort to write quality code.

A brief interlude. In C and C++, programmers need to allocate memory for the application's data, in this case we're talking about text ("strings"). If the data overflows the memory allocated, then unpredictable results occur, which are usually quite nasty. This is not a problem with languages such as Java, or Basic, but there is an overhead in performance and system housekeeping.

So programming in C or C++ places several responsibilities on the programmer. "Don't fuck up" is the obvious one. Programmers sometimes allocate more than they need, but on constrained systems such as mobile phones, this also incurs a performance penalty - the application becomes a memory hog. Jay continues:

The comment manages to be wrong on several counts:

Firstly, this isn't the "approved" way of creating strings. This is as inaccurate as saying that the approved way of creating strings in C is to malloc() some heap memory and then strcpy() the string into it. Just as in C and C++ there are several ways of creating strings, and HBufC is only one of them

Secondly, a new RBuf class was introduced several years ago to simplify string management and bring it more up-to-date by allowing newer features, so your correspondent is criticising Symbian by ignoring what isn't suited to his argument.

Thirdly, of the problems with programming Symbian OS was that it was specifically designed for low-power, limited-CPU, limited-RAM devices, the system was designed around this and (importantly) around the assumption that the people programming for it would also care and understand about those limitations. What that short snippet quoted above shows is that Symbian was misguided in this thinking - out in the world many people don't want that bother, and are quite happy to code buffer-overflows, memory hogging and other horrors all over their code. What they want is to be able to put together some code quickly without having to think too much about it, [what] they definitely don't want is an API that forces them to write good code - and that's where Symbian gets a lot of its reputation for difficulty. The difficulty is not so much an absolute thing, but rather it is relative between the Symbian designers' intentions to ensure all code was well-written for the limited target devices, and the large body of programmers who want to churn out code quick and make a quick buck without being bothered learning how to do memory management, write efficient code, etc.

The Power of One eBook: Top reasons to choose HP BladeSystem

More from The Register

next story
Major problems beset UK ISP filth filters: But it's OK, nobody uses them
It's almost as though pr0n was actually rather popular
Google Nest, ARM, Samsung pull out Thread to strangle ZigBee
But there's a flaw in Google's IP-based IoT system
Orange spent weekend spamming customers with TXTs
Zero, not infinity, is the Magic Number customers want
US freemium mobile network eyes up Europe
FreedomPop touts 'free' calls, texts and data
Apple orders huge MOUNTAIN of 80 MILLION 'Air' iPhone 6s
Bigger, harder trouser bulges foretold for fanbois
'Two-speed internet' storm turns FCC.gov into zero-speed website
Deadline for comments on net neutrality shake-up extended to Friday
NBN Co execs: No FTTN product until 2015
Faster? Not yet. Cheaper? No data
Oh girl, you jus' didn't: Level 3 slaps Verizon in Netflix throttle blowup
Just hook us up to more 10Gbps ports, backbone biz yells in tit-for-tat spat
prev story

Whitepapers

Reducing security risks from open source software
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.