Thursday, January 15, 2009

New Paradigms in programming.

In programming, I think we need more than just a new input method, there needs to be a new metaphore to go with it. It's a three teired thing. Model-Metaphore-Interface.

I've been thinking more and more lately that language is a poor metaphore for representing a computation. Language is something we use for communication. You could look at a program as a communication to a computer, and simultaneously a communication to other programmers. But there are other ways to communicate other than just the written word. I'm working on a list here, let me know if I'm missing anything.

Methods of Communication *Speech *Body Language *Gestures *Facial Expressions *Sign Language *Painting/Drawing *dials, buttons, sliders, pointing, dragging (gui)

Another metaphore for programming is building. Here's some possible ways of building functional things, that could form the basis for a programming interface

Methods of building functional things *Gears/springs and other mechanics *paper folding/cutting/gluing *patch cords *electronic circuits *hinges, ball bearings, wheels *fountains valves and pipes *Archimedes machines: pulleys, levers, screws *Lego

Yet another way of specifying a computation is by definition.

Methods of Definition *Constraints *Categorization *Set Theory *Properties *Symptoms *Logic tables *Rules *Railroads

But keep in mind why we're doing this. There's obviously some weaknesses in the way programming languages work now, (otherwise we wouldn't want to make new languages) so let's keep them in mind while we're designing our new languages

problems with current languages The interface is hidden

the apis are hidden

Side effects are a huge cause of bugs- Any part of a program can effect any other part.

Refactoring- Sometimes you find that you're repeating yourself, so you need an easy way to factor out the repetition into a macro, or a function, or some other metaphore. This is largely done by hand (or semiautomatically in java) by a massive text manipulation effort. Is there a new metaphore that would make such a thing look utterly silly?

You need an easy way to define your own building blocks, or "words" or idioms, to use to build more complex structures. Your own tools, your own parts of the environment. A lot of languages don't let you do this in a first class way.

compilers punish the programmer severely for the slightest mistake.

Variables lack a sense of time- There's no way to query the history of all the values a variable has been set to in the past. In other words, can we have a programming language where we can "rewind" the progress of our program? The fact that a variable can change, frequently to unexpected values is another source of bugs. This is the other half of the side effects problem

most programming languages have a fairly steep learning curve

Making reference to library or widget X throughout your code largely marries you to that library- Making it difficult to switch to a similar equivelent library without a lot of refactoring. This is largely to do with the fact that libraries have names, and in order to use a library, we're hardcoding the name of that library and its methods throughout our code. Is there a better way?

Poor parrallelism, multithreading leads to bugs, race conditions, deadlocks. Is there a better approach to parallelism that makes such bugs impossible?

Think beyond the computer screen people. Maybe the keyboard is the most efficient interface for entering in complex relationships and symbols. Are you sure? There are more alternatives than just a mouse, or a touch screen, or a tablet. Zillions of ways of interacting with a computer- We have just all settled on one or two rather ordinary ways.

Sunday, January 11, 2009

Of computers, calculators and interfaces

-4 vote down check

There is some controversy over my downvoting in this question. I will explain my reasoning by quoting Jef Raskin, the late usability expert, and originator of the macintosh project at apple.

Calculator or Computer? It's true, Many of us keep a calculator beside our computers. Why do you need this simple-minded device when you have a whole computer in front of you? You need it because you have to go through contortions worthy of a circus sideshow in order to do simple arthmetic with the computer. There you are, tapping away at your word processsor, when you want to do a division: 375 packages of Phumoxx cost $248.93; what is the price for one package? On my computer, I have to open up a calculator window. To do this, I move my hand from the keyboard to the mouse, which I use to do a click-and-drag to open the calculator. Transferring my hands back to the keyboard, I type in the numbers I need or tediously cut and paste them from my document. Then I have to press a few more keys and finally copy the results from the calculator window into my document. Sometimes, the calculator window opens right on top of the very numbers I need, just to add insult to injury. In that case, I must use the mouse to move the calculator window out of the way before proceeding. It is much faster to grab the pocket calculator.


do not think just because you are a programmer you are immune to usability issues. Using a software calculator can be a significant drain on your time, and when you're a professional software developer, time is some serious money, yo.

Jef Raskin went on to propose a solution for a better software calculator. I did not downvote those that I thought were similar enough to Raskin's solution, such as using spotlight. If you're using Textmate, textmate has a feature which is almost EXACTLY the solution that Raskin proposed, that is, you highlight a text which represents a mathematical operation, and you press the "calculate" key on the keyboard. Since most keyboards sadly lack a "calculate" key, in textmate you use control+shift+c instead. All text editors should have this feature. it is sad if they don't.

Also, his son aza made a program called enso. If you have enso installed, you can highlight a calculation, (anywhere in windows), hold down the capslock key and type "calc", and it will perform the calculation, replacing the selected text with the result.

the quote continues

Using an experienced computer and calculator operator as my test subject, with his word processing program open before him, I measured the total time it took for him to pick up a calculator, turn it on, do a simple addition, and return his hands to the keyboard to resume typing. It took about 7 seconds. I then measured the time it took for him to use the built-in calculator. He had to move the cursor to the menu bar at the top of the screen, find the calculator program, open the calculator, enter the sum, and then click back in the word processor so that he could resume typing. This took about 16 seconds.



Comments:

I could say the same thing for an actual calculator. I have to take my hand off the keyboard/mouse, find it, get it out, remove it's cover, turn it on, etc. It is a non argument. Also, that isn't how I open or use the windows calculator. My hand never touches the mouse. – Simucal (Jan 7 at 4:10)

In Vista: Windows Key-"calc", enter. Proceed to enter your calculations using the numpad, never removing my hand from the keyboard. – Simucal (Jan 7 at 4:11)

It's a non argument if you only decided ahead of time that the quote is wrong, and thus only bothered to read until you thought you had enough material to attempt to discredit it. It's a much better argument if you read the whole thing and actually spend a minute or two thinking about it. – Breton (Jan 7 at 4:18) [remove this comment]
But this is my own fault for pissing you guys off before I posted the quote. Read it on its own merits, not because you think I'm an asshole. – Breton (Jan 7 at 4:19) [remove this comment]

@Breton, I read your whole post. What you fail to realize is Jef Raskin's solution is a solution to a problem that doesn't exist. Launching a calculator from the keyboard is so stupidly simple that is a non-issue. Ensu style highlight/calculating is nice but I don't see it as a killer feature – Simucal (Jan 7 at 5:24)

You're focusing on the launching, and ignoring all the other issues that jef raskin brings up, such as windows obstructing your view, application switching, and the manual task of copying and pasting the result, which is actually more significant than just typing in the result from a visible display – Breton (Jan 7 at 5:41) [remove this comment]

This ignorance is what has led me to believe that you didn't, and you still haven't properly read the whole thing. – Breton (Jan 7 at 5:42) [remove this comment]

can you remember the hotkey combination for your calculator, and then press it? Can you do that faster than you can pick up an object off your desk? Are you sure? perception is a tricky thing when it comes to keyboard shortcuts. Try it with a friend and a stop watch. – Breton (Jan 7 at 5:47) [remove this comment]

+1 for a thought out responses that I think is wrong. I can't think of anything that a hand held calculator can provide that a software one can't. Also I just did the test as described at the end: 3 sec using the windows calculator. – BCS (Jan 7 at 7:21)

Re the other issues: alt-tab or enough screen space gets you past the calc over the data issue. -- All else aside the OP asked for a *programmers* calculator, anything that isn't simple math (a.k.a. anything that would be special to programming) I wouldn't use a calculator (either kind) for anyway. – BCS (Jan 7 at 7:27)

@BCS software can do anything. I can't think of anything a hardware calculator can do that a software one can't, aside from be a physical object (has advantages). But it depends on the calculator. As I said before, I didn't vote down software solutions that I thought were decent enough. YMMV. – Breton (Jan 7 at 7:49) [remove this comment]

And worse comes to worse, we're programmers. If we needed something specific out of a software calculator, surely we'd make our own? – Breton (Jan 7 at 7:49) [remove this comment]

You downvoted a whole slew of people because you were convinced by some theoretical article that there is only ONE TRUE WAY? And now you're surprised that people don't like you? Oh, and btw, that ONE TRUE WAY isn't in my environment so...what? I'm out of luck? You must be very popular at parties... – mdbritt (Jan 7 at 16:51)

I wouldn't count an article based on a set of facts and measurements as theoretical. Make your own conclusion from the premise, but you can't make your own premise. I'm not surprised that people downvoted me. people don't like to be criticised. I'm not particularly popular at parties. I don't mind. – Breton (Jan 7 at 21:43) [remove this comment]

@Breton: I'm not one to criticize the late Raskin unless necessary, but understand WHEN this piece was written, vs. today's world. Many modern programmers have the ability to launch their calculator quickly, have it not obscure the text beneath, and be done. (ctd next comment) – John Rudy (2 days ago)

I can do all of that on Vista way more quickly than I can even FIND my real desk calculator. :) Yes, the OP did want a physical calculator -- his choice -- but that doesn't make sense to most others here, and those opinions are perfectly valid. (As is yours; many of us simply disagree with it.) – John Rudy (2 days ago)

It was written in 1999-2000. Computer interfaces have not changed significantly since then (aside from the introduction of OS X). Quite a lot of people still have calculators next to their computers. all the commenters seem deaf to the phrase "I didn't vote down all the software solutions". Oh well. – Breton (yesterday) [remove this comment]

@Breton: I read that part, but understand even the difference between 10 years ago and now. Modern large screens and massive display real estate is a major change for most of us. In 1999, I felt lucky to have 1024x768 -- at work now I have 2560x1024 on two monitors ... No obscuring via soft calc. – John Rudy (yesterday)

And I keep one on my desk, too. But I can get to the software one WAY faster. What I'd LIKE is a good programmer-oriented sidebar gadget calculator -- completely solves all the issues Raskin mentioned by being always visible. – John Rudy (yesterday)

Most of us actually don't have high res screens like you. But even if we do, I think it's a mistake to count more resolution as "more real estate" without taking into account physical dimensions. more space doesn't solve the problems. May be matter of taste, but if you're used to tasting shit... – Breton (yesterday) [remove this comment]

The point is that "More screen realestate" is just a bandaid. The problem is with the concept of an application window. I could go into more detail, or you could just read the book. – Breton (yesterday) [remove this comment]

The concept of the application window? Now I'm curious for the more detail. If you have something like a Vista Gadget -- always visible -- it obscures nothing, and all that is required is a focus switch. Using a handheld calculator is fundamentally the same -- move hand, switch focus, go back. – John Rudy (11 hours ago)

(And why is screen real estate a band-aid? I get it if you're at 1280x768 at 13" -- as I am on the MacBook I'm typing this on -- but in the Windows world, it seems like 96dpi is moderately standard. Yes, I'm cross-platform.) – John Rudy (11 hours ago)

There's a big difference between switching "focus" on a computer, and switching your mind's focus onto a different object. One requires the operation of a mouse/keyboard, and the other doesn't. in raskin's THE the app window is applauded as a huge step forward, but fundamentally unable to support... – Breton (2 hours ago) [remove this comment]

The number of simultaneous tasks, and the complexity of those tasks that we have nowadays. The problem with app windows is that they represent a modal interface. windows cause the meaning of specific gestures to change arbitrarily. This is harmful to habit forming. It's also the reason vi is so hard – Breton (2 hours ago) [remove this comment]

Switching focus from the computer to a calculator is a natural kind gesture that we're evolved to do. Gestures against the calculator always lead to the same result. We can form habits around the operation of the calculator. Using a software calculator means that we're pressing a set of keys to ... – Breton (2 hours ago) [remove this comment]

changes the meaning of another set of keys, then making our calculation, then using a third set of keys to change the meaning of the second set of keys back. We can't form habits around that second set of keys, because gestures against them don't always mean the same thing. – Breton (2 hours ago) [remove this comment]

While habits are possible to form under such conditions, it's difficult because our expectations are often violated. The situation is worsened by the fact that the first set of keys and the third set of keys probably also change their meaning quite frequently. – Breton (2 hours ago) [remove this comment]

For this reason you really want your calculator built into whatever ide/texteditor etc that you're using, if you're going to go with a software solution. This reduces the number of mode changes you have to make in order to do a calculation. Gestures retain their meaning. – Breton (2 hours ago) [remove this comment]

I'll throw in one more thing. Modes also have the problem of communicating to the user which mode they are in, and when you have switched modes. This communication usually fails because the user is focused on the task at hand, and not on the mode indicator. – Breton (2 hours ago) [remove this comment]

In raskin's solution, the number keys retain their meaning- That is, they cause a set of numbers/operators to appear in sequence in your text document. Highlighting some text and pressing the "Calculate" key is a single gesture which always retains its meaning. No modes. – Breton (an hour ago) [remove this comment]

raskin's THE also has a chapter on what he thinks is wrong with modern programming environments, and how to fix it. If you're a programmer, it's well worth the read just for that chapter. – Breton (an hour ago)

Thursday, December 11, 2008

Why did I write the web school awesome articles?

I was doing courses for graphic design, and doing fairly well, I suppose. I originally went into graphic design in the year 2000. While I had a talent with computers, I wanted to avoid all that cross browser crap and just make pretty printed things. Paper doesn't have cross browser issues! So I spent 6 years learning how to do that. But the thing is, there's no escaping one's natural talents and obsessions it seems.

I accidentally got really good at making web pages. I didn't really want to, it just happened. I got way better at it than my peers in the graphic design courses. I ended up with a reputation. I found one of my typography professors taking a "web design" course that I'd taken in a previous semester. While that was amusing, it didn't last long. He commissioned my services to teach him the craft, and so I did what I could.

A couple years later me and all my graphic design friends ended up in a different university together. That was weird, especially since it was full of zombies. And a couple unicorns. Seriously. Then they all decided to take a web design course at this university. I later found out that what the university meant by "web design" was "make a flash movie and hastily slap it in the middle of an html table, then maybe publish it online if you can figure that shit out".

So I got a bug up my ass about that. I couldn't help it. That sort of thing just bothers me. It really shouldn't bother me since I'm just trying to be a graphic designer and make pretty printed things. But the idea of all my friends putting these opaque unfriendly singy dancy binary blobs on the internet really stuck in my craw. And I think someone else was having trouble with web things or something and heard that I was good at it, I don't know. One thing lead to another, and I wrote the webschool awesome articles. I combined it with one-on-one tutoring. It all fell off a bit as I never got to lesson 3 (which would have included some css), but oh well. Then I imploded and moved to australia.

Skip forward a couple years and my teenage nephew is having some kind of identity crisis (happens to all of us). I offer to teach him some web things, and he thinks it's a good idea. So I dusted off WSA and posted it to my blog for his benefit. I meant to get to lesson 3 some months back, but as you can see from this blog.. I'm full of ideas, and not enough experience/wisdom/ability to get them all done and real.

Sunday, August 3, 2008

Web School Awesome: Lesson 2

Web School Awesome: Phoenix Edition

Hey kiddies, here's another round of punishment from your good friend, Breton "Insano Smartypants" Slivka. I'm gonna lay it all out for yah.

In excercise 1, I showed you how to create a basic html file, and open it in a browser to see the results. I showed you 5 types of html tag. In this lesson, the goal is to fully mark up a page of text. I will show you how to create:


  • Subheadings

  • paragraphs

  • lists

  • hyperlinks

  • anchor links

  • images

  • special characters.

  • bolding and italicizing text.



In order to accomplish that, I've got a starting point- a page about a band called the nips. I'm providing two files, one called thenips1.html and another called thenips2.html. This goal of this lesson is to step by step, modify thenips1.html until it's just like thenips2.html, and all along the way, observe the effects that our changes have on the way our page looks in the browser.

The first step is to properly set up a workspace.

  1. in your web school awesome folder, create a new folder named "Lesson 1"

  2. Linked from this blog post are a number of files. You're going to need them all. Save them in a convenient folder.

  3. Print out "lesson2.txt" so you can follow along. The lesson continues in that file.

  4. Arrange your text editor to occupy one half of your screen, and your favorite web browser to occupy the other half.

  5. Follow the instructions in the previous lesson for saving out an html file, and for opening in a browser.

  6. When you make a change in the original file, simply SAVE the change, and press the refresh button in your browser to see the results



the files:

Lesson2.txt
nipsy2.jpg
thenips1.html
thenips2.html

Web School Awesome

Webschool Awesome Lesson 1.
REMOTE E-LEARNING EDITION

HTML 101
________

Okay guys, this is where your uncorrupted and untouched knowledge of html will come in handy. Too many lessons and teachers will teach you how to go making pages the wrong way. Since nobody has done that to you yet, I can teach you the right way, and you don't have to unlearn a bunch of bullshit.  (if I haven't told you by now what I mean by "the right way" and "the wrong way" you can go ahead and ask me.)

How Web School Awesome works is I tell you how to do something, and then I tell you what  happened. This way by the time I start talking theory, you have already experienced the practice, and thus know what I'm talking about already.



Exercise 1: your first web page.
This one is EASY, has only 5 steps, and it will take you 10 minutes, tops.


Tools needed:
a computer (mac or pc will be fine)
A web browser. (I prefer firefox or safari, but any one will do for this lesson)
A text editor.  on the PC, use notepad. On a mac, use textedit.


STEP 1.
Make a new folder called WSA  (it stands for Web School Awesome)

STEP 2.
open up your text editor of choice.

STEP 3.
In your new document, type in the following text: (don't copy and paste!)

<html>
  <head>
    <title>Web School Awesome Rocks!</title>
</head>
<body>
<h1>Web School Awesome</h1>
this is my first web page ever. SWEET!
</body>
</html>

STEP 4.
Save as plain text, with HTML as the file extension.
It is important to know how to save as PLAIN unformatted text.   So pay attention to this bit.


How to do this on a MAC with TextEdit:
Click the "Format" menu and select "Make Plain Text"
Click the "File" menu and select "save"
navigate to the WSA folder.
next to "Save As" type skeleton.html as the filename
in the "Plain Text Encoding" pull down menu, select "Unicode (UTF-8)'
click "save"
a pop up dialogue will ask you whether you really want to use .html as the extension. Click "Use .html"

How to do this on a PC with Notepad
click the "File" menu and select "save"
Navigate to the WSA folder
next to "File Name:" type "skeleton.html"
in the pull down menu "save as type" select "all files"
in the pull down menu "text encoding" select "utf-8"
click "save"


STEP 5.
open the results in a web browser. You can do this by using file>open on most web browsers, or simply drag the skeleton.html file's icon directly into your browser's window.

What you should see is "Web School Awesome Rocks!" in the TITLE bar of the browser.
"Web School Awesome" in large type at the top of the page.
and "this is my first page ever. SWEET!" in small text at the bottom.

WHAT HAPPENED?

Let's look at the content of our file again.

<html>
  <head>
    <title>Web School Awesome Rocks!</title>
</head>
<body>
<h1>Web School Awesome</h1>
this is my first web page ever. SWEET!
</body>
</html>


note that in the file where it says "Web School Awesome Rocks!", to the left there is "<title>" and to the right of it, there is "</title>".   These two html tags tell the web browser to put the text between them, into the browser's title bar!  <title> is an opening tag, and </title> is a closing tag (because of the forward slash). All together  <title>Web School Awesome Rocks!</title>  is an "element".

There's 5 elements in skeleton.html.  They are all nested inside eachother, like a box full of boxes. Also like boxes, there are different kinds, and the different kinds hold different sorts of things.

the first is <html> ....      </html>, and it's the biggest box, and it contains all the other boxes. Always.
the next sort of box is <head> .... </head> Inside this box you put information about the web page, like its title.
then in <title>.... </title> (which goes inside <head>) well, for the third time already! you put its TITLE!
<body>...</body> goes outside of <head>, but is still inside <html>. Inside <body> you put everything you want to show up inside the actual browser window.

and finally, <h1>...</h1> is a box 
for headers! That's why the text inside of it is rendered really large by the browser. That large serif font is the default style for text inside <h1> tags.  When I teach you CSS, you'll be able to change how <h1> tags are rendered to whatever font, size, or color you want! You'll even be able to replace it with an image.

note: <h1> is just for first level headers. There is also <h2>, <h3>, <h4>, <h5> and <h6>, for progressive levels of sub-headers.

IN SUMMARY:


<html>  contains the whole document
<head> contains information about the document
<title> contains the title of the document
<body> contains the content of the document
<h1> through <h6> contain different levels of headers for the document.

There are many more different kinds of "boxes" "tags" "elements" or whatever other euphamism I've used to refer to them. I will cover more in excercise 2.

Until then, Be seeing you....

Thursday, March 27, 2008

Relational Model; Ur doin it wrong.

Databases: did you know that if you follow the convention of naming columns that represent the same things, with the same name (for instance, part id's named Part_Id in all tables), then you can use the SQL keyword "NATURAL JOIN" to join two tables, without having to add a bunch of "where partid=id" style clauses to your query?

Before, ( in psuedo SQL): SELECT PARTS.ID, PARTS.NAME, PRODUCTS.NAME FROM PARTS JOIN PRODUCTS WHERE PARTS.ID = PRODUCTS.PARTID


After: SELECT PARTS.PARTID, PARTS.PARTNAME, PRODUCTS.PRODUCTNAME FROM PARTS NATURAL JOIN PRODUCTS

Let me put this a different way: If you're following a poor naming convention, you're making your SQL queries longer and more difficult than they need to be!

Well, suppose we assume that everyone follows the "Same thing=same name" convention. Then SQL could potentially assume that you mean NATURAL JOIN by default when you say "JOIN".

SELECT PARTS.PARTID, PARTS.PARTNAME, PRODUCTS.PRODUCTNAME FROM PARTS JOIN PRODUCTS

Well, now that we have that assumption, I can't think of a situation where you would need to mention more than one table in a query, if you weren't joining them. (can you?). So let's assume that whenever a query contains the names of more than two tables, you mean to join them. It'll join on likenamed columns automatically, and you've just saved yourself a whole lot of trouble.

SELECT PARTS.PARTID, PARTS.PARTNAME, PRODUCTS.PRODUCTNAME FROM PARTS, PRODUCTS

in fact, why do we need to mention the table names twice? Once in the select clause, and again in the from clause. We already know which tables these fields are from!

SELECT PARTS.PARTID, PARTS.PARTNAME, PRODUCTS.PRODUCTNAME

We also know that the PRODUCTNAME field can only be found on the products table, and that the PARTNAME field can only be found in the PARTS table, and that the column that they both have in common is the PARTID column, so that's where we can join. So simply by examining the schema, we can get most of this information ourselves. So ultimately all the database really needs from the user to perform this query is

SELECT PARTNAME, PRODUCTNAME

But aren't most queries going to be a select? We can optimise this even further by assuming that the user means select unless they say otherwise. Just don't name any of your columns "INSERT" ;)

PARTNAME, PRODUCTNAME

Wow. So my thinking is that SQL is asking way more from the user than it really needs to perform a query- As long as the schema follows a very common convention which is best practice anyway.

We went from this:

SELECT PARTS.ID, PARTS.NAME, PRODUCTS.NAME FROM PARTS JOIN PRODUCTS WHERE PARTS.ID = PRODUCTS.PARTID

and through our optimisations went to this:
PARTNAME, PRODUCTNAME


Admittedly, there's a lot of little gotchas which I haven't covered in this blog post, but none of them are insurmountable, and surmounting them is well worth the time and effort saved by from typing all those big confusing SQL queries! Also, I have only covered the most basic of queries. There are ways to optimise the more complex queries as well.

In conclusion, SQL sucks, and we need something new, and something better designed.

Saturday, March 22, 2008

Live Robot Walking; Another AI thought.

Lots of people have tried and failed to make robots walk upright on two legs. Those that have succeeded, made a robot that walks stiffly, and rather unnaturally. What makes me think that I can do better? I have no idea. In fact, no, I can't. But at the same time, I can't help but have ideas about how I would tackle the problem.

Because while it's apparently difficult to make a physical robot walk, I have seen a number of computer physics simulations where a simulated spring based robot seems to have no problem walking. It's possible, even if the simulations cheat to make it happen.

This is how humans walk though, in a sense. We have in our minds a physics simulation, with a simulated image of ourselves within it. Before we're able to walk as children, we simulate countless times the image of ourselves walking. We attempt to walk, and compare the results to our physics simulation, and adjust our image of physics to closer match reality. In fact, we may even adjust our image of ourselves, and the weight, length and size of our limbs to try and match the results that our senses have delivered to us.

I think to make a robot walk it needs a few things: the program controlling it needs a simulation of the robot's body configuration, and its environment. The robot needs some sensors, such as an accelerometer, to deliver to the program its physical orientation, and the configuration of its limbs. An attempt at walking must be made, perhaps random at first, and the results of an attempt must be compared to the results of the same attempt in the simulation, and in particular the simulations simulated sensors.

Then the physical simulation can be adjusted such that the simulated sensors match the results of the real sensors. Then multiple simulated attempts at walking take place, until something resembling a successful walk is achieved. It is then attempted in the real robot, the results are recorded and fed back into the simulation. One might use a number of different methods for getting the physics simulations to match the results of the real robot: Genetic, Neural network, etc. But the fact is, the more data one can get about the results of the real physics, the closer one can get the simulated physics- AT least, for this one domain: Walking.

I don't know how many iterations of practice, and real attempts it would take to make a robot walk. But research has shown that this process of repeatedly imagining ourselves doing a task, does considerably speed the time it takes for a human to aquire this task. So it stands to reason, that simulating this process in an AI, for a robot may have the same effect.