Small basic

from Wikipedia, the free encyclopedia
Microsoft Small Basic
Paradigms : procedural
Publishing year: 2008
Developer: Microsoft
Current  version : 1.2 as desktop version / 1.3 as app in the MS Store   (October 1, 2015 desktop version / Aug 7, 2017 app in the MS Store)
Influenced by: Visual Basic .NET , Logo , QBasic
Operating system : Microsoft Windows (desktop version under Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2008 R2, Windows Vista / App only under Windows 10)
License : proprietary
www.smallbasic.com

Small Basic (not to be confused with SmallBASIC, another, older BASIC derivative) is a very simplified (14 keywords) and is primarily created for programming beginners and is available free of charge BASIC- Integrated Development Environment from Microsoft. With Small Basic, the aim is to arouse the motivation to learn and experimentation in programming beginners through successes that can be experienced quickly.

The application sector of Small Basic does not only extend to learners. Small Basic can also be a practical everyday helper for the "home programmer", since the range of functions can be significantly expanded through external libraries.

The development environment, the accompanying user-friendly documentation for beginners and curricula are available in numerous languages ​​(including German).

history

The first pre-releases of Small Basic were created and published in 2008/09 by the then Microsoft developer Vijaye Raji. Later pre-releases were then managed and published by Microsoft as part of the DevLabs project. In July 2011, Microsoft released version 1.0, the first final version of Small Basic. In 2014 Microsoft put together a new development team made up of volunteers to develop Small Basic for new devices and platforms. Version 1.1, released in spring 2015, did not have any notable increase in functionality, but now uses the .NET Framework 4.5. In version 1.2, numerous known bugs were fixed and the KinectWindow Object was introduced. The development team disbanded in 2015/16. Small Basic is now being further developed using hackathons . Version 1.3 was released as a UWP app in the Microsoft Store in August 2017. This version has several new features, including support for three new languages, a new jump start page, and various bug fixes. A major limitation of this app version: no function-expanding libraries can be used.

Current version (s)

  • 1.2 (desktop version; released October 1, 2015)
  • 1.3 (App in the Microsoft Store, released August 7, 2017)

Outlook / further development

In a post on July 20, 2018 on the official Small Basic blog, Microsoft's Ed Price makes the following statements:

  • Version 1.3 for desktop will be released soon (will replace version 1.2) and the use of extensions will still be possible here. (Version 1.1 should remain available for older Windows versions.)
  • A pure online version is about to be released (which will also not support any extensions).
  • In the future, an open source online version is being worked on.

language

Small Basic supports imperative programming . In the object-oriented programming has been deliberately omitted.

A manageable number of but quite powerful keywords extends over numerous application areas and enables the creation of simple applications and games that can run in a text or graphic window.

Syntax examples

Text window

TextWindow.ForegroundColor = "blue"
TextWindow.Title = "Hallo Welt"
TextWindow.WriteLine("Hallo Welt!")

Graphics window

GraphicsWindow.DrawBoundText(10,30,500,"Hallo Welt!")
GraphicsWindow.Title = "Beispiel"

Sample program console game

  Mouse.HideCursor()
  Balltyp = File.ReadContents("C:\Users\PepeGiallo\Documents\Für Programm\Balltyp")
  If Balltyp = "0" Then
    Balltyp = Math.GetRandomNumber(5)
    Balltyp = Balltyp * 1000
  Else
    Goto begin
  EndIf
  Score = File.ReadContents("C:\Users\PepeGiallo\Documents\Für Programm\Score_Berndi_Ball")
  If Score > 1 Then
    Goto begin
    Else
    File.WriteContents("C:\Users\PepeGiallo\Documents\Für Programm\Score_Berndi_Ball", 0)
  EndIf

begin:

  File.WriteContents("C:\Users\PepeGiallo\Documents\Für Programm\Balltyp", Balltyp)
  Balltyp = File.ReadContents("C:\Users\PepeGiallo\Documents\Für Programm\Balltyp")
  GraphicsWindow.FontSize = 20
  GraphicsWindow.FontName = "Arial"
  Score = File.ReadContents("C:\Users\PepeGiallo\Documents\Für Programm\Score_Berndi_Ball")
  GraphicsWindow.BrushColor = "Blue"
  GraphicsWindow.DrawText(10, 10, "Score: " + Score)
  GraphicsWindow.BackgroundColor = "White"
  GraphicsWindow.BrushColor = "#32CD32"
  paddle = Shapes.AddRectangle(120, 15)
  If Score = Balltyp Then
    Balltyp = Balltyp + 5000
    GraphicsWindow.BrushColor = "Red"
    ballwiedererk = "Red"
  Else
    ballwiedererk = "Green"
  EndIf
  ball = Shapes.AddEllipse(20, 20)
  'Wenn etwas mit den roten Bällen nicht stimmt => Aktiviere untere Zeile zum nachschauen
  'GraphicsWindow.DrawText(300, 10, Balltyp)
  GraphicsWindow.MouseMove = OnMouseMove
  Shapes.ShowShape(ball)
  Startposition = Math.GetRandomNumber(603)
  Shapes.Move(ball, Startposition, 0)
  x = Startposition
  y = 0
  WinkelX = Math.GetRandomNumber(2)
  WinkelY = Math.GetRandomNumber(2)
  deltaX = WinkelX
  deltaY = WinkelY

RunLoop:

  x = x + deltaX
  y = y + deltaY
  gw = GraphicsWindow.Width
  gh = GraphicsWindow.Height
  If (x >= gw - 20 or x <= 0) Then
    deltaX = -deltaX
  EndIf
  If (y <= 0) Then
    deltaY = -deltaY
  EndIf
  padX = Shapes.GetLeft (paddle)
  If (y = gh - 28 and x >= padX and x <= padX + 120) Then
    deltaY = -deltaY
    If ballwiedererk = "Red" Then
      Score = Score - 2000
      Balltyp = Balltyp + 5000
    EndIf
    If ballwiedererk = "Green" Then
      Score = Score + 1000
    EndIf
    Shapes.HideShape(ball)
    File.WriteContents("C:\Users\PepeGiallo\Documents\Für Programm\Score_Berndi_Ball", Score)
    GraphicsWindow.Clear()
    Goto begin
  EndIf
  Shapes.Move(ball, x, y)

'Verzögerung
  If Score = 0 Then
    Program.Delay(5)
  EndIf
  If Score < 20000 Then
    Program.Delay(4)
  EndIf
  If Score < 60000 Then
    Program.Delay(3)
  EndIf
  If Score < 100000 Then
    Program.Delay(2)
  EndIf
  If Score >= 100001 Then
    Program.Delay(1)
  EndIf
'Verzögerung Ende
  If (y < gh) Then
    Goto RunLoop
  EndIf
  GraphicsWindow.Clear()
  If ballwiedererk = "Red" Then
    Score = Score + 2000
    Balltyp = Balltyp + 5000
    Goto begin
  EndIf
  GraphicsWindow.BrushColor = "#32CD32"
  GraphicsWindow.FontSize = 81
  GraphicsWindow.DrawText(50, 50, "Your Score is")
  GraphicsWindow.BrushColor = "Blue"
  Score = File.ReadContents("C:\Users\PepeGiallo\Documents\Für Programm\Score_Berndi_Ball")
  GraphicsWindow.FontSize = 100
  GraphicsWindow.DrawText(50, 200, Score)
  File.WriteContents("C:\Users\PepeGiallo\Documents\Für Programm\Score_Berndi_Ball", 0)
  File.WriteContents("C:\Users\PepeGiallo\Documents\Für Programm\Balltyp", 0)
  Sub OnMouseMove
    paddleX = GraphicsWindow.MouseX
    Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12)
  EndSub

  Program.Delay(5000)
  GraphicsWindow.Clear()
  Goto begin

Programming example (pointless button)

  GraphicsWindow.Show()
  GraphicsWindow.Title = "Sinnloser Knopf WARNUNG SINNLOS"
  GraphicsWindow.BackgroundColor = "Black"
  GraphicsWindow.Width = 800
  GraphicsWindow.Height = 600
  GraphicsWindow.FillRectangle(400, 300, 50, 50)
  GraphicsWindow.MouseDown = OnMouseDown
Sub OnMouseDown
  x = GraphicsWindow.MouseX
  y = GraphicsWindow.MouseY
  If(x >399 And x <451 And y > 299 And y < 351) Then
    GraphicsWindow.ShowMessage("Du hast den sinnlosen Knopf betätigt!", "Sinnloser Knopf")
  EndIf
EndSub

particularities

  • Commands and their events, methods and properties are conveniently completed in the editor using " IntelliSense (TM)".
  • Data types are assigned and managed fully automatically (and invisibly).
  • Code written for Small Basic can be converted into code that can be further processed in VB.NET at the push of a button .
  • There is also the option of publishing your own source text on a special Small Basic page. If Microsoft Silverlight is installed on the client side , this program can in most cases also be executed online on that side and even embedded in other websites.
  • With the help of other .NET languages ​​( VB.NET , C # , ...), function-enhancing libraries for Small Basic (desktop version only) can be created.

requirements

To use the current Small Basic development environment and to use an EXE generated with it, Microsoft Windows and the .NET runtime environment version 4.5 are required.

literature

  • Hans-Georg Schumann: Small Basic for Kids. mitp-Verlag, new publication at the end of August 2011, 2nd edition January 2016, ISBN 978-3958453227 .

Web links