ArticleslgStudy

computer science

Microsoft Small Basic

Microsoft Small Basic is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Microsoft Small Basic rather than just read about it. In short: Microsoft Small Basic is a programming language, interpreter and associated IDE. Microsoft's simplified variant of BASIC, it is designed to help students who have learnt visual programming languages such as Scratch learn text-based programming.

Microsoft Small Basic — main illustration
Microsoft Small Basic — illustration

Key takeaways

  • Microsoft Small Basic belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Microsoft Small Basic to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Microsoft Small Basic from memory before moving on to harder problems.

Reference excerpt

Microsoft Small Basic is a programming language, interpreter and associated IDE. Microsoft's simplified variant of BASIC, it is designed to help students who have learnt visual programming languages such as Scratch learn text-based programming. The associated IDE provides a simplified programming environment with functionality such as syntax highlighting, intelligent code completion, and in-editor documentation access. The language has only 14 keywords.

History

Microsoft announced Small Basic in October 2008, and released the first stable version for distribution on July 12, 2011, on a Microsoft Developer Network (MSDN) website, together with a teaching curriculum and an introductory guide. Between announcement and stable release, a number of Community Technology Preview (CTP) releases were made. On March 27, 2015, Microsoft released Small Basic version 1.1, which fixed a bug and upgraded the targeted .NET Framework version from version 3.5 to version 4.5, making it the first version incompatible with Windows XP. Microsoft released Small Basic version 1.2 on October 1, 2015. Version 1.2 was the first update after a four-year hiatus to introduce new features to Small Basic. The update added classes for working with Microsoft's Kinect motion sensors, increased the number of languages supported by the included Dictionary object, and fixed a number of bugs. On February 19, 2019, Microsoft announced Small Basic Online (SBO). It is open source software released under MIT License on GitHub.

Language In Small Basic, one writes the illustrative "Hello, World!" program as follows:

Microsoft Small Basic is Turing complete. It supports conditional branching, loop structures, and subroutines for event handling. Variables are weakly typed and dynamic with no scoping rules.

Conditional branching The following example demonstrates conditional branching. It ask the user for Celsius or Fahrenheit and then comments on the answer in the appropriate temperature unit.

Small Basic does not support an inline If statement as does Visual Basic, for example:

Looping This example demonstrates a loop. Starting from one and ending with ten, it multiplies each number by four and displays the result of the multiplication.

While loops are also supported, and the demonstrated For loop can be augmented through the use of the Step keyword. The Step keyword is used in setting the value by which the counter variable, i, is incremented each iteration.

Data types Small Basic supports basic data types, like strings, integers and decimals, and will readily convert one type to another as required by the situation. In the example, both the Read and ReadNumber methods read a string from the command line, but ReadNumber rejects any non-numeric characters. This allows the string to be converted to a numeric type and treated as a number rather than a string by the + operator.

As Small Basic will readily convert among data types, numbers can be manipulated as strings and numeric strings as numbers. This is demonstrated through the second example.

In the second example, both strings are treated as numbers and added together, producing the output 3100. To concatenate the two values, producing the output 1003000, it is necessary to use the Text.Append(text1, text2) method.

Libraries

Standard library The Small Basic standard library includes basic classes for mathematics, string handling, and input/output, as well as more exotic classes that are intended to make using the language more fun for learners. Examples of these include a Turtle graphics class, a class for retrieving photos from Flickr, and classes for interacting with Microsoft Kinect sensors. To make the classes easier to use for learners, they have been simplified. This simplification is demonstrated through the code used to retrieve a random mountain-themed image from Flickr:

Turtle graphics Small Basic includes a "Turtle" graphics library that borrows from the Logo family of programming languages. For example, to draw a square using the turtle, the turtle is moved forward by a given number of pixels and rotated 90 degrees in a given direction. This action is then repeated four times to draw the four sides of the square.

More complex drawings are possible by altering the turning angle of the turtle and the number of iterations of the loop. For example, one can draw a hexagon by setting the turn angle to 60 degrees and the number of iterations to six.

Third-party libraries Small Basic allows the use of third-party libraries. These libraries must be written in a CLR-compatible language, and the compiled binaries must target a compatible .NET Framework version. The classes provided by the library are required to be static, flagged with a specific attribute, and must use a specific data type. An example of a class to be used in Small Basic is provided below, written in C#.

If available, the Small Basic development environment will display documentation for third-party libraries. The development environment accepts documentation in the form of an XML file, which can be automatically generated from source code comments by tools such as Microsoft Visual Studio and MonoDevelop.

References

Further reading Marji, Majed; Price, Ed (2016). Learn to Program with Small Basic: An Introduction to Programming with Games, Art, Science, and Math. No Starch Press. ISBN 978-1593277024. Carlson, Edward H; Philip Conrod, Philip; Tylee Conrod, Lou (2013). Small Basic For Kids: A Computer Programming Tutorial. Kidware Software. ISBN 978-1937161828. The Basics of Small Basic discussion with Vijaye Raji and Erik Meijer on SmallBasic Introduction to Small Basic Archived 2010-07-11 at the Wayback Machine discussion with Vijaye Raji and Robert Hess on SmallBasic Microsoft Small Basic for .NET Archived 2016-04-13 at the Wayback Machine Review of Microsoft Small Basic, with sample application Category:Microsoft Small Basic Tasks implemented in Microsoft Small Basic on rosettacode.org

External links

Official website Microsoft Small Basic on GitHub

Worked examples

Example 1 — a first encounter with Microsoft Small Basic

Start with the simplest possible case. Write down what Microsoft Small Basic claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Microsoft Small Basic before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Microsoft Small Basic ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Microsoft Small Basic

In research
Microsoft Small Basic appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Microsoft Small Basic in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Microsoft Small Basic is common in secondary-school and first-year university syllabi. It links to neighbouring topics .NET programming languages, 2008 software, BASIC programming language family, so understanding it makes those chapters shorter.
In everyday life
Look for Microsoft Small Basic outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Microsoft Small Basic in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Microsoft Small Basic means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Microsoft Small Basic out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Microsoft Small Basic in simple terms?

Microsoft Small Basic is a programming language, interpreter and associated IDE. Microsoft's simplified variant of BASIC, it is designed to help students who have learnt visual programming languages such as Scratch learn text-based programming.

Why does Microsoft Small Basic matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Microsoft Small Basic?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Microsoft Small Basic.

Tags

  • .NET programming languages
  • 2008 software
  • BASIC programming language family
  • Educational programming languages
  • Free integrated development environments
  • Microsoft BASIC
  • Microsoft free software
  • Microsoft programming languages
  • Pedagogic integrated development environments
  • Programming languages created in 2008
  • Software using the MIT license
  • Windows-only free software

Keep exploring