The Weekly Source Code 49 - SmallBasic is Fun, Simple, Powerful Programming for Kids and Adults
While the boys are only 2 and 4, I'm always keeping an eye out on new ways to teach them programming. Certainly I hope they'll be more well-rounded and I and spend more time outside, but a even a basic background in programming and logic, I think, produces a more empowered individual.
Created by Vijaye Raji, Small Basic is a simple (only 15 keywords) but powerful environment for getting started programming. Great for kids and non-technical spouses, but powerful enough even for the professional game developer. In fact, Small Basic is probably the fastest and simplest way I've seen yet to produce and publish Silverlight-based games. Read on to see why.
Small Basic is part of MSDN DevLabs and just released version 0.8. It's the eighth installment, but I suspect they are too modest to call it 8.0. ;) It's even internationalized in English, Chinese, French, German, Italian, Japanese, Jorean, Russian, Spanish, Brazilian Portuguese and Turkish...so if you know a computer teacher, you might tell them about this!
Take a look at Small Basic Tetris, for example. You can run it in the browser with Silverlight, right here. The full Small Basic source code for the app is listed right on the page. There's a bunch of great sample Small Basic apps here also.
It has a nice friendly IDE (Integrated Development Environment) with a clever take on Intellisense as seen below. The IDE goes out of its way to give you as much information and context as possible not only with the intellisense "arc" but also context-sensitive help in the right doc.
Even more clever, I think, is the "Graduate" button that will convert your Small Basic program into Visual Basic for use directly in Visual Studio.
Here's what a Small Basic text mode application would look like:
number = 100
While (number > 1)
TextWindow.WriteLine(number)
number = number / 2
EndWhile
Here's a SmallBasic Windows app:
GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.Width = 200
GraphicsWindow.Height = 160
GraphicsWindow.PenColor = "Blue"
For i = 1 To 10
GraphicsWindow.PenWidth = i
GraphicsWindow.DrawLine(20, i * 15, 180, i * 15)
EndFor
For those of us old enough to remember learning to program with LOGO and its ubiquitous Turtle, Small Basic includes a Turtle object built in! Remember this?
sides = 50
length = 400 / sides
angle = 360 / sides
Turtle.Speed = 9
For j = 1 To 20
For i = 1 To sides
Turtle.Move(length)
Turtle.Turn(angle)
EndFor
Turtle.Turn(18)
EndFor
Which gives us this image. See the turtle inside?
The most amazing part from a learning perspective is the ability to publish your game directly to the Small Basic website and play it or give it to your friends. I hit Publish for this Turtle app and Small Basic - in one click - gave me this link: http://smallbasic.com/program/?WKN265. Now I can send my friends or students to that link. They can play the game LIVE, see the source listing right there, or even embed it on their own website with included HTML.
I'm really impressed with the amount of though that was put into this app and how easy it was. I hope other folks at Microsoft check it out and appreciate the simplicity.
Related Links
- http://smallbasic.com
- SmallBasic Forum
- MSDN Beginner Developer Center
- Programming for Absolute Beginners
- Teaching Children and Kids to Program the Old School Way
- Hanselminutes Podcast 194 - Hello World: Computer Programmer for Kids and Other Beginners
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Are we sure that this traditional imperative non-functional basic style is the right way to start people of programming? I wonder how many new people we are making that will struggle with FP, LINQ or even SQL.
We might be too old and wizened to tell, but we might be teaching the new 'electric' generation how to program using 'steam' because that's how we started, i.e. the paradigms that we are embedding in an early eduction can tend to stick and the future of programming ain't looking imperative folks...
Anyway, just an comment for discussion - SmallBasic is a lot of fun, and I didn't really find anything else as good.
Nordine Ben Bachir
See a short video presentation here: http://www.youtube.com/watch?v=Krb7OCmTJ-w
or this one http://www.youtube.com/watch?v=F7J9dnIIAVQ
It's perfect for creating business software, but for sure you can find many other uses to it...
Scratch is _great_ for teaching the very basics.
I haven't found good instructions on Squeak or eToys yet.
It is definitely a quick to learn and fund language/platform to use. Extending it is extremely simple for any .NET developer. There have been some great extensions released for it already.
Anyway, we are working with MS VS Express and coding4fun (http://blogs.msdn.com/coding4fun/) and are definitely going to take a good look at SmallBasic as another resource we can 'tap' into.
If anyone has any further info or insights on 'code4kids' we're all ears...thanks!
GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
Thanks,
Kamlesh
Writing lines of code may not get kids very excited, but it teaches programming concepts that will help them for years to come. I'd rather not go through teaching a kid about computers and then showing them a proper IDE with them thinking "WTF? What am I supposed to drag-and-drop?" and getting bored with it. Give someone a code window, he will know to use code windows. Give them a visual enviroment and THEN a code window and you will get someone who doesn't want to program anymore.
Comments are closed.
Plus, I really like the ability to share your code online with your friends/classmates.
This is complete win, I love to see stuff like this.
Plus, that intelli-sense is killer, where was that when I was in Junior High?