Tag Archives: basic

Brief reflections on 50 years of BASIC

Beginner’s All-Purpose Symbolic Code (BASIC) has turned fifty, as reported on The Reg and by Jack Schofield on ZDNet. A great moment in computer history, or would we have been better off without it?

My first computer (a Commodore PET) ran Basic from ROM, and without it you could do nothing, though developers bypassed it by using the POKE command to write low-level instructions into memory. The language is meant to be forgiving (as far as a computer language can be) and English-like, at the expense of being a little more verbose. It is case-insensitive and does not require braces or semi-colons to indicate blocks or lines of code, which makes programming look less intimidating for beginners.

I graduated onto an Atari ST, for which there was an excellent Basic implementation called GFA Basic, fast and capable. This was great for writing utilities, though, though serious programming tended to use one of several strong C compilers: Lattice C, Mark Williams C, HiSoft C come to mind.

Basic also had a role, even on the ST, as a macro language for applications. For example, the Superbase database manager used a version of Basic.

The company most strongly associated with Basic though is Microsoft. A version of Basic came with MS-DOS.

image

Microsoft also supported Basic for professional development. Microsoft Basic Professional Development System 7.x was a well-regarded development tool for business applications, though commercial shrink-wrap software tended to be written in C or C++.

That trend followed through to the Windows graphical environment. Visual Basic (VB), which made it easy to code Windows applications, was perhaps the most significant Basic release in terms of its impact, especially when it reached version 3.0 with full database support. Its popularity was such that many developers felt wounded when Microsoft discontinued Visual Basic 6.0, a direct successor, in favour of Visual Basic .NET which is something incompatible and different.

Further, VB 6.0 or something very like it lives on today, in the form of Visual Basic for Applications as found in all recent versions of Microsoft Office.

image

Despite this, Basic is in decline. Most of the professional developers I meet at events like Build use C# in preference to Visual Basic, there being little reason not to. C# is the premier language of .NET, and Visual Basic gets in the way if you want to keep up with latest .NET developments. Xamarin, which lets you code in .NET for iOS and Android, supports C# but not Visual Basic. Once you come to terms with semi-colons, braces and case-sensitivity, there is no real advantage to Visual Basic and C# is no more difficult.

I do see Visual Basic still used in education though, as well as by some developers who either prefer the language or are so used to it that they see no need to change; and to be fair, Xamarin aside, there is little if anything you can do in C# that you cannot also do in VB and the output is more or less the same.

The Roslyn project, which will be part of the next version of C# and probably in the next release of Visual Studio, lets you paste C# code as VB and vice versa.

Nevertheless, I believe we will see further decline in Basic usage, especially as it is little used outside Microsoft’s platform.

Would it have been better if Microsoft has not adopted Basic so wholeheartedly? There are some problems with Basic, though it is possible to write excellent code in Basic just as you can write poor code in C#, Python, C, or other more fashionable languages. Some issues:

  • Early versions of Basic encouraged badly structured programming with keywords like GOTO and GOSUB resulting in intricate loops that were hard to follow or debug.
  • Basic abstracts how software works to such an extent that you do not learn some important programming concepts such as pointers, addresses, memory allocation.
  • There is no natural progression from Basic to the C-like languages which dominate computing (C,C++,JavaScript,C#).
  • Visual Basic encourages developers to mix GUI code and business logic in the same files, as well as building user interfaces that tend not to scale well.
  • Small and declining professional use means that Basic is less useful than many other languages in the job market.

That said, Basic powers many excellent business applications as well as introducing many to the wonders of programming, and deserves our respect.

Back to BASIC with NS App Studio for mobile

I was intrigued to discover NS Basic/App Studio, which offers a simple Windows IDE targeting iPhone and Android mobile devices.

image

It is all a bit retro, especially when you discover that the company (NS Basic Corporation) has the leading Basic on the … Apple Newton.

Still, something like Visual Basic for iPhone and Android sounds interesting. Does this thing deliver?

I tried the demo. What NS App Studio actually does is to translate Basic code to JavaScript, so the end result is a web application targeting mobile browsers, rather than a mobile app. There is a bit more to it though. Apps have access to local storage including SQLite databases, since this is available to the WebKit-based browsers on iPhone and Android. You can create a shortcut to a web app and even run it offline, making it behave somewhat like a locally installed app. Further, the FAQ notes that you can wrap your web app with PhoneGap to create an app that you can distribute through the App Store or Android Market; and this or similar capability may eventually be included in the IDE.

The question though: why would you choose to use Basic rather than just learning JavaScript? I can make sense of the Google Web Toolkit, which compiles Java to JavaScript, but Google’s effort is more sophisticated. You are not expected to puzzle out the generated JavaScript, but just work in Java. By contrast, with NS App Studio you code in Basic but debug in JavaScript, with all sorts of potential for confusion.

I got the impression that the product is not yet mature. I changed the name of the form in my Hello World project, for example, but found generated code that still referred to the old name, causing a JavaScript error. I found it confusing that the property listed as “text” in the visual grid was “textContent” in code. The IDE is very simple, but also very lacking in features. Most developers would find a modern JavaScript IDE more productive.

Nevertheless it is interesting as a proof of concept, and shows the capability of these mobile browsers as a pre-installed application runtime.