Programming made Simple!
Posted:
Monday, July 27, 2009
In the 90s, a big company from up north was extremely successful with a dialect of the programming language BASIC (acronym for Beginner's All-purpose Symbolic Instruction Code). One of the reasons it was so successful was that the language was easy to learn and use.
Bringing an easy to learn and use language to the mobile world and the Android platform is the goal of the Simple project. Simple is a BASIC dialect for developing Android applications. It is particularly well suited for non-professional programmers (but not limited to). Simple allows programmers to quickly write Android applications by using the components supplied by its runtime system.
Similar to its 90s relative, Simple programs are form definitions (which contain components) and code (which contains the program logic). The interaction between the components and the program logic happens through events triggered by the components. The program logic consists of event handlers which contain code reacting to the events. In reality it is even simpler than this description.
Let's see how simple it really is. We will quickly write a program simulating the famous Etch-A-Sketch on an Android device. Tilting the device will move the pen, shaking the device will clear the screen. The Simple runtime system gives us three components to provide most of the needed functionality:
The code defines two global variables (lines 1 and 2) and two event handlers, one to handle changes in the device's tilt (lines 4 to 17) and another to handle shaking of the device (lines 19 to 21). The code in the first event handler makes sure to only react to tilting above a certain degree (lines 6, 8, 11 and 13), and if that is the case then it further ensures that the pen does not run off the drawing surface (lines 7, 9, 12 and 14). And finally a point is drawn at the pen position (line 16). As for the other event handler, the only thing it does is clearing the drawing surface in case of shaking (line 20).
Last part missing is the form definition. It defines the form and its properties (lines 24 to 27), followed by the components it contains (lines 28 to 33).
That's it. The only thing left to do is to compile and deploy the application to an Android device. And voila, here is a screenshot of the application running:
For a definition of the Simple language see the Simple Language Definition (download, 199 KB PDF). For more information on writing Simple applications see the open source project page at code.google.com/p/simple. You can also find information there on contributing to the project, and we encourage you to join our discussion list to provide us feedback.
Programming made Simple!
Bringing an easy to learn and use language to the mobile world and the Android platform is the goal of the Simple project. Simple is a BASIC dialect for developing Android applications. It is particularly well suited for non-professional programmers (but not limited to). Simple allows programmers to quickly write Android applications by using the components supplied by its runtime system.
Similar to its 90s relative, Simple programs are form definitions (which contain components) and code (which contains the program logic). The interaction between the components and the program logic happens through events triggered by the components. The program logic consists of event handlers which contain code reacting to the events. In reality it is even simpler than this description.
Let's see how simple it really is. We will quickly write a program simulating the famous Etch-A-Sketch on an Android device. Tilting the device will move the pen, shaking the device will clear the screen. The Simple runtime system gives us three components to provide most of the needed functionality:
- the Canvas component - for drawing
- the OrientationSensor component - to detect tilting
- the Accelerometer component to detect shaking
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Dim x As Integer Dim y As Integer Event OrientationSensor1.OrientationChanged(yaw As Single, _ pitch As Single, roll As Single) If roll < -20 Then x = Math.Min(Canvas1.Width, x + 1) ElseIf roll > 20 Then x = Math.Max(0, x - 1) End If If pitch < -20 Then y = Math.Min(Canvas1.Height, y + 1) ElseIf pitch > 20 Then y = Math.Max(0, y - 1) End If Canvas1.DrawPoint(x, y) End Event Event AccelerometerSensor1.Shaking() Canvas1.Clear() End Event |
The code defines two global variables (lines 1 and 2) and two event handlers, one to handle changes in the device's tilt (lines 4 to 17) and another to handle shaking of the device (lines 19 to 21). The code in the first event handler makes sure to only react to tilting above a certain degree (lines 6, 8, 11 and 13), and if that is the case then it further ensures that the pen does not run off the drawing surface (lines 7, 9, 12 and 14). And finally a point is drawn at the pen position (line 16). As for the other event handler, the only thing it does is clearing the drawing surface in case of shaking (line 20).
Last part missing is the form definition. It defines the form and its properties (lines 24 to 27), followed by the components it contains (lines 28 to 33).
| 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | $Properties $Source $Form $Define EtchSketch $As Form Layout = 3 BackgroundColor = &HFFFFFFFF Title = "EtchSketch: Tilt to draw - Shake to clear" $Define Canvas1 $As Canvas $End $Define $Define OrientationSensor1 $As OrientationSensor $End $Define $Define AccelerometerSensor1 $As AccelerometerSensor $End $Define $End $Define $End $Properties |
That's it. The only thing left to do is to compile and deploy the application to an Android device. And voila, here is a screenshot of the application running:
For a definition of the Simple language see the Simple Language Definition (download, 199 KB PDF). For more information on writing Simple applications see the open source project page at code.google.com/p/simple. You can also find information there on contributing to the project, and we encourage you to join our discussion list to provide us feedback.Programming made Simple!

Whoever approved this at Google should be fired. Please tell me this is an April fools joke.
ReplyDeleteThe entire software industry has moved away from BASIC and VB, yet for some reason it is still considered "good for non-programmers". No, I just don't see it. I think languages like Python and Ruby have proven that you can create a clean syntax usable by all different skill levels.
For me, the example code is a complete mess of overly complicated control structures that do nothing but obstruct someone from following the program logic. If I was a non-programmer, I would have given up after the second or third line.
clear instructions...right from a first day's class in programming...good.
ReplyDeleteActually Microsoft's Basic was big from 1975 or so. By the time I got onto computers, MS Basic was the standard that people programmed to. My first programming was taking all the games from the Creative Computing magazines and books and figuring out what worked and didn't.
ReplyDeleteWill you guys have some sort of wiki where people can upload games/programs for others to learn from?
Why Basic?
ReplyDeleteWhy not something _that_ _is_ a programming language like Python?
Definetly Java would be a very bad choice, but Basic can be a worst choice.
First of all I wonder who still believe in "programming made simple". This is an oximoron.
Secondly, Basic is really poor in terms of syntax and capabilities and lots of limits.
This means that it is always possible to to some jobs, but with a difficulty that is higher than necessary (and that is the contrary of "made simple").
I like new projects. But I don't see anywhere that describes the purpose or goal of this language?
ReplyDeleteI remember a little about the old basic before Microsoft became big. The simple language looks similar to the newer 'VB6 Basic'. Is this true?
I guess this is the way of the future.
ReplyDeleteSounds similar to WPF.
BAH! This isn't BASIC, and BASIC isn't from the 90's.
ReplyDeleteThis is the language I programmed in (albeit on a machine in the 90's that was already ancient):
http://www.scribd.com/doc/200906/Apple-II-BASIC-Programming-Manual-1978Apple
Modern BASIC variants have none of the simplicity that made the original worthwhile. I was literally able to learn the original basic at 8 years of age.
"Dim x As Integer"? Please. Here is some BASIC:
10 PRINT "HELLO WORLD"
20 GOTO 10
10 GR
20 COLOR=7
30 PLOT 5,14
Yes, you have to type in the line number that you want the code to go on. There's no fancy smancy "text editor".
Programming languages are an inherently controversial subject. Very similar to food...
ReplyDeleteI personally don't believe that there is a perfect language, one that fits all tastes and needs. Therefore it is good thing to give people a choice.
Smooge,
I believe the best place to post samples is on simple-discuss. Just create a new thread. I can add a link to that thread from the code.google.com wiki.
Berlin Brown,
Simple is indeed similar to VB6 which was, and still is, a very popular programming language.
Cheers!
If your going to create some Etch-A-Sketch script... might as well use the Terrapin Logo Turtle so some oldschool geeks get to use some of our computer knowledge of the 80's. :) Logo rocks. :p
ReplyDeleteIf you want to teach beginners to code, why not use a scripting language like Lua, Ruby or Javascript? These types of languages were developed with non-technical users in mind, sporting simple syntax, thorough documentation and clear error messages. They also have more advanced functionality for experts.
ReplyDeleteCompare this to Google Basic, which has verbose and obtrusive syntax, strict typing(a beginner's nightmare), less functionality than experts would want and no existing community... Any rational manager should demand Google Basic be dropped immediately!
What does Dim mean? Why is everything capitalized funny? What's an underscore and why is it there? Why do I have to have properties anyway? Why is it sourced and from nowhere (and how are these two separate things)? Why do I have to give the sensors new names?
ReplyDeleteThe original BASIC's were much simpler than this. Is Simple really simple?
The original basic was not as stated above. I learned BASIC in 1964 using a Teletype machine and paper tape over a phone line to a computer. At the time it was an interesting toy, but I did serious work in Assembler language. It was amusing 20 years later to reuse it on my home computer before PCs, it was even more amusing that is turned into Visual Basic.
ReplyDeleteNevertheless, I think that Basic is easier for a beginner to learn than Python. Python and C require a different way of thinking than basic and can lead to severe programming errors.
Yes VB6 was a heck of a language in the business environment. I made a living for many years from VB from VBDOS to VB6. Once .NET appeared I jumped ship to C# and very happy with my choice. GWBasic and all those that I learned on were very fun and necessary for me to own my own software development company now.
ReplyDelete.NET ROCKS!!! But like someone else said, everyone has their own opinion and what they prefer depending on the task they are trying to accomplish.
why not python? :(
ReplyDeleteI coded BASIC as a kid. Both on the Commodore 64 and the PC Junior. I moved on to Pascal and then C. Over the years I've written Java, JavaScript, perl and Lua.
ReplyDeleteThe code examples you gave, it's some of the ugliest, non-simple code I've ever seen.
Hell, I had not even ever seen a 'dim' statement, didn't know what the heck that was.
It turns out it's in some BASIC variants, specifically Visual Basic.
So it really seams like you've invented a VB-like language for development on Android.
Since that appears to be the goal you set out to achieve, you really should rename the project like 'AndroidVB' or something.
Because if 'simple' was your goal, I could think of a billion better choices for syntax and language features than the language that you've created.
Maybe it's because I'm not a visual basic programmer. Maybe if I was familiar with Microsoft's visual basic I would find this 'simple'.
I think you calling it 'simple' is very misleading. You really should call it 'Visual Basic for Android' or something similar to that.
Regardless, I applaud your efforts though, you've created a lot of documentation and how-to wiki pages. Creating a compiler and complete language definition, etc. is a lot of work and you should be proud of those accomplishments.
However unless you have a VERY tough skin, I'd avoid trying to market it as a 'simple' language for 'non programmers' and instead be HONEST that this is basically 'Visual Basic for Android'.
Market it to that group of folks and I'm sure you'll be much happier and receive a great reception from the VB folks :)
The real SiMPLE language has already been developed.
ReplyDeleteI found it as the first hit when googled "simple language": http://www.simplecodeworks.com/website.html
They even already developed Micro-SiMPLE, Pro-SiMPLE and Ultra-SiMPLE!
What an atrocious piece of code. It's everything but clear and logic. Like a previous commenter wrote: programming isn't easy and in my opinion shouldn't be treated as such. Programming is an art. It's the skill that makes the difference between good and poor code. If Google would really want to lower the hurdles and invite moer people to write software for their Android platform, why not look at modern "easy" programming languages? Python or even more so, Ruby would do nicely. No need to "invent" something new and confuse the world a wee bit more...
ReplyDeleteThis is the dumbest idea I have ever heard. Thats what we need more bad apps.
ReplyDeleteLet keep the bad apps on the entertainment platform called iPhone
coded BASIC as a kid? Haven't ever seema DIM statement? Hmmm. You never did used an array? As I can remember back them, you need to call DIM to allocate memory for your array such as DIM A(20).
ReplyDeleteNice Idea,
ReplyDeleteI meet Basic in 1978, when I bought my RadioShach TRS80.
Then I was a senior programmer, I had start writing code in 68, in Assembler360, Cobol, Fortran.
When I set on my own in 83, I use MSBasic compiler to program the first IBM PC.
I design an integrated package for Contacts, Billing and Accounting aimed at service companies, using a DataBase of my own (hashed index) very fast and reliable.
I like Basic because it is simple to design a mokeup and later finishing the application.
In 2001 I had to stay aside for few months during an health cure.
I write 3 translation software #1 to turn Basic code into JavaScript (including forms and events); JSBasic, #2 to C++; C++Basic, #3 to Java Javaapplets ,I was very amazed by the result. In C++ as was able to port quick written code on any machine while improving the speed.
Writting these translation softwares ie Transcompilers, I had learn a lot about VB, lack and plus, porting, writing correct code and defining coding rules.
I am using daily JavaScript and PHP that both look pretty much to Basic, but with a C like syntax, but I am often writing small piece of code for It housekeeping in AutoIT V3 a sort of Windows API basic scripting language.
I support your initiative as there is a lot of person that use to had write a very usefull piece of code and want to keep using it.
Happy programming...
Agreed with Robert. Don't call this Simple, because it is not. That code there is truly scary.
ReplyDeleteGoogle has become such a large company that one part can't talk to the other, and thus you get this. Quite sad. Instead they could've gotten Lua and Python out of the Android Scripting Environment-shell and made it easier to use on Android. Come to think of it, I still haven't made it work so I'm developing in Java now instead.
A lot of people have pointed out that Simple will make it simple to make, well, simple apps. If you're not interested in that, feel free not to use it. But we also believe that some people will use it to make apps that are genuinely useful. And that even more people will use it to gain a lifelong interest in computing that can only benefit the industry.
ReplyDeleteCongratulation. Million programmers of the whole world have developed with some type of BASIC, probably it is the most popular language. It has disadvantages that few languages have, but at the same time it has advantages that very small; or no language have.
ReplyDeleteOh my god you guys complain a lot...
ReplyDeleteAll these guys are just big complainers who don't understand the purpose of the SIMPLE language. It's intended to make programming for a large population of people who don't understand C, but are very good with Visual Basic to do this. For Pete's sake, this is a great thing. So shut your mouths and be grateful that something is being done at Google. Not everything is successful, but at least they are trying, and trying the right things. A Python language is not what we need. WE NEED BASIC and SIMPLE could very well be the solution. What we now need is an IDE that would truly make SIMPLE easy to use.
ReplyDeleteI learned to program in Basic with my Commodore VIC-20 back in 1983. Ok, it was fun then. But for serious programming you cannot use such outdated tools.
ReplyDeleteIf you're looking to learn a programming language, there are many these days such as: C#, Java, PHP, Pyton, etc.
It really depends on what you need to acomplish, there is no "perfect" programming language, but it is worthless to learn something like Basic or VB,
It's all about having fun in learning how to program.
ReplyDeleteIf you already know Basic why not use basicjs.com,
Simple as that
Hello. Well, I think that this BASIC could make, as Visual Basic, RealBasic and many others, people to start developing focusing on what to do instead of how to do it. I myself created a management app for a lawyer buffet by using Visual Basic about 10 years ago, and they are still using it, even when several software companies tried to make them change that software. I know that surely it will not take the most from the hardware, but if it does its job well done, it will worth the effort.
ReplyDeleteI'm an enterprise VB scripter - I code mostly vb and sql for legacy Access and SQL server applications (business analyst not full time coder - though a hobbyist with .net). I want to have a go at playing with the Android purely for entertainment. This is perfect for me - so f***ing what if I'm not a real coder cus I don't know python inside out - this is a valid and very useful function for people like me who want to branch out.
ReplyDeleteLimiting a modern computing device like Android to the virtual machine technology of the sixties reduces developers to single programmers working at home on same old applications. A device with today’s computing power should be used for end-to-end enterprise and scientific solutions, in particular solutions that are not feasible with any combination of contemporary technology outside of Z++.
ReplyDeleteI have been reading the comments that some of these guys have wrote about your programming language is not simple or that BASIC is a joke and even that there language is the best ever.
ReplyDeleteReally guys, what do you think all these compilers that you are using to write your high level languages were written in, I don't hear any of you using assemble, that is the one that gives you absolute control, of course it is very complete and the reason languages like FORTRAN, BASIC, C, C++, Java and you name it were created.
Here is another Visual Basic-like language targeting Android devices:
ReplyDeleteBasic4android
NS Basic/App Studio is another option. It has a full IDE, creates apps for Android and iOS and implements a large subset of Visual Basic.
ReplyDeleteGoogleBasic:
ReplyDeleteFor people who say that the last thing we need is more bad apps ... most gadgets written with these sorts of tools are never intended to reach an app store, the idea is to let people get their hardware to do things that //they// want without having to be dependent on someone else's app. It's about empowerment - letting users be more assertive and proactive and less dependent on corporate stores telling them what they're allowed to do. It's like letting people have access to basic woodworking tools so that they can put up an occasional shelf. Sure, most users aren't going to be master carpenters, and maybe a cheap wood saw from B&Q isn't going to be something that a professional would choose, but they aren't intending to sell those shelves, they just want to use them.
So it's a GOOD thing.
To all those who hate BASIC, in any variation, you can always try writing a language and freely distribute it for others to download and use. If you want to program in Python, Ruby, LUA, or any other that’s your choice and you are welcome to it.
ReplyDeleteStop complaining; to a lot of us BASIC was the first language that we had access to and were able to learn. In my case it all started with the Radio Shack computers (TRS-80’s, COCO’s (color computers)) and TI-99-4A, it was followed by Assembler (Z80, 8080, 8086), FORTRAN, RPG (WAT4), COBOL, Visual BASIC variants, and HTML/CSS/JavaScript. C was still in development when I graduated from college and wasn’t even taught until much later, and Windows was just a dark presence taking over Gate’s mind. I have also translated PASCAL and C (both from books) into BASIC/Assembler hybrid programs. I have found that for the most part, BASIC can do almost anything those other languages can with a little creative programming (and know that one of my college professors won a bet proving just that to some of his snotter programming rivals). And if it can’t now, someone will figure out how and add the functionality to it later.
My only peeve is that most of the native running BASIC variants for the Android system are focused on the APPLESOFT variant of BASIC or are trying to do a merging of old BASIC and object based BASIC (look at BASIC! & SQL for ANDROID). I would like to see a version of QBASIC/QUICKBASIC with Android extensions running natively on the ANDROID and is freely available (not a write on PC/MAC/Linux, upload to net, download to Android (phone or tablet) and hope it runs, rinse and repeat as needed to bug fix).
Some people here say Basic isn't simple. I say it IS simple if you do simple things.
ReplyDeleteSome say Basic isn't a real language and it can't do everything "real" programming languages can. I say that you CAN do anything in Basic that you can in C# or C++. You do so using VB.NET.
The beauty of Basic is that it is extremely scalable. If all you want to do is play with it or write simple code, it's perfect for you because the syntax is almost like reading English. If you want to do more, learn the more advanced commands. If you need to work with objects like windows and forms (dialog boxes), write your code in VB6. (I think VB5 is free, and it is almost as powerful as VB6.) Making and coding forms in VB6 is extremely fast and easy!
Some people here say that Basic was only easy "in the old days" when it used line numbers. No, I'm sorry to have to tell you that line numbers only complicate matters. The only thing good about line numbers is that you can jump to a different line. Forget line numbers and instead use subroutines. Subroutines are easy to use and you'll be glad you spent the 10 minutes to learn about them.
I haven't written a Basic program in twenty years, but I can easily remember it's syntax because it is very intuitive. I'll give it a try here. I'll bet you can easily get what I'm doing even if you've never written a line of code in your life. Here we go...
x = 1
do until x = 100
if x = 10
print "Ten"
else if x = 20
print "Twenty"
else
print "Greater than Twenty"
end if
x = x + 1
loop
(Note that optionally I could have written lines like "if x = 10" as "if x = 10 then." That would read more like English, but I find it to be excessively wordy.)
See how easy that is to read? No stupid semicolons ending lines. No unnecessary variations on the equal sign like := or ==. No placing several lines of code within parenthesis. You write it much the way you write English. The indentations are optional but are very useful in reading the code.
Some people complain that modern Basic isn't simple because it is strongly typed. They say, what is "Dim?" I've never seen Dim before. ("Dim" is short for Dimension and it is used to declare variable types.) The truth is that Dim statements are optional and are used by serious programmers. If declaring types isn't important to you, then don't worry about it.