show all comments

Smalltalk Solutions

Smalltalk Solutions: no talks on Wednesday

April 09, 2008 19:43:02 EDT

I've been asked this twice today, so let me post here in the vain hope that somebody might come across it. While the schedule for Smalltalk Solutions isn't up yet (real soon, I promise), the basic schedule is that the conference talks happen over three days, Thursday through Saturday. That's June 19-21. On June 18th, there'll be registration open, some coding contest activites, and a welcome reception - so basically it's the day before the conference really starts. If you're looking to book travel, you want to arrive on Wednesday. It's not necessary to arrive on Tuesday.

I knew this would be confusing.

Oh, and we've got some really good talks lined up, and I think it's going to be a great conference.

Smalltalk

Ruby and Smalltalk Idioms

September 10, 2007 10:23:08 EDT

This is a comment on the "Inconceivable" entry in Jim Robertson's blog, which I tried to post on the weekend, but apparently it was too late, so I'm just posting it here. See also the comment by Glenn Vandenburg and the original post Jim refers to.

OK, I think I see more of what you're getting at, and where you see the Smalltalk community doing things differently, although it's always dangerous to generalize about diverse communities.

I think the biggest difference is in the expectations people would have of the source code they're seeing. Smalltalk programmers would generally expect to be able to see the list of instance variables and the methods that access them. If they can't see them, but they exist, they'd find that confusing, and they wouldn't think of the presence of the instance variable and accessor methods to be cluttering up the source code. From your comments, it sounds like Ruby programmers would. Perhaps that's also related to tools, because Smalltalk has tools that help organize the source code. There's also perhaps an encapsulation point that people don't automatically put accessors for all variables.

So in Smalltalk, people wouldn't tend to think of having a method somewhere that declares the existence of a number of instance variable that are related in some way and also two accessors for each. They'd expect to see those things, and would probably prefer to do something like annotate the class definition, or the accessor methods, to distinguish those things that are to-many relationships.

In fact, when you talked about generating code, I assumed you were talking about more complicated methods for managing persistence, and being aware of the fact that the variable is a collection, not just accessor methods. The more complicated methods are the sort of thing that Smalltalk people would think of as cluttering up code, and would be likely to do by reflective mechanisms of one sort or another.

And, as Avi points out, if we did generate code, we probably wouldn't do it in such a way as to throw away the intention of the original annotation. But again, that's a bit confusing. If all we're talking about is accessors and a variable declaration, then there are no additional semantics to be taken into account in the generated code. All we've said is that there's an instance variable, we just haven't said it in the normal spot. The fact that it's a collection is irrelevant to the accessor methods or the declaration. You do say that you have the accessors doing a bunch of additional very nice stuff, so maybe they do take that into account, but then we start to get into details.

As far as how hasMany works in the Glorp Active Record stuff that I did, it's just an annotation, so the reflective code takes it into account. So, if you put in that annotation, it's expected that you have a variable by that name (the accessors are optional). It doesn't generate it for you. Reading, writing, and querying against the object works via API's that know about that annotation and take it into account, but which don't generate any code (unless you count SQL). One reason I wouldn't want to rely on extra code in getters and setters is just it's more complicated to make them work if people get the collection and modify it directly. Glorp works by just remembering what the object's state was previously and seeing what's changed, regardless of the mechanism. Of course, other people have done things differently in different frameworks.

For the meta-tricks in general, I'd agree that many of the tricks are very similar. The kinds of things that Ruby and Rails do with reflection are exactly the sorts of things Smalltalkers do with them, and the idioms are very recognizeable.

Smalltalk

Scripting Support

August 01, 2007 16:39:35 EDT

One of the things people have talked about a bunch recently is better support for scripting using Smalltalk. With that in mind, I'd like to point out a bit of work on helping to do that, in the suitably named package "Scripting Support" in the public Store. This includes a number of different things. It's fairly experimental - we want to see if this is what's actually needed/useful. So feedback is definitely appreciated. I note that the term "scripting" is somewhat vague. To clarify what we mean, this doesn't do anything to help you, say, write entire programs in files without having to use "chunk" or XML format. Rather it lets you control the environment from the command line better.

There are already some ways to run code from the command line in VisualWorks, e.g. -doit, -evaluate, but they don't entirely do what you want. So this adds the ability to just run a file from the command line, e.g.

vm scripting.im dostuff.st

or, if you have command line arguments, you can do them before the program, and put a -- option to indicate the program file. The program can also treat the rest of the line after it as arguments, which will show up in a variable named "arguments".

There's also a "-e" option that just runs its (single-line) argument as a doit. You can have several of these. This is a lot like -doit, except that it (and providing a script file) will automatically quit the image after running, and the environment in which they run. (If you're curious, I just looked at what Ruby had for command-line arguments, because I had it installed on the laptop at th time)

All scripts are run in a ScriptRunner which lets them run in a workspace-like environment in which all namespaces are visible by default. Ambiguous names will resolve to using one of the names and continuing, rather than causing an exception. Undeclared variables will be declared in the script runner's namespace. And exceptions will dump a short stack and quit that particular script, but run other commands if there are any.

There's also an interactive console, of sorts. So invoking the image with -i will give you a command-prompt, and you can type Smalltalk expressions to be run as scripts. You can even use \ to continue on to the next line. And to get out of it, you just type ObjectMemory quit. Note that one limitation of this that we have to fix is that while it's waiting for input at the prompt, the VM is blocked. This is a problem if you want to do complicated background processing, but is surprisingly not that noticeable for basic use. We think we have a fix for that, but it requires some validation.

The ScriptRunner also provides a couple of convenience methods for use in scripts.
#include: runs the named script by filing it in
#use: parcelName makes sure that the parcel is loaded.
#print: prints its argument to the output of the script (normally standard out)

Finally, this package adds & as a concatention operator. This is just playing around with possibilities, but a number of the collection operations in Smalltalk are quite awkward to type out in scripts. So this tries to do some of the collection building stuff in more of a Do What I Mean kind of way. So, e.g.


1 & 2 ==> #( 1 2)
#( 1 2 ) & 3 ==> #( 1 2 3)

and other interesting stuff.

Glorp

July 10, 2007 15:26:05 EDT

I feel sure somehow that I had written about some of the moderately recent changes in Glorp, but someone asked me about it, and I can't seem to find anything. So here's a very high level description of the possibly interesting changes from 0.3.138 to the present, in no particular order.
  • Support for proxy actions. You can give a proxy a block that it will execute when it's instantiated.
  • Some APIs are simplified. For example, read: instead of returningManyOf:. Or you no longer need to implement constructAllClasses, it'll figure out from the descriptor methods if they're there.
  • GlorpActiveRecord - the ability to have automatic mappings for things that are relatively simple, and to gracefully scale up when they get more complicated. I talked about this in my user conference presentation, and the code is in the public repository.
  • The ability to have expressions in mappings. This means that you could make a direct mapping that didn't go to a field, but to a function of a field. Or to a subselect. Such mappings would likely have to be read-only, but this is still very valuable.
  • Support for a variety of trickier mappings in general, including a number of improvements for situations when the primary keys aren't themselves mapped, but are used as part of a relationship mapping.
  • Better support for generated values of different types, generalizing from just generated primary keys or optimistic locking versions to allowing things like timestamps for last modification and more complex generated values.
  • Support for reading database metdata using INFORMATION SCHEMA. This lets us avoid putting in the tables ourselves for the GlorpActiveRecord above. Currently works only for Oracle and Postgresql, though it should be fairly easy to adapt. Done in a nicely recursive way. We have descriptors that map from Glorp's objects to the INFORMATION SCHEMA tables.
  • Glorp now properly handles the case where you delete and re-insert the same object in the same unit of work.
  • Added the ability to have exclusive relationships. These will delete the target of the relationship when the source is deleted or the reference to the target goes away.
  • Added some tools (in the GlorpAnalysis package) for performance analysis, keeping track of which sorts of queries were executed, and how long they took.
  • A lot of improvements to the dictionary mapping. It still doesn't do everything desirable, but, and here is the essential point, it is better than it was.
  • A DirectToManyMapping for collections of simple types.
  • A variety of additional functions and things you can do in expressions. This includes the ability to use includes:, select:, intersect:, count:where:, copyFrom:to: to generate substring expressions,.
  • The ability to specify an encoding and have it used for reading/writing string data.
  • Efficient queries for horizontal inheritance, reading all of the subclasses in one (really messy) query. See here
  • Basic support for groupBy:
  • A lot of fixups related to types, validation and better error messages, generation of values, performance, and others, too small to mention.

miscellaneous

Securing Borders

June 18, 2007 11:31:10 EDT

My brother pointed out this link to a story about the Haskell Free Library, which sits, intentionally, part-way in Stanstead Quebec, and part-way in Derby Line, Vermont. New border crossing and security rules are set to cause it some serious problems. It's a good illustration of the kind of disruption that happens when security concerns meet the reality of border communities that have been open for a very long time.

Stanstead is very close to where my grandparents lived, and I've been in that library a couple of times as a child. It'll be a shame if they have to set up customs controls between the stacks and the reading room.

Smalltalk Solutions

Smalltalk Solutions Quotes

May 10, 2007 18:28:36 EDT

Smalltalk Solutions is over. Other people, including Jim Robertson have reported on the various sessions in a much more timely way than I can. One thing I like to collect though, is good quotes. Chad Fowler, who did both the "Ruby for Smalltalkers" tutorial and "The Innovations of Ruby on Rails" had the most quotable stuff for the conference, but there was one very nice one from Mark Petersen of IBM.

  • "Ruby is a gateway drug to all the things that used to be too weird." - Chad Fowler (Ruby for Smalltalkers tutorial)
  • "I love talking to Smalltalkers. You talk to a bunch of Java or PHP programmers their eyes glaze over and they don't understand why this stuff is cool. You guys understand why it's *not* cool." - Chad Fowler (Ruby for Smalltalkers tutorial)
  • "In my opinion, Seaside is the coolest thing going in web development" - Chad Fowler (Ruby for Smalltalkers tutorial)
  • "Smalltalk is an ideal language for non-professional programmers" - Mark Petersen, (Smalltalk in Semiconductor Test)

Cincom

Blog Title Change

May 10, 2007 18:13:22 EDT

Those of you who carefully watch these things may notice that I've changed the blog title, from "Glorp News" to "Cincom Smalltalk Stuff". This to reflect my new position, as Technical Architect for Cincom Smalltalk. In that position, I think it's appropriate for me to make more public commentary on the product as a whole, rather than focusing on my personal project. I'll also be trying to blog a little more regularly. And I even put up a little biographical entry.

miscellaneous

Turn player off for scheduled recording

April 11, 2007 15:02:45 EDT

Jim Robertson continues on with his ranting about DRM, which reminds me of my own recent experiences both with DRM and with people just carrying on with old design decisions in places where they don't make sense.

I have a DVD recorder. It was surprisingly not that much more expensive than a reasonable DVD player, and it also supports DVD-RAM recording, so you can watch things as you're recording them. Sort of the poor man's DVR. We've used it occasionally, but not that much. Then the actual DVR broke, and we were a few days without one. And during a Champions League week. So it started getting a lot more use, and its features really started standing out.

One is its tendency to develop errors over time and require resetting to default settings. We see this regularly with DVDs, where it decides everything is out of its region. Last week I saw it decide it wouldn't record a normal television channel because it didn't have permission. This is one of my main objections to DRM, that almost any failure mode is going to involve making your content unavailable. And this is controlled by software, and we know how dependable it is.

The other thing that struck me is the old VCR-ish feature that to make it start recording on a schedule, you need to turn the machine off. That never made a whole lot of sense, even on a VCR. When you've got a DVD-RAM, it's completely stupid. So, suppose you have two timers, to record two sporting events that are on consecutively. And you start watching the first one after a half-hour's delay or so. Now the machine is on, so the second recording won't start. @#$@#%@.