Back to Basics: How to Manage Collections in Your Legacy Brew Applications
Tired of managing collections by hand in your legacy Brew development? Then try using a more general approach, such as a vector or dictionary wrapped in a reusable Brew interface.
by Ray Rischpater
October 9, 2007
here's something about sitting down to write a Brew application in C that makes me go back to basics: the very basics, like writing my own linked list each time instead of leveraging one of the hundreds of implementations I have laying around, or not re-using any of the data structures I've written for various projects. This is especially maddening when targeting the large number of legacy Brew handsets, because without things like IVectorModel, you end up worrying about your data collections instead of the algorithm you're trying to implement.
In this article and the next, I'll give you two popular collections, the vector and the dictionary, implemented as Brew interfaces that you can use in your applications. Both require nothing more than rudimentary Brew standard library calls, making them suitable for legacy handsets that are the vast majority of handsets in the hands of consumers today. Both support not just item insertion and access, but enumeration and mapping as well, giving you an additional layer of abstraction when working with your data. This month, I'll focus on the vector, and next time I add the dictionary to the mix. You can download the implementation of these collections here.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!