Classic Singleton

Posted February 28, 2007 by objectcentric
Categories: Design Patterns, Objects, Smalltalk

February is nearly out and I haven’t posted for a few weeks so I thought I’d just throw in my thoughts on the use and misuse of Singletons! Many of my colleagues working in Java pepper their code with static methods and use them as placeholders for pure function calls. Some would argue that the language encourages this.

I’ve also seen the same thing in Smalltalk code – since the class side only exists once in the image it is in effect a Singleton and therefore we can use this to our advantage and write class methods to achieve the Singleton effect. So if you want to create a WidgetFactory as a Singleton you can simply add class methods to WidgetFactory that return widgets for you (e.g. #getWidget:). But just because you can doesn’t mean you should!

Read the rest of this post »

Why Wouldn’t You Use Seaside?

Posted February 7, 2007 by objectcentric
Categories: Seaside, Smalltalk

I picked up seaside for the first time 2 months ago and having played with the stuff I guess I’m intrigued by the question “why wouldn’t you use seaside?“.

Read the rest of this post »

Scriptacu-list Tutorial(Part 7)

Posted January 26, 2007 by objectcentric
Categories: Scriptaculous, Seaside, Smalltalk

To complete our application we will allow our users to upload a picture of the contact so that it appears on the details drop down.

Read the rest of this post »

Scriptacu-list Tutorial(Part 6)

Posted January 25, 2007 by objectcentric
Categories: Scriptaculous, Seaside, Smalltalk

OK if you’ve stuck with me so far you should have a functioning application with a Scriptaculous effect that you have achieved with very few keystrokes (very few indeed if you just copied my code!). We are nearly at the end of our journey – just 2 more sessions to go. So for today’s session we will look at taking that “Toggle Details” link and make it more context sensitive – “Show Details” to show the details and “Hide Details” to hide them.

Read the rest of this post »

Scriptacu-list Tutorial(Part 5)

Posted January 24, 2007 by objectcentric
Categories: Scriptaculous, Seaside, Smalltalk

Its time to get our little Contact List application into the Web2.0 era by adding a funky Scriptaculous dropdown on our contact list. The really cool thing is that we are going to do all this without writing a single line of Javascript (Lukas Renggli has already done that for us.  Much respect Lukas!) – it’s Smalltalk all the way for us!

Read the rest of this post »

Scriptacu-list Tutorial(Part 4)

Posted January 23, 2007 by objectcentric
Categories: Seaside, Smalltalk

Time’s tight today so I will just introduce my technique for creating alternating rows into our contact list.

Read the rest of this post »

Scriptacu-list Tutorial(Part 3)

Posted January 22, 2007 by objectcentric
Categories: Design Patterns, Objects, Seaside, Smalltalk

So we’ve got a simple Contact List working but there are two big problems.

  1. When I’m editing the contact the data changes even if I click “Cancel”.
  2. It doesn’t look very pretty.

Today we are going to fix this…

Read the rest of this post »

Scriptacu-list Tutorial(Part 2)

Posted January 18, 2007 by objectcentric
Categories: Seaside, Smalltalk

So we’ve got our first cut domain model and now its time to add our views. Today we are going to add another two classes MyAddressBookView and MyContactEditor…

Read the rest of this post »

Scriptacu-list Tutorial(Part 1)

Posted January 17, 2007 by objectcentric
Categories: Scriptaculous, Seaside, Smalltalk

Learning Seaside is fun and there are a number of good tutorials out there (but beware that some don’t use the latest Seaside 2.7 release) and a number of good blogs (I especially recommend Ramon Leon’s Blog). But it can still be a bit tricky to find examples of exactly what you want. What I’d like to do over the next couple of posts is provide a worked example of a commonly used presentation technique with an extra Scriptaculous twist.

Read the rest of this post »

They Want it All

Posted January 12, 2007 by objectcentric
Categories: Croquet, Scratch, Smalltalk

So I sat down last night with my 9 year old boy who’s got in his head some ideas about a game he wants to write. We open up Scratch and I start to show him what it can do.

First I animate my cat and get him walking around.

“But it has to be a monkey Dad, not a cat”

“OK we’ll make him a monkey” – we select the cat and change his costume. Cool.

“But the monkey has to go into the tree house, Dad.”

“OK. Lets create a background with a tree house.” – we build our stage and add a tree house with a ladder. When the monkey gets to the ladder he climbs it and gets to the house.

“Now he needs to go through the door and be in the lounge”

We make it happen. I smile smuggly at what we’ve acheived and tell him that’s it for tonight.

“OK but tomorrow I want to get my friends on the internet to come and join me with their monkeys in the lounge”

I swallow hard and explain how I can’t do that with Scratch.

The kids of today just want it all! Maybe tomorrow I’ll show him Croquet.