3 Gordon Drive, P.O.Box 1347 Rockland, Maine 04841 U.S.A.
Find Tools for Your Chip


 

© 2004 Avocet Systems, Inc.
Call Us Today at 207-596-7766 ("Picton Press")
Avocet Systems, Inc. : The Complete Solution for Embedded Systems Development Tools
Embedded Update
Going Against the Grain

Welcome to the 90s... the era of political correctness!

Like one about to tell an off-color joke in a mixed crowd, I feel compelled to furtively look around before mentioning something as politically incorrect as the following. Are ya'll listening? Shhhh.... here goes:

Lately I've been writing code in Basic!

It's so embarrassing. My wife has threatened to leave. Our daughter is a pre-school pariah.

Now, this is not embedded code; we're talking utilities that run on a PC. Microsoft's Visual Basic, a Windows compiler, is an entirely different way to build programs. If you haven't looked at it, by all means dash out and get a copy. Spend a couple of hours fiddling with it to get a glimpse of what the future of programming may be.

Visual Basic (VB) is nothing like it's big brother, Visual C++ (which we use heavily here). VB is an entire environment that makes developing true Windows apps painless... and tons of fun. It's been years since I had this much fun writing code.

An hour after opening the box I had a simple application going, with buttons and dialog boxes. If you, like me, haven't a lot of interest in becoming a Windows programming expert, this is the tool for you. Slap an app together in minutes or a few hours and move on. Impress the neighbors with your graphical programming skills.

VB presents basic Windows tools, like buttons, drop-down boxes, and comm controllers, as icons on a tool bar. You drag them onto a mockup of your app's screen. Then (this is the cool part), it writes prototype code for each object. VB knows what each can do (respond to a button press, for example), and creates a skeletal function for every possible action.

The skeletal routines consist of nothing more than a function start and end. Most objects have a dozen or more functions, but you write code only to handle things your app needs (like, respond to pressing the button).

All Windows "event" handling is taken care of behind the scenes. Somehow function "button.down" gets invoked when the user presses that object. Perhaps pressing the button invokes a subroutine: in this case, you'll write one line of code to do the CALL. VB takes care of everything else associated with the button.

Every object has "properties" (size, color, shape and dozens of other attributes) that you can set in the code or via a property sheet. Set them in the code to change things dynamically; do it on the property sheet for stuff that never changes.

It's a bit weird writing your first VB application. The editor only shows the code for one function at a time. A selection box lets you pick any object, and then any of the possible actions (each of which has an associated function) for that object. Only the one function appears in the edit screen. As one used to dealing with the details of huge masses of functions tossed (often haphazardly) into giant files, this is a radically different way of viewing the code. It's kind of neat though: the objects are packaged to such an extent that you are even insulated from editing the wrong code. OOP nirvana?

OK - fire away! Start the suits; alert the ACLU, call the Washington Post. When the dust settles give VB a shot - you'll have a few hours of fun and catch a glimpse of what might be the future of software development.