Hello World

Hello World

Rate This
  • Comments 48

Welcome to Small Basic Blogs!  After being in part-time development for nearly a year, Small Basic is finally out, and I'm excited to see where this will go from here!

Screenshot

History 

It all happened in August of last year when someone sent me a pointer to the article Why Johnny Can't Code and it got me thinking.  After all, when I was a kid, I started programming in ZX Spectrum with a built in Sinclair BASIC interpreter and did so until I ran into Turbo BASIC.  To me that transformation was groundbreaking and was the single most important reason why I chose to write software for a living, for the rest of my life.

An informal poll along the corridors in Microsoft revealed that most developers within Microsoft had started programming in some variant of BASIC.  It had all the good characteristics of a good beginner programming language - simplicity, minimal ceremony, instant gratification and ubiquity.  It helped them "get" programming and assisted them with understanding the need for more advanced concepts.

When I asked them how they're going to teach programming to their children, they were stumped.  Almost everyone wanted to, they just didn't know how.  Some said KPL, Python and Ruby.  Some said Alice and Scratch.  But they all felt that none of these have the charm of BASIC.  Of course there were some that took the Dijkstra's stand, but they were few.

Of the numerous programming languages, BASIC, from its inception in the 1960s has undergone some major transformations.  Even among Microsoft's BASIC offerings, the language and the environment (VS) has been repeatedly updated to include more powerful features with every release.  On the one hand this makes the language and the environment very powerful and capable, but on the other hand, it makes it daunting for a beginner. 

That got me thinking as to why isn't there a "Small" variant of BASIC that brings the simplicity of the original language to the modern day.  And after a year, here we are, announcing Small Basic.  Small Basic is a project that will help make programming easy and approachable for beginners.  Now, that's a pretty big claim - let's see how Small Basic does it.

Make programming approachable

Small Basic starts with a really simple programming language that gathers inspiration from the original BASIC language.  It has no more than 15 keywords and is strictly imperative.  There are no classes, scopes, generics, lambdas, etc. - just pure imperative code.  The language is typeless and all variables are dynamic and global all the time.  The code gets compiled to IL and runs on the .Net Framework.

It comes with a set of libraries that can be accessed from within a Small Basic program.  Since the language itself is .Net based, new libraries can be created or the existing libraries modified using any .Net programming language. 

Next, it combines the features of the language and the libraries into a very simple and friendly programming environment.  This environment gives beginners, access to professional features like Intellisense(TM) and Instant context sensitive help.  It makes writing programs and executing them a breeze.

Show me code already

Okay here're a couple sample Small Basic programs

Sample 1: Change the desktop wallpaper  from Flickr, every minute

While ("True")
  pic = Flickr.GetRandomPicture("fall leaves")
  Desktop.SetWallPaper(pic)
  
  Program.Delay(60 * 1000)
EndWhile

Sample 2: Makes a BlackBoard that allows you to scribble on a window

GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.PenColor = "White"
GraphicsWindow.MouseDown = OnMouseDown
GraphicsWindow.MouseMove = OnMouseMove

Sub OnMouseDown
  prevX = GraphicsWindow.MouseX
  prevY = GraphicsWindow.MouseY
EndSub

Sub OnMouseMove
  x = GraphicsWindow.MouseX
  y = GraphicsWindow.MouseY
  If (Mouse.IsLeftButtonDown) then
    GraphicsWindow.DrawLine(prevX, prevY, x, y)
  endif
  prevX = x
  prevY = y
EndSub

 

How can I get this?

You can download Small Basic today by visiting the Small Basic portal.

Also, don't forget to check out the Getting Started Guide.

Happy Programming!

Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post
  • It's cool. I think Small Basic is the best for the novice who begin to learn programming. 昔の VB2 みたいに、 早くてお手軽、 だといいなぁ。 f(^^; ・ blog : SMALL BASIC・ DevLabs : Sma

  • The idea is good. QBasic was a decent teaching tool, and a good replacement is sorely needed. However, it is, in my opinion, a big mistake to try to make the most "basic" language object-oriented, or even to mention things such as "classes" and "objects". Before getting there, one has to learn the ropes of algorithms, and for that, all that's needed is a good old procedural-style language with simple but easy-to-use input/output facilities (the original BASIC PRINT and INPUT were perfect for that), and preferrably with some easily accessible graphical primitives (since a lot of basic stuff - loops, recursion, functions etc - are much easier to demonstrate on apps drawing some simple graphics).

    I mean, a BASIC that cannot run this?

     PRINT "Hello, world!"

    Come on...

    By the way, error reporting is also confusing. Say, I write this:

     TextWindow.WriteLine "Hello, world!"

    I expected it to tell me that I'm missing an opening parenthesis after WriteLine. Instead, I get this gem:

     1,21: Unrecognized statement encountered

     1,11: Cannot find property "WriteLine" in Type "TextWindow"

    Oh-kay... so which statement was unrecognized? There are no line/column numbers in the editor, so finding that 21 is gonna be tricky. But alright, I count characters myself, and my cursor ends up at the space character. Huh?

    The second error message is even more baffling for a beginner. What's a "property", and why did it say that it couldn't find one when I didn't ask it to look for one?

    I am nitpicking here, of course... but it must be understood that a learning tool has to have particularly good error reporting in the compiler, trying to not just say what went wrong and where, but also why, and what should be done to make it right, to the extent it is possible to detect it (maybe with some heuristics even).

  • Oh, and while I was trying to figure out how the arrays are supposed to work, this single-liner had just crashed with an exception (and a stock Win32 error reporting window) for me:

    Array.SetValue(a, 1, "123")

  • Thanks int19h.  These are great suggestions that we'll incorporate into the next releases.  

    The Array.SetValue crash is a bug.  If "a" is a variable and doesn't have a name already set, it crashes.  Try giving the array a name:

    Array.SetValue("myarray", 1, "123")

  • Yeah coool ! Another shity buggy microsoft product , Thank you . The world will become better with that **** .

  • This is an excellent way for kids to learn how to program. A Very good initiative! Keep up the good work.

  • This looks an alot like Hackety Hack, but it wasn't mentioned. Were you influenced by Hackety Hack? Or is it purely a coincidence?

    http://hacketyhack.net/

  • Thanks for your work.  This looks great.  My son (8) has already taken off with this!  I would love to eventually see documentation with a table-of-contents or in a tutorial type format.  Also, searchable help files within the program would  be great.  

  • Thank you and Microsoft for keeping the Basic tradition. Don't listen to the naysayers, most of them are busy learning fad languages such as Lisp and Ruby without ever thinking about producing actual, useful code. QBasic was the source of my fun back in the days and so will SmallBasic be for the new generation. Professional programmers tend to forget how hard it can be to get into programming when you need to learn all kind of concepts like classes and types. Basic is about learning how to write nice algorithms first.

    Heck, I'm a C# programmer and I'm thinking of trying Small Basic too because the environment seems nice enough to do quick prototyping of algorithms and ideas.

  • Haven't wrote much because I am saving up for a big post on Castle Active Record, which I am just

  • I believe, Small Basic is an awesome approach and it is simply great that Microsoft allows you guys to do something like that and even publish it.

    Also, it took me less than one hour to implement Conway's Game of Life with it. That was really fun. ;-)

    I published the code in the Small Basic forum by the way.

  • BlitzBasic is what I always recommend

  • By the way, regarding arrays - I really think that they should be first-class. They're too fundamental to a lot of important algorithms to lift to a library with GetValue/SetValue calls.

  • That is good feedback, int19h.  I'll take a note of this feature request in our bug database and promise to work on it.  However, I can't promise that it will end up in the product.

  • why another language? totally useless effort!!!!! why is msft spending valuable resources on thse useless projects...

Page 1 of 4 (48 items) 1234