Chinese Whispers

Software Lifecycle

Just occasionally, I run into the kind of comment on a technical forum that leaves me speechless (or, more correctly, reaching for my keyboard). This is one of them:

"in BREW, one has to use char pointers rather than large arrays"

in response to a question someone asked about memory corruption of their applet structure in a BREW program. Digging deep into the mindset of the person who wrote this comment, I speculate that a mentor once told him to use a pointer rather than a large array. That's a perfectly solid piece of technical guidance in context, because BREW has a relatively small stack, and allocating large amounts of memory on the stack is therefore a recipe for disaster. That was what the mentor meant. What the programmer actually heard - and subsequently repeated - was "don't use large arrays", which demonstrates a reasonably poor understanding of the differences - and similarities - between arrays and pointers in C.

I take three lessons out of this:

  • Whatever you say, it will be misunderstood in the worst way possible, so either shut up, or be really really clear about what you are trying to say.
  • If you're mentoring, take the time to do it properly.
  • If you're recruiting, make sure you get smart people who will understand you.

Now, just to be clear:

  • You can use arrays in BREW programs
  • The size of your array is limited by the available memory. If your array is on the heap, that's large. If it's on the stack, best keep your array to no more than a few hundred bytes - less if your function is reentrant.

Ben Blaukopf
in Technical

Airsource design and develop apps for ourselves and for our clients. We help people like you to turn concepts into reality, taking ideas from initial design, development and ongoing maintenance and support.

Contact us today to find out how we can help you build and maintain your app.