From the monthly archives:

January 2010

AOTS Olivia Munn
AOTS’ Olivia Munn

The Smalltalk: The Good Parts Blog over at http://smalltalkthegoodparts.com is moving to http://hackingthevalley.com/ and to a new RSS feed. The Slicehost server will still host SmalltalkTheGoodParts.com and my Smalltalk experiments.

I know. It seems like we just got here a few weeks ago. And now we’re moving?? Crazy. Actually, what’s crazy was trying to maintain 4 blogs. In a momentary fit of delusion and megalomania, I had hallucinated that I would be able to teach 4 classes, walk the dogs, prune the damn apple trees, mentor 150 students, and create content for 4 blogs—and watch AOTS (Attack of the Show) every afternoon.

Something had to give, so the blog has to move. There’s no way I’m giving up AOTS.

I’m going to consolidate the PHP, Ruby, and Smalltalk Good Parts blogs into a single new WordPress blog (HackingTheValley.com), and shut down hackingthevalley.blogspot.com. Fortunately I have only a few posts to import. I can do this in a couple of days.

This blog will be turned off in 30 days and Feedburner will disconnect those who are using the old RSS feed. If you want to transfer to the new feed, click here to add the Smalltalk: The Good Parts RSS feed.

So the moral of the story is, one blog per mere mortal.

Happy hacking…

Doug

0 comments

I haven’t felt this excited about a tech product since I got my Kaypro in 1982. The Apple Tablet is going to be awesome for publishers and self-publishers, which I fancy myself to be. I’m going to pre-order one instantly. If this thing is to my X-61 tablet PC as the iPhone was to my Razr, it’s going to be insanely great.

I know that I sound like an inflamed Apple Fanboy, but, let’s face it, where goes Steve and Company, there goes the world. You go, Steve.

Keep hacking…

0 comments

If you need to see irb in action, check out this screencast.

Whenever I see a smooth, well-written, organized screencast I have a deep sense of appreciation. That’s my goal: be smooth, well-spoken, and organized. :)

Keep hacking Ruby…

1 comment

Every time I’m swept up in an new project I gird my loins by gathering a phalanx of books around me. I start by downloading all of the free PDF’s I can find. Stephane Ducasse, author the the Robots books, has an exhaustive list of free out-of-print Smalltalk books. So I got them all. I don’t know how many of these books I’ll ever read, but I feel good having them there, just in case.

Smalltalk PDF's

I like real books, so I scoured the used book list on Amazon and was able to find paper copies of many of my free PDF’s.

Most of these books were first published in the 80’s and 90’s, with a few of the Squeak books arriving after 2000.

Of all of these books, my favorite is SMALLTALK-80 by Adele Goldberg and David Robson (1989). Though the book’s cover gives it a quaint vintage look, the content is contemporary and the writing admirably clear—perfect for a student like me.

I like this book so much that I carry it with me on my walks around San Francisco and read it while I sit in Starbucks eating pastries and drinking espressos. Now and then some generic dude will see my antique book and comment, “Damn. Is that language still around? Why would you want to learn that when you could learn Java?”

I also have a soft spot in my heart for Squeak: Learn Programming with Robots by Stephane Ducasse, which I’ve mentioned previously. This book is good-spirited and all about having fun with programming. It’s an absolutely painless, fun introduction to Smalltalk. A kid can handle this book easily—even an adult kid.

My buddy Bill G. observed me collecting these dusty, out of print tomes. Back in the 80′s he did some Smalltalk programming in The Valley. He said, “There used to be an all-Smalltalk books store in Palo Alto on University Avenue, right down the road from Xerox. That’s how hot Smalltalk was in those days.” He paused. “I think that place is a Starbucks now.”

That’s cool with me. I need a clean, well-lighted place to hang out and read my books and get hassled by Java programmers.

Happy hacking…

4 comments

I have a new post about my mania for collecting vintage computer books. Check it out on Smalltalk: The Good Parts.

0 comments

Learning two languages at once can be hazardous to your mental health.

Now that I know I can deploy Seaside on my Slicehost server, I can move on to the next step, which is deciding which version of Smalltalk I should learn.

The languages I’m familiar with come in only one flavor: vanilla. With C++, PHP , Ruby, and Python there’s no choice at all: you take what they give you. But there are many varieties of Smalltalk to choose from; they all do great stuff, they all have the great features, and  they’re all just different enough that it’s in your best interest to choose one and stick with it. Some are free and som you have to pay for. Which one do you choose?

I’ll cut the suspense and say that my first choice for learning Smalltalk is Squeak. But my choice was entirely accidental. I didn’t choose Squeak on its merits, and it has many. I simply stumbled upon it.

I was taking a math course and wanted to graph some of the equations we were discussing in the class. I considered using PHP but working with PHP’s low-level GD library had already killed off too many of my brain cells. Then by accident, I happened across a book named Squeak: Learning Programming With Robots. I could see at a glance that I could make this Squeak robot do my bidding. Here’s my first Smalltalk program: drawing a square. In fact, drawing 100 squares.

Here’s a small screencast of how Squeak looks in the hands of a rank amateur.

3 comments

I posted my first Smalltalk program on SmallTalkTheGoodParts.com. It’s all about squares. You’ll love it, if you love squares…100′s of them.

Keep hacking…

0 comments

?!

It’s the first week of the semester for my online Ruby course. One of the first meta lessons I try to teach is to pull on the thread. I’m thinking of a loose thread on a knitted sweater. You have an itch to pull on that thread, knowing the sweater will unravel; if you pull long enough and patiently enough, you’ll end up with the other end of the thread in your hand.

Everyone in the class wants to know Ruby. Wanting to learn will carry you to the first step, and the second. However, if you want to really learn Ruby, you’ve got to be curious about it because curiosity carries you through to the end of the thread.

Today, a student asked me a question I didn’t know the answer to. When this happens in the classroom, I can say “I don’t know. Your assignment is to dig up that answer and tell us about it next class meeting.” In 9 years of teaching, only 3 students have been energetic enough to take up my challenge, but I always go home and look up the answer for myself.

An online course is different. I can dig up the answer. Here’s the question I got today:

I have two installations of Ruby: 1.8.7 on a laptop and 1.9.1 on a desktop, both Windows. In my 1.8.7 install I can do this:

    y 99.methods.sort

This y command does something like take in an array and output YAML. Is there a require that I have to do or a gem that I have to download to use this?

I can tell that this student is already committed to learning Ruby and already knows about gems and require. Here’s my answer.

This is a really interesting question. To answer it we need to talk about Modules and require, and how Modules can be used in classes. We’ll be talking about this subject later in the course, so if you (the class in general) feel mystified at this point, fret not. We’ll be covering this idea later.

However, for those who are interested, I’ll go a little further into it.

That ‘y’ method comes into irb when the Yaml module is “required”. irb does not do this by default, so I would guess that your particular version of irb is configured to ‘require’ Yaml. (None of my installations of Ruby on my Mac, PC, etc do.) It turns out that different implementations of Ruby, on different systems, configure irb differently. Your 1.8.7 version happens to ‘require’ Yaml.

If you want to use ‘y’ in irb, you can do this do this at the irb prompt:

require 'yaml'

If you are really curious you can to this.

1) Start irb afresh and do:

self.private_methods.sort

2) Visually scan the list of methods to get an idea of what’s in the environment.

3) Do this:

require 'yaml'

4) Run this code again:

self.private_methods.sort

5) Notice that methods have been imported from the Yaml module, and a new method called ‘y’ appears in the list.

6) You may think that the y method is in the Yaml module, but being the curious soul you are, you decide not to make unwarranted assumptions. Instead, you decide to dig into the source code. This a beautiful thing about open source languages: you have the source code to answer all questions about how the language implements its “magic”.

7) Next you do a search on your system (PC, Mac, Linux doesn’t matter) and look for a file named ‘yaml.rb’, which is the file that Ruby will look for when you say “require ‘yaml’”
8) Once you find ‘yaml.rb’ and look at the code, you finally know where ‘y’ came from.

Of course, along the way you may encounter mysteries and more questions will flood into your mind. But, this is a good thing. Ruby is deep and subtle. And fun.

You get the idea. I encourage digging through the source code. It’s a great way to see how Ruby code is really written. When you have technical questions that go beyond the scope of the assignment, beyond what “Beginning Ruby” offers, beyond my knowledge and experience, you can always go to the source code itself.

In this case, the file you’re looking for will be someplace like this (Windows users will have to look in C:\Ruby):

/usr/lib/ruby/1.8/yaml.rb

Have fun.

And of course, happy hacking…

0 comments

?!

Wanting to learn is one thing, but to really go deep, you’ve got to be curious. I write about this in my latest RubyTheGoodParts.com post. Check it out, if you’re curious.

Happy hacking…

0 comments

Amazon is taking pre-orders for a a new O’Reilly book named PHP: The Good Parts. There’s no publication date for the book, so it may be months before it sees the light of day. I’m looking forward to giving it a read—I’m always glad to find a good PHP book. I’m hoping that it’s as relevant to PHP as Douglas Crockford’s awesome Javascript: The Good Parts is to Javascript.

While you’re waiting for the O’Reilly book, you can read mine for free. It’s called PHP: The Good Parts. Just so you know, I thought of the title first, but I don’t mind O’Reilly using it. They’re good guys over there, and I’ve bought tons of their books over the years. Besides, my PDF is unique because I don’t do animal testing. All of the content of my PDF is tested only on students.

Happy hacking…

[This is a repost of the Original post on phpthegoodparts.com]

0 comments