Recent Changes - Search:

Wiki Home

Sitemap

edit SideBar

It is nothing short of a miracle that the modern methods of instruction havenot yet entirely strangled the holy curiosity of inquiry; for this delicatelittle plant, aside from stimulation, stands mainly in need of freedom;without this it goes to wrack and ruin without fail. - Albert Einstein

ICT /

BasicProgramming

Basic Programming - Learning and Teaching BASIC Programming

A short course in learning and teaching how to program in Basic, These notes are geared at providing resources for teachers and students interested and learning and teaching how to program in BASIC.

I have focused on three dialects, Free BASIC, Just BASIC and Real BASIC each of these have features which will met the needs of most Learners and Teachers, Free BASIC and Just BASIC are both free, and are quite closely related to earlier dialects of the BASIC programming language. Real BASIC is an objected oriented visual programing environment which is platform independent and code and be compiled to run on Apple, Linux or Windows.

Begining Programming by Brad Moore

Free Basic

Just Basic

Real Basic


JustBASIC Books


ETC Basic

Miscellaneous LEARN BASIC information, which I refer to and which may interest others

Tutorials

 http://www.mhuffman.com/notes/language/yab_intro.html  - A Nice Clean BASIC Tutorial

Other Versions of Basic

My personal preference is almost alway biased towards version of software which is platform independent. For instance REALBasic and be compiled to run on Apple, Linux and Windows computers.

Apple & Linux & Windows

 http://www.kbasic.com                     - Opensource Basic  
 http://www.smallbasic.sourceforge.com     - Opensource Basic       
 http://yabasic.de         

Linux & Windows

 http://www.xbasic.org

Apple & Windows

 http://www.truebasic.com            - 

Windows

 http://darkbasic.thegamecreators.com/     - Game Creation,  
 http://www.powerbasic.com/                - Industry Basic with a large following

Get classic basic code here

 http://www.moorecad.com/classicbasic/index.html

Other Advanced Basic

http://www.realbasic.com

http://www2.imm.dtu.dk/~tb/fischer.pdf A powerpoint about teaching "problems solving skills" using programming.


Crossplatform Programming


1.  An Introduction to BASIC Programming

The primary purpose of programming should be, to do repetitive things simply, or to do things more quickly and easily. Elegance and functionality are important parts of writing programs.

I prefer to teach students using a series of smaller exercises and programs and then move one to a larger programming project which demonstrates a range of programming skills. This ensure that 12 and 13 year old students are not overwhelmed. This Basic Programming Introduction comprises mainly of a collection of smaller programming exercises and explanations.

Solution Sheet? Solutions to some of the short programming exercises used in this tutorial. I have not paid particular attention to case sensitivity in all of my examples, I personally prefer to look at lowercase code.

There are usualy three main part to most programs, they 1)Collect Input, 2) Process and Calculate 3) Output or Print results.

2.  Comments about FreeBASIC and JumpBASIC

You can test these code examples in a freely available copy of FreeBasic, JumpBasic or your can purchase a copy of LibertyBasic which I feel is worth paying for. However if you choose to use FreeBASIC you will need to place a sleep command as the last line of every program in this examples.

These code examples have been written for both FreeBASIC and JumpBASIC, to prevent the "Run Window" closing in FreeBASIC you should add a sleep command to the last line of code examples, this will allows you to view the results of the program window after it has completed executing. (I have no idea why FreeBasic closes the window immediately after the program has run)

3.  Vocabulary

 REM or '  - lines begining with ' or REM are ignored and are used to insert comments into your program.  
 LET       - give values to variables or formula used in your program  
 INPUT     - asks a question and waits for your answer 
 GOSUB     - go to a subroutine  
 LABEL     - label a subroutine  
 PRINT     - print out information  
 SLEEP     - wait forever, or for a set duration  
 END       - Program End

Symbols

 + Addition 
 - Subtraction
 * Multiplication
 / Division

4.  Flowcharts

Flowcharts are an important part of programming and is often overlooked by new programmers anxious to get ahead quickly

5.  Flow control

Flow Control is about how the program actually works, you can describe it as the "Program Logic", since it depends very much on how the programmer (you) actually think. for instance, your mum says, don't step into the house until your feet are clean.

<insert flowchart>

 FOR IF UNTIL WHILE DO are all examples of flow control commands.

5.1  Loops

Are necessary to repeat tasks, in BASIC we do this by using the FOR or WHILE statement.

5.2  Goto

5.3  For

  for i = 0 to 100
    ' instructions and code
  next i
sum = 0
FOR i = 1 TO 100
  sum = sum + i
NEXT i
PRINT sum

or

print "Count to 1000"
for x = 1 to 1000
 print x 
next x

5.4  Loop While or Loop Until

Run a command until or while a condition is met.

 This will run while a condition is met

print "Loop While x = 9"
do
  print x
  x = x + 1
  loop while x < 10
print
 This will run until a condition is met
print "Loop Until x = 5"
do
    print y
    y = y + 1
    loop until y > 5
    print

6.  Decisions - (Decisions Revisited)

Clearly form the above we can see that programming is about making decisions.

7.  Examples of Unstructured Basic

There is still a terrific amount of "Classic BASIC" code scattered around the Net, this legacy basic syntax and code can confuse new students, so try your best to work with modern new programing styles and syntax.

These examples are included to give you an idea of what earlier versions of BASIC looked like. You should try an avoid writing simple code like this.

' Find the sum of  two numbers
let a=9
let b=90
let c=a+b
print a,b,c

A better example of the above program would be

Input "Enter any number:", a
Input "Enter another number:", b
c = a + b
Print "The sum of the two numbers is "; c

8.  Working with Strings

A string is a collection of Text and is dealt with differently to intergers, new students often get mixed up here because so many BASIC examples and tutorials use simple maths to demonstate programming to n00bs. The following will help new programmes deal with strings.

9.  Graphics

It's only a matter of time before student inquire about using Graphics. A common question asked by students is: How do I insert a background image in my program box?

9.1  GUI - Graphical User Interface

Most programs will require some form of interaction with the user, Modern programming languages make it easy to design these interfaces, following are a few simple examples

notice "These Tutorial Lessons come without Warranty of any sort!"

Attach:nowarranty.jpg Δ

prompt "Your Name"  ; a

Attach:prompt.jpg Δ

10.  Simple Programming Exercises

If you can do these short exercises you are already have a good understanding of basic, should consider focusing on style and elegance in order to produce clean code.

  • Find the square of any number
  • Find the both the area and perimeter of a rectangle
  • Generate a random number between 1 and 100
  • Print a text file to the screen in pages together with navigation options.
  • Write a program which asks random simple maths questions, check the results and provides a score.

11.  Popular Examples of Basic Programming

From day 1 programmers appear to use quite similar examples to demonstrate and enlighten n00bs (newcomers) to programming. Ever since "Hello World" by Kernighan and Richie, The following highlight a selection of these popular examples which will (should) run in FreeBASIC, JumpBASIC or LiberyBASIC.

  • Guess a number between 1 and 50
  • Tic Tac Toe (naughts and crosses)
  • I'm thinking of a number between 1 and 100 can you guess what it is?
  • Scissors Paper Rock (Ching Chong Cha)
  • A simple User name and password program, to add, delete and validate users.

12.  Quizzes and WorkSheets

You can complete these quizzes and worksheets to test your knowledge or to evaluate your learning.

13.  Why JumpBasic or LibertyBasic

I prefer to teach using LibertyBasic, because it comes with a fantastic help/tutorial file which I can easily modify and customize and which students can refer to during lessons. If you are teacher using LibertyBasic for Education, your license will permit you to install and teach a class using a single license on all computers in your computer lab or classroom. ( I don't mind paying for software that is good and/or has a flexible licensing).

14.  Command Summary and Quick Reference

Window Boxes

 _fs        Full Screen Window
 _nf        No Frame - Prevent window resizing 
 _nsb       No scroll bars
 _ins       Place a text editor in the window
 _modal     Primary focus (prevent access to all other windows) 
 _nsb_ins   No scoll bar, place a text editor in the window.

15.  Glossary

BASIC - [Beginners All-Purpose Symbolic Instruction Code] originally created in the 1960's to teach programming skills, new version of BASIC like FreeBasic and LibertyBasic and REALBasic are suited to real world programming and compare well with modern progarmming languages.

IDE - [Integrated Development Environment] a suit of programs used to help with application development, and often usually will include an editor, debugger, compiler and/or ways to distribute your software.

Machine Code - The low down machine language used by computers (CPU) which looks like 00011 00101 001100 ...

Interpreted Language - Languages like Basic and Ruby are interpreted into machine code.

Scripting Languages - Languages which are scripted like Unix Shell Programming - (BASH)


Information Technology and Resources

Edit - History - Print - Recent Changes - Search
Page last modified on July 08, 2009, at 11:08 PM