Tuesday, December 05, 2006

My BASIC? Your BASIC? Tiny BASIC?

Not infrequently people will post questions in our community forums (http://libertybasic.conforums.com and http://groups.yahoo.com/group/libertybasic) asking how to implement a programming language. Usually someone will chime in with a link to some very detailed tutorials hundreds of pages long. This is fine if the reader is sufficiently well motivated.

The other day I stumbled on a very cool page on Wikipedia about Tiny BASIC, a language implemented many years ago and published in the seminal Dr. Dobbs Journal magazine. I realized that budding language implementors would really go bonkers for this!

http://en.wikipedia.org/wiki/Tiny_Basic

Check out the links at the bottom. There are a couple of implementations there written in BASIC with source code. What better way to get your feet wet but to port Tiny BASIC to Liberty BASIC or to your favorite BASIC? Doing the port shouldn't be too hard, and you'll learn enough to venture adding some new commands. :-)

Wednesday, October 25, 2006

C for Beginners?

I recently responded to someone's blog comment that said that BASIC is not a good language for beginning programmers. He suggested instead that beginners learn C. I responded that C is a fine language for many purposes (like operating system development), but that it contains too many difficulties that are not fundamentally related to learning programming. Here's a cool page that I found using StumbleUpon http://www.stumbleupon.com that illustrates my point effectively. ;-)

http://www.andromeda.com/people/ddyer/topten.html

BASIC's culture of diversity

One of the really interesting things about BASIC is that there are probably more dialects than any other programming language. Perhaps this is because BASIC really is the people's language. Sure, there are different versions of C (a few), Cobol (why?), Forth, etc. but people just love to create their own version of BASIC for whatever reason.

I guess that since BASIC was born into a world where it was shoehorned into many, many different computers it became part of the BASIC culture that it is okay to have many broadly different implementations. Every early home computer had it's own BASIC.

Now I've heard it said that this is a weakness of BASIC, and many people complain that there is no commercially viable standard BASIC. I'm not sure why this is a problem. The standard (by committee) is very old and limited. Since the world is constantly changing, I think it's a good thing that BASIC hasn't settled down into a rut. BASIC is still a place where people feel free to explore and innovate.

The world is big enough to accomodate variety.

Friday, October 13, 2006

Liberty BASIC gets some attention

Although Liberty BASIC isn't mentioned by name, the Liberty BASIC site gets a mention and a link by Jim Kelly here:

thenxtstep.blogspot.com/2006/10/learning-basic.html

Right away some debate about the suitability of BASIC arose in the reader comments. My how things never change. ;-)

Thursday, October 12, 2006

Telengard and learning to program

Many years ago a close friend and I loved to play Telengard on his Commodore 64. This was a classic Dungeons and Dragons styled game. It was very well done and lots of fun. It seems to me though that was most fun about it was that it was written in BASIC. With very little effort we managed to break into the running game and customize it.

In fact recently I mentioned the game to him. He seemed to enjoy remembering most that we were able to hack the game. I was an experienced BASIC programmer at that time and it didn't impress me as much. I simply enjoyed playing the game.

I think what this makes clear to me is that programming novices like my friend really enjoy the process of learning by monkeying with a running system. You can just break into a program, examine or change a variable, add/change code and resume execution. I wonder how many beginners do not go on to become competent programmers without access to this kind of interactive system.

This is something that interpreted BASIC is excellent at. More systems need to be like this.

Thursday, September 14, 2006

It's about computer literacy

David Brin wrote an article about how computer users (kids in particular) need an easy language like BASIC again, and it should come with the computer. Read it all here http://www.salon.com/tech/feature/2006/09/14/basic/index.html

I absolutely agree with Mr. Brin's stance. The trouble isn't that there aren't tons of programming languages to choose from, many of them free. The problem is that the computer doesn't come with an easy language. And if it did come out of the box (like DOS had QBasic), it really should be an icon on the desktop. Hiding it away would be a bad thing.

Also the programming culture worships complexity. What the professional programmer today considers easy sets a bar way too high for the child or casually interested adult. The result is that the fun is removed from the experience. No fun = no learning.

Schools today think that computer literacy is about using Photoshop, Microsoft Office and Frontpage. That's a low-minded place to be. Teach kids to program. Some of them will latch onto the experience.

Security?

Scriptman responded to my last post with the following questions:

O.K. point taken, but how do you overcome security issues such as passing "nasty" commands to the interpreter? (yes even Perl has them if scripts are not properly configured.)

This is a very good question. Our web BASIC uses a custom web server with the language engine built right into it. We are trying to be very security minded. We will sandbox each session to prevent improper access to files and to avoid server swamping, processes that fail to terminate, etc.

Another question I have is, will your Basic have a feature to "get" (sorry no pun intended) parameters such as the IP of the client ?Much like the Perl $ENV{REMOTE_ADDR}

We don't have this yet, but I see no reason why it cannot be made available.

Not about Perl. Not about cgi.

Scriptman replied to an earlier post about our web BASIC effort:

What's wrong with PHP and PERL? They are both free and easy to learn.

So I replied to him with the following:

Perl is a useful tool, but let me explain why this is different from what we're doing.

First of all this is about BASIC, not Perl. If you like Perl then that's great. Use it. Enjoy. ;-)

A lot of people know and like BASIC, which is a perfectly useful language. There's no reason why a nice BASIC for the web shouldn't exist.

With Perl you have to manage at least three components. Your web server, your cgi scripts (you write them using a text editor), and to use your programs you use a web browser.What we're doing will allow the BASIC programmer to do everything in the browser. There is no concept of a remote procedure. An application with sophisticated interactive features can exist in one file, written in a very standard desktop app coding style. In other words this is going to be easy. If you think cgi programming with Perl is easy, this is going to be even easier.

Read the original post and comments here:

http://basicprogramming.blogspot.com/2006/05/web-20-extremely-easy-web-programming.html#comments

Tuesday, June 20, 2006

Liberty BASIC v5.0 for Linux Screenshots

Well, I promised to post some screenshots of Liberty BASIC v5.0 running on Linux, so here they are. Keep in mind that these are pre-alpha shots. Visit this link and click on the topic "Linux Screenshots"

http://libertybasic.conforums.com/index.cgi?board=lb5

-Carl

Saturday, June 10, 2006

LB5 update

I know a lot of people are eager to know how Liberty BASIC v5.0 is coming along.

First of all, please don't hold off purchasing Liberty BASIC because you think LB5 is about to be released. It won't be available until the end of 2006. Please go ahead and purchase LB v4.03. The upgrade to v5.0 will only be about $20.

Okay, so now some details. I am trying to wrap up an alpha release for testing by invitation only. The alpha will be Windows and maybe Linux. I'd like to release a Mac alpha also, but I'm having some issues that I'm seeking support for. Later this summer we will have beta versions which anyone can test, and these will probably all be Windows, Mac and Linux from the start.

A lot of energy has been going into the core language including user types, support for the new syntax for GUI controls, and graphics drawing.

In a few days I'll post some screenshots of how things are coming along for the general public, including an image demonstrating a grid control and the current (rough) state of the debugger.

I'm also going to blog soon about the new web BASIC Scott and I are working on. It is coming along nicely.

Thursday, May 25, 2006

Programming should be easy

The BASIC programming language was the original easy to use language. This was no accident. The inventors of BASIC designed it to be easy. People from all walks of like created their own software in BASIC on small computers that plugged into their television sets. I was one of those people, and many of you visiting this site remember what that was like. These computers were called home computers. They were simple and could be completely understood by someone without formal training. Anyone could learn to make the computer do what they wanted, and it was a lot of fun!

BASIC was at the center of all this.

However, once the IBM Personal Computer (the IBM PC) made its debut, the home computer began to fade. Every company wanted to make PCs, and home computers began to disappear from stores. With every year, creating software for PCs (which are really business computers) became more and more complicated.

Most home computers came with BASIC built right in. Just turn one on and it says something like:

**UltraBASIC v2.23 - 28374 bytes free**

READY>

Then you just jumped right in and started to program your computer in BASIC because BASIC was the startup mode of the computer. It was easy, everyone did it, and an entire industry grew up from it. This was real computer literacy, not just knowing how to use a word processor or play games and music. People wrote their own games and word processors. Much of the time this was out of necessity, but many people discovered they loved doing it!

Today we have a completely different picture. Programming languages are complicated. The software culture worships complexity and the popular programming languages of the day require thick manuals. Lots of money is made selling training. Programming it seems, is not for the rest of us.

Monday, May 15, 2006

Short term plans for the web BASIC

Scott and I had a sitdown design time last Friday and also managed to get started on some code for the web BASIC he is working on. The idea here is that you will be able to visit a site with a tabbed interface. The first few tabs will each have a code pane with an example program, and a Run button. Click on the button, and the program will run underneath on the same page. This should be a good way to get a feel for what kind of programming is possible. An additional tab will have an empty code pane so that you can try writing your own.

We will support the INPUT statement, so you can create interactive programs. The standard style of BASIC will be supported in this way. We will also include the ability to draw graphics and embed them into the output so you can draw graphs or game boards, etc. Fast animation won't really be possible using an http style of interaction, but if you want to create games that draw images (Star Trek, or Mastermind, or Sudoku) it should be fine.

Programs will be cached on the server for a few hours (or a day perhaps) so if you create a program on the site that you really like, you can share it with a friend by pushing a button to send an email with a URL that will take him straight to the program in his web browser. I think that's pretty cool because there's no need to install any software. It should work in any popular web browser including most phone browsers.

Scott already has some of this working. This should be fun. :-)

Sunday, May 07, 2006

Web 2.0 - Extremely easy web programming

While I am busy working on Liberty BASIC v5.0, my development partner Scott is working on something fun on the side. We are working on a dynamic web front end to Liberty BASIC so that you can write web programs in LB. We have some ideas for a unique tool for web programming that doesn't require all the crazy bits and pieces that are needed for the mainstream web solutions.

This will be an all-in-one solution with its own web server and it can be hosted behind Apache if so desired. We hope that in a month or so we will have a neat demo site up with some example pages that show how it works.

So, there's lots going on! :-)

Saturday, April 29, 2006

Maybe not about BASIC Programming, but cool!

I heard a radio news story the other day which I thought was really significant. A researcher working with the Jet Propulsion Laboratory was interviewed about a new methanol fuel cell that can be used to produce electricity (like a hydrogen fuel cell). The special thing about this new cell is that it can also be run in reverse to produce methanol from carbon dioxide. This means that industrial plants that produce lots of carbon dioxide can use this technology to scrub their output clean of carbon dioxide and also have methanol to sell in a methanol based economy.

This is significant beyond it's greenhouse gas reducing properties. Methanol can be transported and stored much more safely than hydrogen, can be mixed with gasoline, and burns cleanly. What's especially cool about it is that methanol is useful for more than just a fuel. It can easily be used to make all kinds of other useful things like ethanol, plastics, etc. You can't easily make anything useful out of gasoline or hydrogen (or ethanol).

Anyways, it's a really cool story. Check it out at:

http://www.npr.org/templates/story/story.php?storyId=5369301

Now back to our regular programming (pun intended).

Tuesday, April 18, 2006

Object Orientation and LB5

In a recent thread in the Conforums (http://libertybasic.conforums.com) someone asked the question of whether QBasic style types would be supported, and I elaborated and posted an example of what I was thinking about this for LB5. This prompted a reaction about what was perceived as a move toward object oriented programming.

Here is part of my reply:

Liberty BASIC 5 will not be an object oriented language. LBers will not be expected to learn OO programming.

There have been objects (the UI controls) in Liberty BASIC from the beginning, but I tried to avoid treating them like objects. I'm convinced this was a mistake. Since we have been using objects in our non-OO version of BASIC, we might as well fix the syntax to make it easy to do. The new syntax for programming UI controls is designed to treat them more appropriately.

Instead of printing to a button for example, it makes more sense to call a function on it like so:

#myButton enable(1)

Types and objects are very similar things. Therefore it makes some sense to try and cover them with a unified syntax, and not try to support two different syntax extensions. It makes sense to me to implement types as a sort of lightweight object. This makes even more sense because it will act as a conceptual bridge towards the new BASIC which will actually have a useful OO programming mechanism. This will be the simplest OO feature set I can get away with, and I hesitate to call the new language an OO language.

Friday, April 07, 2006

Interactivity in Programming

One theme that I keep coming back to is interactivity. As much as possible your programming tools should let you affect what is going on at any moment.

A neat new feature in the upcoming Liberty BASIC 5 that I demonstrated in New York is a more interactive debugging capability. Just as before you can start a program in the debugger from the editor, of course. One really cool new thing that you can do is just run the program without starting it in a debugger. You can then at any time decide that you want to debug the program. Just bring any window of the program to the top and break into it. A debugger will open on that program. You can examine variables, or if you like click on a line of code where you want to stop in the debugger and click on the Run To button. Then use the program and when that line of code is reached, the debugger will stop and highlight that line of code and you can see the variables. Then single step through the code, or just click the Run button to proceed full speed.

This is the sort of thing that I'm trying to provide that will bring back the interactivity of classic BASIC, which is one of it's more important features. Most newer programming languages (including most versions of BASIC) are pure compilers and do not let you stop a program in the middle are restart it.

Monday, April 03, 2006

Meeting Details Nailed Down

Okay, the Liberty BASIC 5 presentation at the NYC Smalltalk Users Group will be held Thursday, Apr 6 at 6:30 (actually the meeting starts at 6:30 and my presentation will start at 7:00) at the following address:

440 33th Street 8th Floor
New York City

It'll be great time, and for those interested after the meeting we'll retreat across the street to the New Yorker to spend some time in the restaurant together.

So if you're interested in a sneak peek of the next major release of LB, come and join us!

Friday, March 31, 2006

Smalltalk about BASIC in New York

I've been invited to demonstrate and speak about the new version of Liberty BASIC I'm working on. The venue is the New York City Smalltalk Users Group on April 6th, a Thursday evening. The reason this group invited me is because Liberty BASIC is developed in a version of Smalltalk so it's an interesting project for other Smalltalk developers.

I've been given permission to invite Liberty BASIC users to come also for a sneak peek. The meeting will be held a couple of blocks from Madison Square Garden. I'll post more details about the meeting place when I have them.

I hope we have have a few members of the Liberty BASIC community join us.

Monday, March 27, 2006

Programming for Fun in 10 Minutes

I found an interesting article where the author (Peter Norvig) complains about book titles that promise to teach programming in 24 hours, 7 days, 21 days, etc. He makes a really good point which is that it usually does take several years to become skilled as a programmer. However, in my own experience it doesn't even take a single day to learn enough programming to have fun doing it. Many of my readers will certainly agree with me when I say that doing it for fun is reason enough. If it isn't fun, you're probably not ever going to be any good at it. ;-)

For the curious, here's the link to his article: Teach Yourself Programming in Ten Years

Saturday, March 25, 2006

Evolving a language

Over the years I have tried very hard to maintain a simple and backwards compatible syntax with Liberty BASIC. This has worked well for the most part and most people seem to find Liberty BASIC easy to make friends with.

Sometimes in programming languages it is necessary to be willing to break with the past, especially when bad decisions have been made that hurt the programmer. In Liberty BASIC there is probably one decision in particular that I've been meaning to rectify for some time now, and that is the syntax for interacting with GUI widgets.

Originally it seemed like a cool idea to treat windows and widgets like streams, controlling them by printing to them, and getting information by reading out of them. This was fine in theory, but people don't automatically feel comfortable with this. For example:

'set the font to be Arial of size 10
print #myWidget, "font Arial 10"


Several things about this approach are unpalatable. First, printing to a widget is perhaps more of a leap than most people are comfortable with. Instead they might prefer a straight statement, and not put the command in a string.

The other problem with this approach is that it is just too noisy. I came to realize this a few releases ago and implemented a shorthand without the print keyword and comma, like so:

'set the font to be Arial of size 10
#myWidget "font Arial 10"


Well, that is better but still slightly foreign. Behind the scenes it is exanded to the full form.

Okay now here comes the really difficult part. Since we're sending the command as a string, this can get messy if we want to use variables. We need to concatenate a bunch of stuff together.

'set the font to be Arial of size 10
#myWidget "font ";fontName$; " "; fontSize


Can you say ugly?

Okay, so let's fix this. With Liberty BASIC 5 were going to make another evolutionary step that will give us a lot of flexibility. Instead of treating widgets like streams, we'll treat them like the objects they are. So widget commands will be turned into function calls (or method calls in OO parlance):

'set the font to be Arial of size 10
#myWidget font(fontName$, fontSize)


This is much simpler and cleaner. It is also more similar to the conventions that programmers are used to.

There are also commands which return a value. Here is an example in the current syntax that places the contents of an input field into a variable:

'set myVariable to the contents of this input field
#myWidget "!contents? myVariable$"


In our new syntax you will be able to return a value from a function in the familar way, like so:

'set myVariable to the contents of this input field
myVariable$ = #myWidget contents$()


Were still going to support the old syntax for backwards compatibility, but all the examples and documentation will use the new form.

In addition to using this convention to control widgets, we also hope to use this syntax to add some scriptability to the Liberty BASIC IDE. I'll blog about this in more detail in the coming weeks.

Thursday, March 23, 2006

Microsoft still supports Visual Basic?

I recently received some email critical of my claim that Microsoft no longer supports or provides Visual Basic. I suppose this is a fair point. They do after all still sell a product called Visual Basic.

So what gives? An awful lot of people don't think that the new Visual Basic .Net product is Visual Basic at all. It's more of a version of C# (a Java clone, more or less) with some BASIC syntax thrown on top. It's not hard to use Google to find many articles of people who agree with this sentiment.

Here are some examples that I found in just minute:

http://www.sqlmag.com/articles/index.cfm?articleid=21050&

And from Wikipedia:
http://en.wikipedia.org/wiki/Visual_Basic_.NET#Comparative_samples
http://en.wikipedia.org/wiki/Visual_Basic_.NET#Controversy_concerning_VB.NET

If there's any dishonesty here, I claim that it's on Microsoft's part. For years people complained that Visual Basic isn't BASIC. Now people are complaining that VB.Net isn't Visual Basic. Where does it end? ;-)

Monday, March 20, 2006

Whatever happened to PEEK and POKE?

Sometimes I'm asked how to PEEK and POKE using Liberty BASIC. The short answer to this is, you can't. The long answer is more complicated.

The original home computers (like the classic Commodore 64, TRS-80, and Apple II models) were designed to be completely open to their owners. Most of the different parts of the computer like the sound, graphics, keyboard and joystick (there were no mice back then) were controlled by mapping them to different memory locations. So, the built-in commands didn't do everything you need? It was common to control the computer's equipment directly by sticking values into the memory locations that control that equipment, and reading the status back out. This was done with POKE and PEEK. This was a lot of fun, and usually useful too.

Since these early machines didn't multitask it was pretty safe to steal control of things away from the BASIC interpreter (which was a much operating system as there was). Then computers started running Windows, the Mac OS, Linux, etc. and allowed more than one program to run at a time. PEEK and POKE became problematic because if one program decided to mess with the screen for example, it might interfere with what other programs need to do their thing. Not only that, but computers today all have different kinds of hardware in them, so even if you could PEEK and POKE the exact memory locations would be different from machine to machine. So that's the bad news. :-(

The good news is that we can still have a power trip. How? Your operating system manages all the hardware for you behind operating system functions. These functions make every computer look more or less the same to the programmer. You can use these functions to do a lot of powerful things and most languages have a way to use them. For example Liberty BASIC programmers can use the CALLDLL command to make Windows API calls, which are the operating system calls of the Windows operating system. These are more complicated in general (and you can fill a whole bookshelf with information about them) than the old fashioned PEEK and POKE, but at least we aren't left without some way to pull rank on our computers. ;-)

So if you're missing the power and coolness of PEEK and POKE, why not try your hand at API calls?

Here is a useful link to get you started: http://babek.info/libertybasicfiles/lbnews/nl108/api.htm

Wednesday, March 15, 2006

Redevelopment price hike?

In a comment to a previous post Isaac Raway wrote: "I see that you note you're going to change the syntax for controlling widgets in the new basic you're working on. Awesome! This may actually make me want to switch to LB as my main platform--maybe."

I'm glad to hear this. The new LB is coming along nicely now.

Isaac continues: "However I'm a bit concerned. I've seen this sort of "redevelopment" happen before, and often times it comes with a higher price tag. One of the strong points of LB I think is that it is truly useful but very inexpensive. I think you're the kind of person who realizes that though, so I have faith you'll keep it affordable."

Well, you're right. Pricing is a marketing issue and it isn't always clear whether to raise or lower prices. I can't promise that I will never raise the price of Liberty BASIC (in fact I've done it before) but I am committed to keeping it affordable. Many times I get feedback that LB is too inexpensive and that I should raise the price, so you see this is not a simple matter to determine.

Also remember that now we have a free BASIC (http://www.justbasic.com).