Natural Language Programming

June 21st, 2006


Programming games is an activity. A programming language is a kind of thing. Inform 7 is a kind of programming language. It is either the single-most important advance in interactive fiction in a decade, or an interesting idea doomed to fail.

– Liza Daly, Inside Inform 7

The above is source code. It is a dsl, kind of, but it’s a particular kind of dsl that is trying to look and feel like natural language. It is completely readable by a non-programmer, and I dare say it’s writeable by one too. It is Inform 7 , one of the coolest things I have seen in a while. (see Beyond Domain Specific Languages )

Put this together with the simple little DSLs that google is doing or the internal natural language-ish DSLs that my colleague Jay Fields has been working on in ruby, and I think we are beginning to see people approach programming in a new way.

This is definitely stuff that we’ll talk about in our upcoming DSLs in Ruby book. But more importantly, it might be stuff that I use on my next project!
——
Above and beyond the language, there is also a sweet IDE for Inform 7. We’ll be looking at what we can learn from it here at Intentional. You should too.

It has a simple UI, is targeted toward non programmers, and is very polished and well thought out. Good stuff.

The Path to Unconscious Competence

June 5th, 2006

Last month I was talking to Pat Gremo, a fellow ThoughtWorker, about stages of learning. He learned this learning model from karate. Two weeks ago, I found myself repeating it to a room full of Swing Dance teachers who were extremely interested in it. I really enjoy pulling and applying this type of omnirelevant stuff from and to disciplines as ostensibly distinct and separate as martial arts, software development, or dance.
——

Stage 1 – Unconscious Incompetence

At this stage, the student does not know what they don’t know. They either have no interest in improving the skill, or they don’t even know there is room for improvement.

When I first played with a typewriter, I was blissfully unaware that I didn’t know how to type – I was a little kid. I think I eventually taught myself how to type with my index finger.

Stage 2 – Conscious Incompetence

At this stage, the student understands where they are, they can see the difference between their level of competency and that of someone who has mastered the skill.

I soon became aware that my parents and teachers could type much faster than me. It was annoying, but I didn’t really know what I could do about it…they somehow used all of their fingers.

Stage 3 – Conscious Competence

At this stage, the student has learned the skill enough that they can do it while thinking about it. However, it often requires a great deal of concentration.

After a few weeks of playing with a typing program in the school computer literacy class, I could touch type. I could actually go pretty fast, especially compared to me before. However, in order to type anything, I had to have the complete thought, then hold each word in my mind as my fingers struggled for the keys. The process was very serial, and it led to errors, because I’d often lose my place in my thought while I was thinking about typing.

Stage 4 – Unconscious Competence

At this stage, the student no longer has to think about the skill while performing it. It is at this stage when the skill becomes second nature and a reflex. This is very distinct from the previous stage, and at this stage you can add more things on top of what has been learned.

After many more weeks and eventually years of typing, I started getting to the stage where I didn’t have to think about typing at all. In fact I now don’t have to think about each character at. I just think each word, and sometimes I don’t even have to do that. I can be thinking of the next thing I’m going to write while making a correction on the previous line. The speed of my typing is obviously much faster than it used to be – and also the quality of what I type is better.

see also Four Stages of Competence
——
h2. Other Learning Models

There are many different learning models, it’s often helpful to cycle through several to find one that might be more applicable or helpful when you are either teaching or learning.

At the swing dance teaching workshop that I took last week, we talked a lot about identifying how your students learn. Are they visual, auditory, kinesthetic learners? Do they approach problems from a global or linear fashion? Can you teach something hitting all of these at the same time? Or can you customize your teaching style for your student?

Another of my favorites for a long time now is the one Alistair Cockburn talks about in Agile Software Development. He basically separates learning into 3 stages, following, detaching, and fluent – but that’s another blog post ;)

I live for this stuff. After all, I am primarily a teacher, whatever my business card says.

Self Hosting Sucks

May 16th, 2006

At least when I do it…

Every since my hard drive died on my server and my site went down, I’ve been looking for alternatives to self hosting. Fact is, I’ve learned everything I set out to learn from running my own server and it’s a pain in the ass. This blog for example is now hosted on TextDrive – and I’m totally happy with their service.

However, I still had to find some place to put all my pictures. If y’all remember my “Shimmer” project, I had them all accessible from the web through my own self hosted portal. I really liked that. I had been thinking about Flickr and ShutterFly, and even using Amazon’s S3 through my own custom frontend.

I think for now I’m going to go with Flickr. Why?

h3.Good

  • Great UI - as of today, some of the best AJAX stuff I’ve seen anywhere
  • $24 / year
  • unlimited storage
  • even if you default on your account they don’t delete anything

h3.Bad

  • They won’t store video – I store video that my camera takes along with my pictures

So even though they don’t have video, I think I want to go with them for photos. I’m gonna have to keep looking for a solution for my videos.

Here’s a link

ThoughtWorks US Away Day 2006

February 22nd, 2006

Good Lord.

What a weekend.

So just a couple weeks ago, I had an empty plate. I was looking for projects and things to fill my time.

Well, I found some.

ThoughtWorks had its away day this past weekend in Chicago and it was quite possibly the most inspiring weekend (work wise at least) I’ve ever had.

I’m sitting here at the airport in a daze, exhausted and excited. On my ‘plate’? you will now see :

  • A book on DSLs – Joe O’Brien and I are going to be pairing on a book. My first. We’re still nailing down exactly what it’s going to be about, but this is pretty damn exciting. I’m going to be an author
  • Chizzle Reborn – Jon Tirsen and I are going to take another crack at writing an open source ruby IDE. No wxWindows this time though, this one’s going to live in your browser. I’ll be blogging more about this later, but after a week of spiking, we’ve pretty much proven that we can make it work.
  • DSLs by example – I gotta get myself talking again, so I’m putting this talk together to get myself back on the conference circuit
  • Working with BD in Seattle – I like Seattle, I’d like to keep working there. It’s about time I get up and do what I can to help ThoughtWorks sell some work there.
  • Working with Microsoft – They’re not that bad. Seriously, though, I’ve volunteered myself to help out with MS stuff seeing as how I’m in Seattle these days.
  • Going to OZ - Julian Boot is using Rails to do some pretty amazing things with a client down in OZ. We’ll see if he can get me out there for a month or so sometime this year.
  • Pairing on Quickstart Training – Luke Barrett is teaching a course in a month or two on this pretty amazing new service offering TW has. I get to help him out with it.

So that’s basically the rest of my year right there

The book story.

O’Brien pulls me aside as I’m walking to a breakout session and asks me if I want to write a book with him. He says it’s about DSLs and I basically love the idea. Keep in mind that I just met the guy a week and a half ago, but we paired on code together and talked a lot. He’s good people.

So we go downstairs and start brainstorming on index cards right away and Neal Ford joins us. Not only an author, Neal’s been giving talks about DSL’s at No Fluff lately. Then Rebecca Parsons just happens to sit down with us, she proceeds to give us all kinds of great ideas that the three of us hadn’t come up with yet. Then of course Prag Dave sits down at our table, and yes he’s been looking for a book on the subject. And yes we should get him a proposal right away.

Wow.

…and that was just 2 hours out of a weekend that blew my mind. Damn. It’s good to remember the kind of company I work for :)

Shimmer – A Photo Album on Rails

February 2nd, 2006

This is my latest OSS project. I started it to basically factor out what used to live in my own site into it’s own house.

It works very nicely with typo with the help of a couple typo macro’s I wrote for it. And thanks to rails, it’s a cinch to work on and add new features. I’m liking rails 1.0 a whole lot.
Noteable features are:

  • It’s pretty
  • It’s fast and lazy loading when it needs to resize stuff.
  • To configure it, you point it at a directory with pictures in it, that’s it.
  • Keyboard navigation
  • Slideshow, though there’s still a lot missing from our slideshow

Coming up:

  • AJAXy captions
  • AJAXy ratings
  • Favorites page
  • Online editing (thanks to rmagick)

We’re still early days, but it’s defnitely useable, as you can see. Take a look at what we have planned or grab the source from rubyforge svn.

And definitely let me know if you wanna help out!

We’re moving to Typo!

January 25th, 2006

It had to happen sometime.

I finally got fed up with maintaining my own handrolled blog software. In the end, it was the spammers that did it, I just couldn’t be bothered to add all the features that were necessary to handle them correctly.

And then, a couple weeks ago, I did a Ruby on Rails presentation, and someone pointed me to Typo as an example app.
Typo

Typo is awesome. It has tons of features I want, tons more that I can play with (it’s like christmas), it’s fairly user friendly, all ajaxed up, and it’s on rails, so I can hack into it to my hearts content.

If you’re self hosting a blog and are at all familiar with rails, I give it several thumbs up. Shame I only have 2…

I feel like my priorities have changed as well. Using a 3rd party tool like typo will help me focus more on the content of my blog and less on the technology behind it. Though I will say I’ve already learned a lot by seeing how the Typo team has done things.
Shimmer
After looking into it a bit, I decided I still didn’t want to use Shutterfly or Flickr. So I’m starting a new project called shimmer that is yet another photo gallery on rails. I coded up a couple plugins for typo so that I can natively have code like :


<typo:shimmer img="2003/January/Europe/IMG300.JPG" float="right"/>

in my posts and typo just does the right thing.

More to come on Shimmer as I polish it a little.

Rubyforge Now Has Subversion!!!

January 24th, 2006

It’s about freekin’ time!

It looks like sourceforge isn’t far behind, either.

I’ve been torn on every new project I’ve started on either of these sites between self hosting, and getting tons of svn happiness, or being a good oss citizen and getting out of the box standards and integration. Now I don’t have to make that decision anymore.

Go team.

Autocompletion In Irb

October 24th, 2005

*Pro tip:

*

Seems like it’s on by default on windows. On other systems, you just need to
require 'irb/completion'
inside of irb to enable it. You can also start irb by typing
irb -r irb/completion
or you can add
require 'irb/completion'
to your .irbrc file To use it just hit tab – so typing
"foo".rev<tab>  -->  "foo".reverse
for example, or
"foo".<tab><tab>
to see all the methods you can call on foo

I was totally amazed that this was already there when charles lowell showed it to me

They Got Me

September 5th, 2005

I hate spammers…

You’ve probably noticed, lately this blog has been getting hit by spammers. I’m disabling write for now till I have a second to spam proof it.

Seriously, I’m usually against capital punishment, but if I had a few spammers strapped to electric chairs and a switch in my hand…well, I wouldn’t hesitate very long before pulling it.

The idea of this site was a world writeable wiki / blog. That’s super simple, no users, no permissions, and it works great if people aren’t jerks. I like to believe the best of people. Guess this time I lost the bet.

Until I get adding comments back up, please e-mail them to me.

– Jeremy

Intercepting Events With A Glass Pane

August 25th, 2005

There are a ton of GlassPane examples out there, but it was hard to find a good concise one that did exactly what I wanted. So here are the results of a spike.

This should create a GlassPane that catches all mouse / key events and disappears only when escape is pressed.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 
public class GlassPane extends JPanel {
	public void install(final RootPaneContainer rootPane) {
		final Component prevGlassPane = rootPane.getGlassPane();
		rootPane.setGlassPane(this);
 
		addMouseListener(new MouseAdapter() {
			public void mouseClicked(MouseEvent e) {
				Toolkit.getDefaultToolkit().beep();
			}
		});
		addFocusListener(new FocusAdapter() {
			public void focusLost(FocusEvent e) {
				requestFocus();
			}
		});
		addKeyListener(new KeyAdapter() {
			public void keyTyped(KeyEvent e) {
				Toolkit.getDefaultToolkit().beep();
			}
 
			public void keyPressed(KeyEvent e) {
				if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
					setVisible(false);
					rootPane.setGlassPane(prevGlassPane);
				}
			}
		});
 
		setOpaque(false);
		setVisible(true);
		repaint();
		requestFocus();
	}
 
	public void paint(Graphics g) {
		super.paint(g);
 
		g.setFont(new Font("Arial", Font.BOLD, 24));
		g.setColor(Color.blue);
 
		g.drawString("Glass!!!", 110, 140);
	}
 
	public static void main(String[] args) {
		final JFrame frame = new JFrame("GlassPane Test");
 
		JButton showButton = new JButton("Click here to show glass pane");
		showButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new GlassPane().install(frame);
			}
		});
 
		frame.getContentPane().setLayout(new BorderLayout(10, 10));
		frame.getContentPane().add(BorderLayout.NORTH, new JTextField("TextField1"));
		frame.getContentPane().add(BorderLayout.CENTER, new JTextField("TextField2"));
		frame.getContentPane().add(BorderLayout.EAST, showButton);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(new Dimension(575, 300));
		frame.setVisible(true);
	}
}