<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9079409828842982745</id><updated>2011-11-27T16:11:53.079-08:00</updated><category term='Simple Language'/><title type='text'>Simple Blog</title><subtitle type='html'>Simple programming language Blog</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://simplecompiler.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9079409828842982745/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://simplecompiler.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Herbert</name><uri>http://www.blogger.com/profile/07993699137796843939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9079409828842982745.post-8475227925634038498</id><published>2009-07-29T08:37:00.000-07:00</published><updated>2009-07-29T08:57:52.525-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Simple Language'/><title type='text'></title><content type='html'>&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   font-family:Arial;font-size:13px;"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Programming Made Simple!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In the 90s, a big company from up north was extremely successful with a dialect of the programming language BASIC (acronym for &lt;i&gt;Beginner's All-purpose Symbolic Instruction Code&lt;/i&gt;). One of the reasons it was so successful was that the language was easy to learn and use.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;Let's see how simple it really is. We will quickly write a program simulating the famous &lt;a id="qzb6" target="blank" href="http://en.wikipedia.org/wiki/Etch_A_Sketch" title="Etch-A-Sketch"&gt;Etch-A-Sketch&lt;/a&gt; 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:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;the Canvas component - for drawing&lt;/li&gt;&lt;li&gt;the OrientationSensor component - to detect tilting&lt;/li&gt;&lt;li&gt;the Accelerometer component to detect shaking&lt;/li&gt;&lt;/ol&gt;Let's take a look at the source code for this application:&lt;br /&gt;&lt;br /&gt;&lt;table class="" id="y00." bgcolor="#eeeeee" border="1" bordercolor="#000000" cellpadding="3" cellspacing="0" height="365" width="525"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style=" ;font-family:'Courier New';"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;3&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;4&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;5&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;6&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;7&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;8&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;9&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;10&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;11&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;12&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;13&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;14&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;15&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;16&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;17&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;18&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;19&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;20&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;21&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;Dim&lt;/b&gt; x &lt;b&gt;As&lt;/b&gt; &lt;b&gt;Integer&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;Dim&lt;/b&gt; y &lt;b&gt;As Integer&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;Event&lt;/b&gt; OrientationSensor1.OrientationChanged(yaw &lt;b&gt;As Single&lt;/b&gt;, _&lt;br /&gt;pitch &lt;b&gt;As Single&lt;/b&gt;, roll &lt;b&gt;As Single&lt;/b&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;If&lt;/b&gt; roll &lt; -20 &lt;b&gt;Then&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;x = Math.Min(Canvas1.Width, x + 1)&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;ElseIf&lt;/b&gt; roll &gt; 20 &lt;b&gt;Then&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;x = Math.Max(0, x - 1)&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;End If&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;If&lt;/b&gt; pitch &lt; -20 &lt;b&gt;Then&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;y = Math.Min(Canvas1.Height, y + 1)&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;ElseIf&lt;/b&gt; pitch &gt; 20 &lt;b&gt;Then&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;y = Math.Max(0, y - 1)&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;End If&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;Canvas1.DrawPoint(x, y)&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=" ;font-family:'Courier New';"&gt;End Event&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;Event&lt;/b&gt; AccelerometerSensor1.Shaking()&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;Canvas1.Clear()&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=" ;font-family:'Courier New';"&gt;End Event&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;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 &lt;span style=" ;font-family:Verdana;"&gt;first&lt;/span&gt;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).&lt;br /&gt;&lt;br /&gt;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).&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;table class="" id="qmi6" bgcolor="#eeeeee" border="1" bordercolor="#000000" cellpadding="3" cellspacing="0" height="250" width="525"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style=" ;font-family:'Courier New';"&gt;22&lt;br /&gt;23&lt;br /&gt;24&lt;br /&gt;25&lt;br /&gt;26&lt;br /&gt;27&lt;br /&gt;28&lt;br /&gt;29&lt;br /&gt;30&lt;br /&gt;31&lt;br /&gt;32&lt;br /&gt;33&lt;br /&gt;34&lt;br /&gt;35&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;&lt;span style=" ;font-family:'Courier New';"&gt;$Properties&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;$Source $Form&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$Define&lt;/b&gt; EtchSketch &lt;b&gt;$As&lt;/b&gt; Form&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;Layout = 3&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;BackgroundColor = &amp;amp;HFFFFFFFF&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;Title = "EtchSketch: Tilt to draw - Shake to clear"&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$Define&lt;/b&gt; Canvas1 &lt;b&gt;$As&lt;/b&gt; Canvas&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$End $Define&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$Define&lt;/b&gt; OrientationSensor1 &lt;b&gt;$As&lt;/b&gt; OrientationSensor&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$End $Define&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$Define&lt;/b&gt; AccelerometerSensor1 &lt;b&gt;$As&lt;/b&gt; AccelerometerSensor&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;&lt;b&gt;$End $Define&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;$End $Define&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';"&gt;$End $Properties&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;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:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://2.bp.blogspot.com/_S5_xMiIF4Sc/Sm4T2fMUdhI/AAAAAAAAAK0/LZmJcLTFMHI/s400/EtchSketch.png" alt="" id="BLOGGER_PHOTO_ID_5363246033051874834" border="0" style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; display: block; text-align: center; cursor: pointer; width: 267px; height: 400px; padding-top: 4px; padding-right: 4px; padding-bottom: 4px; padding-left: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); " /&gt;For a definition of the Simple language see the Simple Language Definition (&lt;a title="download" target="blank" href="http://simple.googlecode.com/files/Simple_Language_Definition.pdf" id="eg9i"&gt;download&lt;/a&gt;, 199 KB PDF). For more information on writing Simple applications see the open source project page at &lt;a title="code.google.com" target="blank" href="http://code.google.com/p/simple" id="ucim"&gt;code.google.com/p/simple&lt;/a&gt;. You can also find information there on contributing to the project, and we encourage you to join our &lt;a title="discussion list" target="blank" href="http://groups.google.com/group/simple-discuss" id="pn4l"&gt;discussion list&lt;/a&gt; to provide us feedback.&lt;br /&gt;Programming made Simple!&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial; font-size: 13px;"&gt;(This is a copy of my original post on the 'Open Source at Google' blog)&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9079409828842982745-8475227925634038498?l=simplecompiler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://simplecompiler.blogspot.com/feeds/8475227925634038498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://simplecompiler.blogspot.com/2009/07/programming-made-simple-in-90s-big.html#comment-form' title='39 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9079409828842982745/posts/default/8475227925634038498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9079409828842982745/posts/default/8475227925634038498'/><link rel='alternate' type='text/html' href='http://simplecompiler.blogspot.com/2009/07/programming-made-simple-in-90s-big.html' title=''/><author><name>Herbert</name><uri>http://www.blogger.com/profile/07993699137796843939</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_S5_xMiIF4Sc/Sm4T2fMUdhI/AAAAAAAAAK0/LZmJcLTFMHI/s72-c/EtchSketch.png' height='72' width='72'/><thr:total>39</thr:total></entry></feed>
