Microsoft Small Basic
File:Small Basic.png Small Basic running on Windows 7 | |
原作者 | Microsoft DevLabs |
---|---|
開發者 | Microsoft DevLabs |
首次发布 | 2008 |
当前版本 | Microsoft Small Basic v0.95(8th February 2011) |
编程语言 | Microsoft .Net 3.5 |
操作系统 | Microsoft Windows |
平台 | Microsoft Windows |
类型 | Integrated development environment |
网站 | http://www.smallbasic.com/ |
Microsoft Small Basic是一個經簡化過的BASIC程式語言,於Microsoft於2008年10月發表。 With a bare minimum of concepts, Microsoft touts this as an easy programming language for beginners to grasp. The language itself has only 14 keywords[1], and the environment is beginner friendly with a straight-forward interface. Since version 0.9 (11 June 2010)[2] no additional features have been added, just translations.
Microsoft Small Basic was designed by Microsoft DevLabs and released as a Technology Preview[3] in October 2008. Its intended audience is anyone looking to begin programming, including children and beginner adults as well.
程式語言
它最初是以微軟的QBasic程式語言做為基礎進行修改,但被移植到.Net Framework。以範例'Hello World'為例,必須寫成:
TextWindow.Write("Hello World")
或是:
TextWindow.Writeline("Hello World")
The first example just writes 'Hello World', but the second example writes 'Hello World' on a new line.
Note that traditional Basic variants, including Microsoft QuickBasic, used an easier syntax:
print "Hello World"
The language itself is Turing complete and supports concepts like conditional branching and loops. Variables are typeless and dynamic, and there are no scoping rules. The language supports subroutines and the runtime uses them for event handling purposes.
Conditional Branching
TextWindow.Write("Enter the temperature today (in F): ")
temp = TextWindow.ReadNumber()
If temp > 100 Then
TextWindow.WriteLine("It is pretty hot.")
ElseIf temp > 70 Then
TextWindow.WriteLine("It is pretty nice.")
ElseIf temp > 50 Then
TextWindow.WriteLine("Don't forget your coat.")
Else
TextWindow.WriteLine("Stay home.")
EndIf
For迴圈
TextWindow.WriteLine("Multiplication Tables")
table = 4
For i = 1 to 10
TextWindow.WriteLine(i + " x " + table + " = " + table * i)
EndFor
Libraries
The software ships with a built in set of libraries which are quite modern and intended to grasp the learners' interest.
For example to change the desktop wallpaper to a variety of 10 mountain photos, the students would make use of a prebuilt "GetRandomPicture" method for Flickr so the code becomes simply:[4]
For i = 1 To 10
pic = Flickr.GetRandomPicture("mountains")
Desktop.SetWallPaper(pic)
Program.Delay(10000)
EndFor
Turtle
Microsoft Small Basic ships with a Turtle graphics library that borrows the idea from Logo. For example, you can make the turtle draw a square by simply saying:
For i = 1 to 4
Turtle.Move(100)
Turtle.TurnRight()
EndFor
相較於其它的 Basic 語言, 例如 Microsoft QuickBasic, 它是使用
EndFor
而不是
Next i
Testing
The first trials were successfully done with several middle school children, most of them children of workers at Microsoft. Small Basic was also successfully tested using a hands-on lab approach to a group of 25 high school girls.[5]
References
外部連結
- Official Site
- Small Basic Programming Tutorials For Kids by Computer Science for Kids*
- The Basics of Small Basic discussion with Vijaye Raji and Erik Meijer on SmallBasic*
- Introduction to Small Basic discussion with Vijaye Raji and Robert Hess on SmallBasic*
- Microsoft Small Basic for .NET Review of Microsoft Small Basic, with sample application