Uncategorized

If I Were To Create A “New” Beginner’s Programming Language

I recently took the things I learned from my old Sandbox Script based on XML, and wrote a new iteration called Straw Script.  The main addition in functionality was the ability to specify operator and functions.

I’ve also played a bit with microsoft small basic.  I blame John Hattan, of course.  I wrote a quick JetLag game and a Snake game.  While MSSB is a good idea with its heart in the right place, I think it is too dotnetty.  I had no trouble writing in the language, even with its current quirks.

It has entirely too many zero based concepts to be a proper beginners language.  I once had a coworker who had tried a number of times to learn how to program.  I especially remember one concept that he questioned… that of starting with an array index of zero instead of one.

He thought it was more intuitive to have a for(x=1;x<=10;++x){} rather than for(x=0;x<10;++x){}

At the time, I was of the opinion that zero based was somehow “better”.

It isn’t.  Neither way is “better”.  I will state that the more natural “counting” arithmetic would start it with 1.

If I were to make new beginners programming language, I would start with a dialect of BASIC.  I would make arrays 1 based, and string operations 1 based.

In fact, I would probably start with a subset of Color Basic from the TRS-80 CoCo.

I would have two types of data: number and string.

I would have a Goto statement, but I would use labels, not line numbers.

Ditto the Gosub statement

Also, the On.. Goto and On… Gosub, which was the closest thing BASIC had to a switch statement

I would probably incorporate the Sub and Function ideas from QBasic

Graphics and text should be on a 1 based grid, and (1,1) will be in the lower left hand corner, with x and y increasing to the right and upwards.

Advertisements

One thought on “If I Were To Create A “New” Beginner’s Programming Language

  1. Actually, iteration shouldn’t care about the indexing. Zero-based indexing is perfectly fine, even for beginners. What isn’t fine is C’s iteration syntax, for(initializer; conditional; increment). Er… what?

    Just have “for” always behave as “for-each”. Works like a charm for Python, and beginners dig it. for item in array. for integer in range(5, 10). Heck, make your functions/objects self-documenting by using a Smalltalk/Objective-C message passing syntax: for integer in [Range startingAt: 0 endingAt: 10 inStepsOf: 2] { … }

    Oh, then lose the BCPL-inspired brace thing, and use whitespace and indentation to indicate scope. (Basically, I’m advocating a loose blend of Python and Smalltalk/Objective-C.) What do you think?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s