tag:blogger.com,1999:blog-298689322024-03-29T17:20:25.555+10:30Bill Kerr21st C education: FabLearnBill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-29868932.post-40633952753536330432008-04-03T00:24:00.006+10:302008-04-03T00:44:32.523+10:30late binding scratch catBecause it is written in Squeak Smalltalk, Scratch does support late binding as illustrated by this script:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGYpbLFMt7sPXCTimcqLSCVIsXWQ5oyCIETJ2FZRUcfRQFPPpeh1EJIqgF5EgHNDcYOSypNzBCC5jfa4SJN2FkbJs0e7kgJtoqU040DyeDh05kPCJ1FTM2GnkF6VrImCRuyac/s1600-h/lateBindingCode.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGYpbLFMt7sPXCTimcqLSCVIsXWQ5oyCIETJ2FZRUcfRQFPPpeh1EJIqgF5EgHNDcYOSypNzBCC5jfa4SJN2FkbJs0e7kgJtoqU040DyeDh05kPCJ1FTM2GnkF6VrImCRuyac/s320/lateBindingCode.jpg" alt="" id="BLOGGER_PHOTO_ID_5184647283352201250" border="0" /></a><br />I could tweak the size slider while the program was still running to produce a whole variety of new coloured squares on top of the original squares:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJTeALJIzlhPEfaOzQEJhi03qaAHELP1KNlVNm2ah69aWjNdIo9DlZl6AQkpDMhFuijl-Ik4t2_RdFJLh9eNlJzRnK6DRoh2d_vA-SjdyWtQ73IF0-bOvFQZ07YbpQfgwzc50/s1600-h/lateBindingCat.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJTeALJIzlhPEfaOzQEJhi03qaAHELP1KNlVNm2ah69aWjNdIo9DlZl6AQkpDMhFuijl-Ik4t2_RdFJLh9eNlJzRnK6DRoh2d_vA-SjdyWtQ73IF0-bOvFQZ07YbpQfgwzc50/s320/lateBindingCat.jpg" alt="" id="BLOGGER_PHOTO_ID_5184648129460758578" border="0" /></a><br /><br />For more on late binding see:<br /><br /><a href="http://billkerr2.blogspot.com/2007/11/why-learn-etoys-squeak.html">why learn etoys squeak?</a><br /><br /><a href="http://billkerr2.blogspot.com/2007/09/morphic-etoys-is-superior-graphical.html">morphic / etoys is superior GUI and programming development system</a><br /><br /><a href="http://billkerr2.blogspot.com/2007/04/late-binding-references.html">late binding references</a><br /><br /><a href="http://billkerr2.blogspot.com/2007/04/etoys-late-binding.html">etoys (late binding)</a>Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.comtag:blogger.com,1999:blog-29868932.post-29100586417507368002007-09-13T12:24:00.000+09:302007-09-24T01:53:53.425+09:30smalltalk: philosophy, metaphor, semantics, syntax<blockquote>Programming languages can be categorized in a number of ways: imperative, applicative, logic-based, problem-oriented, etc. But they all seem to be either an "agglutination of features" or a "crystallization of style." COBOL, PL/1, Ada, etc., belong to the first kind; LISP, APL-- and Smalltalk--are the second kind. It is probably not an accident that the agglutinative languages all seem to have been instigated by committees, and the crystallization languages by a single person.<br /><br />Smalltalk's design--and existence--is due to the insight that everything we can describe can be represented by the recursive composition of a single kind of behavioral building block that hides its combination of state and process inside itself and can be dealt with only through the exchange of messages. Philosophically, Smalltalk's objects have much in common with the monads of Leibniz and the notions of 20th century physics and biology. Its way of making objects is quite Platonic in that some of them act as idealisations of concepts--Ideas--from which manifestations can be created. That the Ideas are themselves manifestations (of the Idea-Idea) and that the Idea-Idea is a-kind-of Manifestation-Idea--which is a-kind-of itself, so that the system is completely self-describing-- would have been appreciated by Plato as an extremely practical joke ...<br /><br />I recalled the monads of Leibniz, the "dividing nature at its joints" discourse of Plato, and other attempts to parse complexity. Of course, philosophy is about opinion and engineering is about deeds, with science the happy medium somewhere in between. It is not too much of an exaggeration to say that most of my ideas from then on took their roots from Simula--but not as an attempt to improve it. It was the promise of an entirely new way to structure computations that took my fancy. As it turned out, it would take quite a few years to understand how to use the insights and to devise efficient mechanisms to execute them.<br />- alan kay, <a href="http://gagne.homedns.org/%7Etgagne/contrib/EarlyHistoryST.html">the early history of smalltalk</a></blockquote>Most books on programming that I have seen don't include much in the way of philosophy or metaphor. They seem to be filled with detailed definitions and techniques.<br /><br />But from the alan kay quote above it's clear that Smalltalk, the first OOPs language drew heavily from philosophical principles - the monads of Leibniz, "dividing nature at its joints" from Plato. And that this approach leads to a more elegant and internally consistent programming language ("crystallization of style"), rather than a mix of human memory intensive bits and pieces ("agglutination of features")<br /><br />Maybe we would be better off today if philosophy and also the use of metaphor was taught side by side with programming?<br /><br /><message receiver><message><br /><receiver object><message><br /><message receiver><message selector (optional message arguments><br /><br />Messages trigger methods in receiving objects<br /><br />The above is the basic structure of smalltalk semantics. This initially appears easy to follow but for me it became confusing at the level of specific examples<br /><br />100 + 200<br /><br />In this case 100 is a message receiver, + is a message selector (binary type) and 200 is an argument for +<br /><br />Both 100 and 200 are SmallInteger class instances<br /><br />I found two things difficult to understand (counter intuitive) about this example:<br />1) Why was + being called a selector, ie. what was it selecting?<br />2) The 100 and 200 which are similar types of things are behaving in different ways in the example. The 100 is a message receiver and the 200 is an argument to the + message selector<br /><br />This sort of thing frustrates me because in the end I'm reduced to rote learning through not really understanding the underlying meaning of the way in which smalltalk was designed. Now thanks to help from some experts I have an explanation.<br /><br />The metaphors that work here are:<br />An object (which has various properties) receives a message which tweaks one of those properties<br /><br />Or a language metaphor:<br />The subject (which comes first) is directed by the different parts of the rest of the sentence (verbs, etc.)<br /><br />Message selectors (such as +) are called selectors because they select properties from the receiving object. As an object myself, I can visualise and personalise this quite easily. If someone comes to me and delivers a message then the particularity of the message switches on (selects) certain parts of my mind, ie. accesses particular properties of my mind<br /><br />I don't really need to know the details of the SmallInteger class to appreciate this, just that the + message selector will trigger something inside that will enable it to complete the task of adding +200 to 100<br /><br />Another thing that confused me was finding the right metaphor to explain this particular thing. Another smalltalk metaphor is the biological cell, that the contents of the cell are protected or encapsulated and that they respond to messages from outside.<br /><br />This metaphor is great for helping to understand encapsulation and complexity - cells can diversify and combine to create complex organisms. But it didn't help me explain why + was called a message selector. However, the object and language metaphors did help here. So you need to know the right metaphors for the particular task at hand.<br /><br />I'll round this out a bit more by using some other examples, mainly from Stephane Ducasse's book, <span style="font-style: italic;">Squeak: Learn Programming with Robots</span><br /><br />There are 3 types of messages - unary, binary and keyword<br /><br /><span style="font-weight: bold;">Unary:</span> pica east<br />"pica" (robot object) is the message receiver. "east" is the message selector. It's just like someone approach me and says, "turn east" That selects the part of my mind that thinks about directions.<br /><br /><span style="font-weight: bold;">Binary:</span> 100 + 200<br />Already discussed<br /><br /><span style="font-weight: bold;">Keyword:</span> pica go: 100<br />"pica" (robot object) is the message receiver. go: is a keyword message selectors, they accept arguments (100). So the message go: 100 is sent to the robot.<br /><br /><span style="font-weight: bold;">Keyword with multiple arguments:</span><br />pica polygon: numberOfSides size: sizeValue<br />"pica" (robot object) is the message receiver. The method or message selector is the double barreled polygon:size: (counter intuitive initially). The arguments are numberOfSides and sizeValue<br /><br /><span style="font-weight: bold;">Another Keyword with multiple arguments:</span><br />33 between: 30 and: 50<br />33 is the message receiver. The method or message selector is the double barreled between:and: The message arguments are 30 and 50<br /><br /><span style="font-weight: bold;">reference:</span><br />Ducasse, Stephane. <span style="font-style: italic;">Squeak: Learn Programming with Robots</span> (2005) <a href="http://www.amazon.com/Squeak-Programming-Robots-Technology-Action/dp/1590594916">amazon</a>, <a href="http://smallwiki.unibe.ch/botsinc/">bots inc</a><br /><br /><a href="http://www.rbjones.com/rbjpub/philos/classics/leibniz/monad.htm">The Monadology</a> by Gottfried Wilhelm Liebniz<br /><br /><a href="http://www.philosophy.ccsu.edu/adams/Classes/Medieval/Universals.html">The Problem of Universals</a>(philosophical essay)<br />"Plato was clearly a Realist about universals. His most famous metaphor for the reality of universals was to say that real universals "cut nature at its joints" (Phaedrus 265d-266a). He compares the task of definition to the job of being a butcher. The clumsy butcher just hacks things up in any old way, but the expert butcher deftly slices the animal at its natural joints, neatly separating naturally distinct segments of the animal."Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.com1tag:blogger.com,1999:blog-29868932.post-14704308496260935922007-08-22T04:02:00.000+09:302007-08-22T04:18:16.824+09:30Ramon Leon: On SmalltalkAnother great Smalltalk blog. Here are some of the things I found there:<br /><br /><a href="http://onsmalltalk.com/programming/smalltalk/smalltalk-in-action/">Smalltalk in Action</a><br />This provides a link to a video which demonstrates the power of late binding:<br /><blockquote>... some of the features of the refactoring browser on a running instance of the classic Asteroids game. He extracts a method to a component, changes the color of the asteroids, then shows off undo and redo. He does so while the game is running without ever having to break his flow with something as silly as a compile, debug, run cycle that we’ve all grown so accustomed to in most other languages.</blockquote><a href="http://onsmalltalk.com/programming/smalltalk/screencast-how-to-build-a-blog-in-15-minutes-with-seaside/">Building a blog using Seaside</a><br />This links to a screencast of Ramon building a blog in seaside in 15 minutes. Seaside is a web development program which is written in Smalltalk<br /><br /><a href="http://onsmalltalk.com/programming/smalltalk/seaside/my-journey-to-linux/">My Journey to Linux</a><br />The transition from being a Windows guy to a Linux guy. Shit happens.<br /><br /><a href="http://onsmalltalk.com/programming/smalltalk/why-smalltalk/">Why Smalltalk</a><br />"I’m still amazed by how many people think they can grok Smalltalk by seeing syntax examples. Smalltalk isn’t its syntax, it’s its environment. Smalltalk is a living world of running objects, there are no files, no applications, just what’s running. To understand Smalltalk, you have to either actually use it for a while, or have a seasoned Smalltalker demonstrate it to you. Reading sample code just won’t cut it."<br /><br />Ramon's top posts are <a href="http://onsmalltalk.com/top-posts/">here</a>Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.com0tag:blogger.com,1999:blog-29868932.post-87286919311857465332007-07-29T03:50:00.000+09:302007-07-29T04:25:06.431+09:30Squeak: Open Personal Computing and Multimedia<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjepSRuhbAOviNJPNEqdRZlpG6aWHHc9dywbxBeALgt8aSzi8cBGnWj_w2pZGztuLIcHoEi2SE5M-AuCv6ZcJ2nUy-2_gXFlpV1Hvgsygaeec3ke5aPk-yiJDjOkVVy_uaOWa0/s1600-h/small-bluebook-cover.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjepSRuhbAOviNJPNEqdRZlpG6aWHHc9dywbxBeALgt8aSzi8cBGnWj_w2pZGztuLIcHoEi2SE5M-AuCv6ZcJ2nUy-2_gXFlpV1Hvgsygaeec3ke5aPk-yiJDjOkVVy_uaOWa0/s320/small-bluebook-cover.jpg" alt="" id="BLOGGER_PHOTO_ID_5092321739398004290" border="0" /></a><a href="http://www.iam.unibe.ch/%7Educasse/FreeBooks/CollectiveNBlueBook/">draft of Squeak: Open Personal Computing and Multimedia</a><p style="margin-bottom: 0in;"> by Mark Guzdial, Kimberly Rose. Paperback - 544 pages 1st edition (June 15, 2001) Prentice Hall; ISBN: 0130280917</p><br />This post is a summary of the pdfs available from the above site, essentially a free download of an important book:<br /><br />noel.pdf (39 pp)<br /><span style="font-style: italic;">Squeak for Non-Native Speakers</span> by Noel Rappin<br />The goal of this chapter is to provide you with enough information about Squeak to understand the code samples and design principles in the later chapters, and allow you to experiment with it on your own – experimentation is a major part of the Squeak world view<br /><br />steinmetz.pdf (34 pp)<br /><span style="font-style: italic;">Computers and Squeak as Environments for Learning</span> by John Steinmetz<br />To promote more thoughtful discussion about computers and learning, and to provide some background before considering Squeak projects, this chapter will begin with general thoughts about children and computers.<br /><br />Part 1 presents some assumptions and persistent misconceptions about computers and learning.<br /><br />Part 2 presents their most common current use, simulating older media—such as words on paper or musical sound—while offering extra leverage for working in those media.<br /><br />Part 3 considers brand new possibilities offered by computers, with entirely new ways to perceive and understand. Squeakers are developing tools, ideas, and genres to help these new media evolve<br /><br />morphic.final.pdf (38 pp)<br /><span style="font-style: italic;">An Introduction to Morphic: The Squeak User Interface Framework</span> by John Maloney<br />Morphic is a user interface framework that makes it easy and fun to build lively interactive user interfaces. Morphic handles most of the drudgery of display updating, event dispatching, drag and drop, animation, and automatic layout, thus freeing the programmer to focus on design instead of mechanics<br /><br />pierce-final.pdf (24 pp)<br /><span style="font-style: italic;">Alice in a Squeak Wonderland</span> by Jeff Pierce<br />This chapter is an introduction to Squeak Alice, an authoring tool for building interactive 3D worlds in Squeak<br /><br />mathmorphs.pdf (42 pp)<br /><span style="font-style: italic;">MathMorphs: An Environment for Learning and Doing Math</span><br />Luciano Notarfrancesco and Leandro Caniglia<br />What if mathematicians had a place to keep all their living objects? Not a planar place, but a multidimensional one, with an unlimited capacity to hold things inside. A space with colors and movement.<br /><br />andres 2.pdf (40pp)<br /><span style="font-style: italic;">Extending MathMorphs with Function Plotting</span> by Andrés Valloud<br />This chapter describes how to plot mathematical functions in Squeak. It covers and shows the objects involved and how to present the results in Morphic using the MorphicWrappers. It is aimed at Squeakers who desire to develop objects with rich graphic representations<br /><br />formatted-btf-once-more.pdf (12 pp)<br /><span style="font-style: italic;">Back to the Future Once More</span> by Dan Ingalls<br />The purpose of this chapter is to update the paper “Back to the Future – The Story of Squeak, a Practical Smalltalk Written in Itself” (hereinafter simply “BTF”).<br />1. Introduction 2. The Evolution of Squeak 3. The Interpreter 4. The Object Memory 5. Storage Management 6. BitBlt and WarpBlt 7. Smalltalk to C Translation 8. Sound 9. Code Size and Memory Footprint 10. Performance and Optimization 11. The Squeak Community 12. Future Work<br /><br />greenberg.pdf (31 pp)<br /><span style="font-style: italic;">Extending the Squeak Virtual Machine</span> by Andrew C Greenberg<br /><ul><li>Why Extend Squeak?</li><li>Speaking Slang (a subset of Smalltalk)</li><li>The Shape of a Smalltalk Object</li><li>The Anatomy of a Named Primitive</li><li>The Mechanics of Building a Plugin</li></ul>Rowledge-Final.pdf (26 pp)<br /><span style="font-style: italic;">A Tour of the Squeak Object Engine</span> by Tim Rowledge<br />This chapter will explain the design and operation of the Squeak Object Engine. The term Object Engine is a useful phrase that encompasses both the Smalltalk low-level system code (such as the Context and Process classes) and the Virtual Machine. We will discuss what a Virtual Machine (VM) is, how it works, what it does for Squeak programmers and users, and how the Squeak VM might develop in the future.<br /><br />parsia 2.pdf (13 pp)<br /><span style="font-style: italic;">Networking Squeak</span> by Bijan Parsia, Bolot Kerimbaev, Lex Spoon<br />There is a apparent split in the Squeak worldview between the intensely individualistic and the thoroughly social. Squeak itself aspires to be a complete personal computing environment (with the single user in both computational and intellectual control from top to bottom) and a tool for collaborative development, exploration, and experimentation. This conception is akin to the notion of a networked personal computer—neither a thin client dependent on the network and server, nor an isolated workstation, but a node among peers, server, client, and self-sufficient in turn, separable but connected. A Squeaker is not merely autonomous, but autokoenomous<br /><br />porting-subfinal 2.pdf (57 pp)<br /><span style="font-style: italic;">Porting Squeak </span><br />Squeak must be one of the most ubiquitous programming languages to date. In addition to the original version for Mac OS, Squeak has been ported to a wide variety of very di erent platforms: most major avors of Unix, MacOS-X, several variations of Windows and Win/CE, OS/2, several \bare hard-ware" systems, and so on<br /><br />shafer-final.pdf (15 pp)<br /><span style="font-style: italic;">The Future of Squeak</span> by Dan Shafer<br />Friedrich Nietzsche once said, “Our destiny exercises its influence over us even when, as yet, we have not learned its nature; it is our future that lays down the law of our today.”<br /><br />If ever there was a topic to which Nietzsche’s thought could be applied, it is Squeak. We have not yet learned the nature of the destiny of Squeak because it continues to unfold before our very eyes and because we are about the business of creating that destiny. Yet, to an extent not attained by other programming languages and environments, Squeak has always been about the future. Its future has in fact determined many of the ways it works and thinks today.<br /><br />stpope_siren7.pdf (37 pp)<br /><span style="font-style: italic;">Music and Sound Processing in Squeak Using Siren</span> by Stephen Travis Pope<br />The Siren system is a general-purpose music composition and production framework integrated with Squeak Smalltalk (1); it is a Smalltalk class library of about 320 classes (about 5000 methods) for building various music-and sound-related applications<br /><br />xp.pdf (22 pp)<br /><span style="font-style: italic;">Embracing Change with Squeak: Extreme Programming</span> by J. Sarkela, P. McDonough, D. Caster<br />The XP practices embody a set of heuristics for recognizing and adapting to change, for change is the only constant in XP. The XP process values learning as a basic skill for individuals and the team, as the tensions inherent in development stimulate evolutionary growth. In the XP view, setbacks and failures provide essential feedback on which the software development process thrives, where risk is something to be understood and managed, not merely avoided.Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.com1tag:blogger.com,1999:blog-29868932.post-43535346385349093112007-07-22T20:58:00.000+09:302007-07-22T22:15:09.403+09:30the image file, the virtual machine, bytecodes and moreSqueak files are different. As a newbie this was initially confusing for me and a potential barrier for uptake. But now it seems that they are different but better.<br /><br />On the Windows version from Squeakland I have downloaded:<br />SqueakPlugin.image 12.5 MB<br />Squeak.exe 1.05 MB<br /><br />On the Ubuntu linux version on the itshare laptop there is:<br />Squeak3.8.image 17.5 MB<br />SqueakV3.sources 13.9 MB<br />Squeak3.8.changes 13.6 MB<br />(I can't see the squeak-vm file?)<br /><br />On the Ubuntu linux version on my older computer I have:<br />squeak-image_3.8.deb 11.1 MB<br />squeak-sources_3.deb 3.3 MB<br />squeak-vm.deb 0.5 MB<br /><br /><span style="font-weight:bold;">THE IMAGE FILE</span><br /><br />Smalltalk is its own development and runtime environment. Rather than executing programs on top of an underlying operating system layer which maintains file input-output and a file system, Smalltalk runs in an “image”—a single, live “file” that manages its own memory use, reads and writes itself to disk transparently when required, and which permanently maintains the entire state of the environment. It is this ‘live’ and persistent image which allows Smalltalk to be changeable “on the fly”—other languages require that one make changes to source code files and then recompile or re-run the files in order to make a change. (From Maxwell, p. 154)<br /><br /><span style="font-weight:bold;">Another explanation</span>:<br />Most programming systems separate the program code from the program state. Program code is just text and can be stored in a text file. Program state is the exact place (a snapshot) of where the program has got to at a particular point of time. To store program state requires an image, an exact bit by bit description.<br /><br />Smalltalk / Squeak is different from most other programming languages in that it does not separate code from state. It stores the entire application state in an image file.<br /><br />(LISP is another programming language which also uses image based persistence. In the case of LISP the code is a form of data, once again the distinction between the code and the state is blurred)<br /><a href="http://en.wikipedia.org/wiki/Smalltalk#Image-based_persistence">http://en.wikipedia.org/wiki/Smalltalk#Image-based_persistence</a><br /><br /><span style="font-weight:bold;">VIRTUAL MACHINE</span><br /><br />A Virtual Machine is a software layer that provides us with a pretense of having a machine other than the actual hardware in use. Using one allows systems to run as if on hardware designed explicitly for them<br /><a href="http://www.rowledge.org/tim/squeak/OE-Tour.html">http://www.rowledge.org/tim/squeak/OE-Tour.html</a><br /><br />An application is written for a virtual machine and can then operate on any platform or OS. How? The application is run on a computer using an interpreter of JIT (Just in Time) compilation<br /><a href="http://en.wikipedia.org/wiki/Virtual_machine">http://en.wikipedia.org/wiki/Virtual_machine</a><br /><br /><span style="font-weight:bold;">BYTECODES<br /></span><br />The image file consists of bytecodes, which is a highly compressed and optimized representation of the source code, but is not machine code (and therefore not tied to any particular hardware). Just-in-time compilation or JIT, refers to a technique where bytecode is compiled to native machine code at runtime. This technique was pioneered in Smalltalk in the 1980s.<br /><a href="http://en.wikipedia.org/wiki/Interpreter_%28computer_software%29">http://en.wikipedia.org/wiki/Interpreter_%28computer_software%29</a><br /><br /><span style="font-weight:bold;">SOURCES AND CHANGES FILES</span><br />The Squeakland educational version does not include the sources and changes files. But the full Squeak version does include sources and changes. These files are more important for developers.<br /><br /><span style="font-weight:bold;">The Sources file</span>. This is where all the source code for Squeak is stored. However, the system can be operated without any source code, owing to its ability to decompile the bytecode methods into a readable and editable version of the original source code (only comments and temporary variable names are lost).<br /><br /><span style="font-weight:bold;">The Changes file</span>. Everything that you do goes into the changes file as soon as you do it: Every DoIt, every new class, every new method. This means that if you crash Squeak, your work isn't lost. It's probably in the changes file. The changes file is just a text file -- you can copy out anything that you need to recover from. From the Desktop Menu, you also have access to several <br />changes utilities that let you look over your changes file and recover lost things. From the Desktop Menu, select Changes, then recent change log to find see all changes from every quit or save that you’ve executed.<br /><br /><span style="font-weight:bold;">Project files</span>. My Etoys projects save as *.pr files, along with a gif image. Projects are used to capture and switch the entire display state. Therefore they store much of the state.<br /><a href="http://wiki.squeak.org/squeak/1817">http://wiki.squeak.org/squeak/1817</a>Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.com0tag:blogger.com,1999:blog-29868932.post-20805929610028448822007-07-22T14:54:00.000+09:302007-07-22T22:16:52.713+09:30messages are different in SmalltalkI'm having a look a Smalltalk / Squeak programming. It's promoted as object oriented (OOP) in a pure form, so my intuition is that if I can grok Smalltalk then that will deepen my understanding of OOP and how it is really meant to work.<br /><blockquote>Early Smalltalk was the first complete realization of these new points of view as parented by its many predecessors in hardware, language and user interface design. It became the exemplar of the new computing, in part, because we were actually trying for a qualitative shift in belief structures--a new Kuhnian paradigm in the same spirit as the invention of the printing press-and thus took highly extreme positions which almost forced these new styles to be invented<br />- Alan Kay, <a href="http://gagne.homedns.org/%7Etgagne/contrib/EarlyHistoryST.html">The Early History of Smalltalk</a></blockquote><ul><li>Everything is an object. </li><li>All computation is triggered through message sends. You send a message to an object, and something happens.</li><li>Almost all executable Smalltalk expressions are of the form <receiverobject> <message>.</li><li><receiverobject><message>Messages trigger methods where the mapping of message-to-methods is determined by the receiving object. Methods are the units of Smalltalk code.</message></receiverobject><receiverobject><message></message></receiverobject></li><li><receiverobject><message>- Chapter 2. A Tour of Squeak, in: <a href="http://www.iam.unibe.ch/%7Educasse/FreeBooks/GuzdialBookDrafts/">Squeak: Object-Oriented Design with Multimedia Applications by Mark Guzdial</a><br /></message></receiverobject></li></ul>Understanding messages is crucial:<br /><blockquote>Kay has repeatedly expressed his regret that he chose the term “object-oriented” instead of the more relational concept of “message-oriented.” What is important about biological cells in Kay’s systems theory rendering of them isn’t what they’re made of, but rather their modes of interacting.<br />- <a href="http://thinkubator.ccsp.sfu.ca/Dynabook/dissertation">Tracing the Dynabook</a> by John Maxwell, p. 121</blockquote>Examples:<br /><br />This first one is from Stephane Ducasse's book on <a href="http://smallwiki.unibe.ch/botsinc/">learning squeak through programming robots</a> and the others are from Mark Guzdial's book cited above. Comments are in "quotes".<br /><br /><span style="font-weight:bold;">| pica |</span> "local variable declared"<br /><span style="font-weight:bold;">pica := Bot new.</span> "The new message is sent to the Bot class to create a new robot and associate with it the name pica (:= is for assignment)"<br /><span style="font-weight:bold;">pica go: 100</span> "the colon (:) after go means that an argument is required. go: 100 is a message send to the robot object pica, which can also be described as the message receiver"<br /><br /><span style="font-weight:bold;">1 to: 10 do: [instruction block]</span><br /><br />1 to: 10 do: [] is a message send to the object 1! The message to: do: is a message understood by the Integer class! 10 and the block of code (statements contained in square brackets) following do: are actually arguments in the message.<br /><br /><span style="font-weight:bold;">1 to: 10 do: [:i | Transcript show:(i printString), ' times'; cr]</span><br /><br />do: evaluates the block, :i defines the index variable for the loop, the vertical bar separates the definition from the rest of the statement, printString sends a message to i, the Transcript is a separate window, the comma (,) means concatenate, the semi-colon is used to string statements together and cr stands for carriage return. The output to the Transcript window is: <br />1 times<br />2 times<br />3 times<br />4 times<br />5 times<br />6 times<br />7 times<br />8 times<br />9 times<br />10 times<br /><br /><span style="font-weight:bold;">anArray := Array new: 10.</span> "create a new array with 10 places"<br />#(nil nil nil nil nil nil nil nil nil nil)<br /><br /><span style="font-weight:bold;">| aValue |</span> "declare a variable"<br /><span style="font-weight:bold;">aValue := 2.</span><br /><span style="font-style:italic;">Everything is an object</span>. This rule does not actually mean "Set the value of 'aValue' to integer 2" but instead means "Set the variable aValue to point to an SmallInteger object whose value is 2."<br /><br /><span style="font-weight:bold;">1 to: 10 do: [:index | anArray at: index put: aValue*index ].</span><br /><br /><span style="font-weight:bold;">Transcript show: anArray<br /></span><br />Output to Transcript window:<br />#(2 4 6 8 10 12 14 16 18 20)<br /><br />This has given me some understanding of how messages are both important and different in Smalltalk.Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.com2tag:blogger.com,1999:blog-29868932.post-11620548457973967932006-12-15T00:27:00.000+10:302006-12-15T00:55:17.828+10:30design for the creative spirit<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh_jARwuj7Fon3nhrAdEvo66KNdO3aEX9y8Dn2_vlAWR07NAqiNz8b8CeBCD6A0rlNjIUKtTqsWy8eyraeSY9trnGDGELuHqZgFbX67803pRKWZxD9a7h7RfAo47CEA61bmqQ/s1600-h/king1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh_jARwuj7Fon3nhrAdEvo66KNdO3aEX9y8Dn2_vlAWR07NAqiNz8b8CeBCD6A0rlNjIUKtTqsWy8eyraeSY9trnGDGELuHqZgFbX67803pRKWZxD9a7h7RfAo47CEA61bmqQ/s320/king1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5008388259042520082" /></a><blockquote> <span style="font-weight:bold;">Personal Mastery</span>: <span style="font-style:italic;">If a system is to serve the creative spirit, it must be entirely comprehensible to a single individual.</span><br /><br />The point here is that the human potential manifests itself in individuals. To realize this potential, we must provide a medium that can be mastered by a single individual. Any barrier that exists between the user and some part of the system will eventually be a barrier to creative expression. Any part of the system that cannot be changed or that is not sufficiently general is a likely source of impediment. If one part of the system works differently from all the rest, that part will require additional effort to control. Such an added burden may detract from the final result and will inhibit future endeavors in that area. We can thus infer a general principle of design:<br /><br /> <span style="font-weight:bold;">Good Design</span>: <span style="font-style:italic;">A system should be built with a minimum set of unchangeable parts; those parts should be as general as possible; and all parts of the system should be held in a uniform framework. </span><br />- <a href="http://users.ipa.net/~dwighth/smalltalk/byte_aug81/design_principles_behind_smalltalk.html">Design Principles Behind Smalltalk</a> by Daniel Ingalls</blockquote>A enormous amount of time is spent learning a new upgrade, learning the user interface (which can vary between different apps and systems), agonising about whether to use Windows or Linux (is it worth the time to learn a new OS when you are locked in at work), should I use proprietary or standard data formats? (send a *.doc attachment or an *.odt attachment?)<br /><br />Smalltalk seems to be an attempt to do everything within the one program, for example, in the discussion about <a href="http://users.ipa.net/~dwighth/smalltalk/byte_aug81/design_principles_behind_smalltalk.html">user interface</a>:<blockquote><span style="font-style:italic;">Operating System: An operating system is a collection of things that don't fit into a language. There shouldn't be one.</span></blockquote>Is this a good idea or grandiose? Or both? It would be nice to have less mess.Bill Kerrhttp://www.blogger.com/profile/00206808014093631762noreply@blogger.com0