View Single Post
Old Feb 17th, 2007, 11:16 AM   #3
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
BASIC is rare outside the Visual Basic family of dialects, and most BASIC implementations are interpreted. Indeed, the design of BASIC was influenced by the need to make it easily interpreted by computers with little computational power. Additionally, plain BASIC is rather limited as a language, and does not have the best reputation for teaching good programming techniques.

It won't be long before "Python" is mentioned, so I'll mention it now. Python has linguistic similarities to BASIC, whilst having a far larger base of users, and is a programming language frequently recommended to newcomers. It's cross platform, has a large standard library, and whilst it doesn't have a compiler, you can make standalone executables via py2exe.

I'll give you a quick comparison between the two languages, with a small application that prints out the times tables of a user entered number. Here is the application in the QBASIC dialect:
qbasic Syntax (Toggle Plain Text)
  1. PRINT "This application will print out the times table of any number you enter"
  2. INPUT "Please enter a number: ", multiple%
  3. PRINT
  4. FOR %number = 1 TO 12
  5. PRINT number%; " x "; multiple%; " = "; number% * multple%
  6. NEXT %i
And here is the same program in Python:
python Syntax (Toggle Plain Text)
  1. print "This application will print out the times table of any number you enter"
  2. multiple = raw_input("Please enter a number: ")
  3. print
  4. for number in range(1, 13):
  5. print number, "x", multiple, "=", number * multiple
For simple applications, the BASIC code is rather similar to the Python code. However, the advantages of Python are that it is faster, more widely used, and supports more advanced features should the programmer require them. With BASIC, you will hit the wall of what the language is capable of far sooner than with Python.

For instance, in Python its relatively easy to return a list of all URLs linked from a website:
python Syntax (Toggle Plain Text)
  1. import sys
  2. from urllib import urlopen
  3. from urlparse import urljoin
  4. from BeautifulSoup import BeautifulSoup
  5.  
  6. # Get url specified by the first command line argument
  7. url = sys.argv[1]
  8.  
  9. # Parse the HTML of the webpage using the BeautifulSoup parser
  10. soup = BeautifulSoup(urlopen(url))
  11.  
  12. # Iterate over all link tags:
  13. for link in soup.findAll('a'):
  14. if "href" in link.attrs:
  15. print urljoin(url, link["href"]) # print out the full URL of the link
Whilst most variants of BASIC (especially the older ones) don't even have the necessary libraries to access the net in this fashion.
Arevos is offline   Reply With Quote