We use cookies to distinguish you from other users and to provide you with a better experience on our websites. Close this message to accept cookies or find out how to manage your cookie settings.
To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure [email protected]
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
The Smalltalk Report occupies an important position in legitimizing Smalltalk. While it has in the past seemed the ugly stepchild of the SIGS family, the mere fact of its existence has gone far towards convincing reluctant decision makers that Smalltalk is worth betting on
When I started writing for The Smalltalk Report, I had already made something of a name for myself in the Smalltalk world. The CRC paper was out and making its splash, I had been working on Smalltalk in various guises for eight years, and I was well into my tenure at MasPar.
My life in a startup cloister was a big part of my decision to begin writing the column. Startups are great fun, but you don't join one to see the world and become famous (if you're not in sales, anyway). Writing the column kept me in touch with my friends.
In the end, the benefits of writing the column were much greater than I had imagined, as were the pains. It always seemed that the next deadline hit just after I'd finished the last column. Dragging fingers to keyboard when a paying customer was already waiting for code was tough. However, I got much more from the column than I put into it. First, I learned to write. You will see a distinct change in my writing style from the first columns to the last.
“I'm not dead yet.” That's what I thought when Don Jackson at SIGS offered to put my articles together into a book. It's probably that every book I've ever seen with “Complete” or “Collected” in the title is no longer with us. Last I checked, I'm still here.
Having established that I am alive enough to be typing this, let's get to the point of the Preface—convincing you to buy this book. You are standing here trying to decide whether to spend your hard-earned dinero for that exquisite literature you saw with the swords and dragons and stuff on the cover or a collection of my articles. Here's my pitch—my entire career has been spent learning how to communicate with other people about programs. This book chronicles how I learned what I know and how I learned to tell people stories about it.
I just finished my first book, The Smalltalk Best Practice Patterns. It is easy to see how a book written end to end can have a single theme. This book has no such theme. It has a story—no, two stories.
The first story could be called “Kent Discovers the Importance of People.” I got into computing to avoid having to deal with people. As a sophomore in high school, I took physics instead of biology so I wouldn't have to try to understand “all that squishy stuff.” The rest of my academic career was spent in search of deeper understanding of the mechanics of things, whether the topic was computing or music.
The previous column got me started examining why people create classes. About this time, I had collected enough patterns to begin thinking about the patterns book. Of course, at first I was going to cover all of programming/analysis/design/project management/etc. in a single book. This exploration was the beginning of trying to write the analysis/design portion of the book.
One of the things I like about writing a column is that it forces you to think hard about a topic at regular intervals. I'm the kind of person who dives deep into a topic until I'm bored, and then drifts until something else catches my eye. I get to study lots of cool stuff that way, but I don't really penetrate to insight. Writing a column returns me to roughly the same place every month and pushes me to find something new. The result is much more valuable thinking.
Previously, I talked about how objects could be created from the states of objects that acted like finite-state machines (the “Objects from States” pattern). I'll continue on the theme of where objects come from for this and several issues.
I won't be saying much about the conventional source of objects, the user's world. There are lots of books that will tell you how to find those objects. Instead, I'll focus on finding new objects in running programs.
I think this was originally titled “Inheritance: The Rest of the Rest of the Story,” but it got edited. Oh well.
The pattern presented here is another in the “Transformation Series.” It recommends letting inheritance evolve from the need to reduce code duplication.
In the June issue, where I took on accessor methods, I stated that there was no such thing as a truly private message. I got a message from Nikolas Boyd reminding me that he had written an earlier article describing exactly how to implement really truly private methods. One response I made was that until all the vendors ship systems that provide method privacy, Smalltalk cannot be said to have it. Another is that I'm not sure I'd use it even if I had it. It seems like some of my best “reuse moments” occur when I find a supposedly private method in a server that does exactly what I want. I don't yet have the wisdom to separate public from private with any certainty.
On a different note, I've been thinking about the importance of bad style. In this column, I always try to focus on good style, but in my programming there are at least two phases of project development where maintaining the best possible style is the farthest thing from my mind. When I am trying to get some code up and running I often deliberately ignore good style, figuring that as soon as I have everything running I can simply apply my patterns to the code to get well-structured code that does the same thing.
Yet another brutal review. I never write a tough review without questioning myself: “Is it just me? Am I just not smart enough to get this product? Who am I to tell someone else what to do?”
I am just now getting comfortable with writing what I know and trusting my readers to take what I say and add their perspective and experience to it.
Should you be using Distributed Smalltalk? That is the question I'll address here. This isn't a full-blown product review, nor a technical piece. I'll introduce the history and technical background of Distributed Smalltalk as they apply to the question of who should be using it.
First, what is Distributed Smalltalk? It is a Common Object Request Broker Architecture (CORBA)-compliant extension to ParcPlace System's Visual-Works developed and marketed by Hewlett-Packard. “HP? The hardware company? Those C++ guys?”
My first reaction when I saw that HP had done a Smalltalk product was, “What does HP know about Smalltalk?” The answer to this question is twofold. One answer is “a lot.” HP has been involved peripherally in Smalltalk since it first escaped Xerox. They were one of the first four companies to write a virtual machine. They have also had pockets of interest in Smalltalk ever since. Their 700 series of workstations has held the title for fastest Smalltalk for several years.
Well, at least I didn't just present instance-specific behavior as a pointy-hat technique. I tried to extract some cultural lessons from it. Now that the Smalltalk world has contracted to a couple of big players, there isn't enough cultural diversity left to analyze. Ah, the olden days, back when we used to have to walk miles barefoot in the snow to get coal to shovel into our Smalltalk machines… Now I sound like an old fart
In the last issue, I wrote about what instance-specific behavior is, why you would choose to use it, and how you implement it in Smalltalk-80 …er…Objectworks\Smalltalk (which way does the slash go, anyhow?) …er… VisualWorks (is that a capital W or not?). This month's column offers the promised Digitalk Smalltalk/V OS/2 2.0 implementation (thanks to Mike Anderson for the behind-the-scenes info) and a brief discussion of what the implementations reveal about the two engineering organizations.
I say “brief discussion” because as I got to digging around I found many columns' worth of material there for the plucking. I'll cover only issues raised by the implementation of classes and method look-up. Future columns will contrast the styles as they apply to operating system access, user interface frameworks, and other topics.
Just when I write something that is too short, I write some that is too long. I was really in the groove of writing columns by this time, and I'd wait until the last minute. Sometimes, as in the previous column, this left me a little short. Sometimes as in this column, I ended up starting something I couldn't finish.
This column points to one of my weaknesses as a writer—I don't turn to pictures nearly soon enough. The material covered here would make much more sense with a few well-chosen pictures. If you get bogged down, try drawing the pictures yourself. That's what I do, even if I don't often publish them.
I kind of ran out of steam towards the end of that last series on creating new objects. I think the message that many of the most important objects are not the ones you find by underlining nouns in problem statements is still valid. The objects that emerge (if you're watching for them) late in the game, during what is typically thought of as maintenance, can profoundly affect how you as a programmer view the system. By the time I got to the fourth part, though, I was tired of the topic. Those last couple of patterns still deserve some reexamination in the future.
When, and when not, to use the following wrapping technologies: C APIs, dynamic shared libraries, screen scraping, peer-to-peer, and the Common Object Request Broker Architecture (CORBA).
The trade-offs of wrapping.
Information technology shops of today have a huge investment in information technology; unfortunately, the vast majority of it isn't object oriented (OO). In the 1980's it is estimated that over $ 1 trillion was invested in information technology in the United States alone. Needless to say organizations are motivated to retain as much of this investment as possible. Wrapping is a technique in which you make non-OO technology appear to be OO by putting a layer of OO code around it, which is often a critical part of any significant OO project.
A wrapper is a collection of one or more classes that encapsulates access to technology that isn't object-oriented to make it appear as if it is. A wrapper class is any class that is part of a wrapper. Wrapping, as shown in Figure 11.1, is used to provide OO applications access to hardware, operating system features, procedure libraries, function libraries, and even legacy applications. Wrapping allows you to retain your investment in older, non-OO technology by allowing you to reuse it in the new OO applications that you develop.
Oooooh, my first process pattern. All of the patterns I had written to date talked about programming things. This column introduced the first pattern that talks explicitly about people activities.
Jim Coplien was one of the first people to start writing lots of good patterns. Even though he is a good programmer, he chose to write his patterns out of his experience analyzing software development organizations. I was skeptical at first—what do these patterns of how people behave have to do with programming? It was around the time of this article that I began to realize that his perspective was as important as mine. It doesn't matter how good a job you do if you're doing the wrong job.
To make up for all the icky squishy stuff, I made sure I included plenty of code in the column. As aggressive as I think I am, looking at these columns reminds me that I go in the water half a toe at a time.
Now, where was I? Oh, yes. Last issue I talked about my philosophy of testing and presented a framework that supported writing unit and integration tests. But before that, I was talking about how to use patterns. I have spent a couple of issues designing the software to run a television and remote control, using patterns to guide every design decision.
After the brief pause in the previous column to discuss philosophy, this column descends again into the depths of techno-minutiae. At least I talked about why you'd want to use instance-specific behavior, and didn't just present it as:“Here's a cool thing you can do with Smalltalk.”
The pattern Scriptable Objects still looks pretty good to me. In fact, I like it better as a pattern than many of the patterns that follow.
This and the next column will discuss technical and philosophical matters. The technical material covers implementing and using instance-specific behavior, the idea that you can attach methods to individual instances rather than to a class. You might use it in animation or in building a Hypercard-like system. It is not a new idea. Lisp-based object systems have had it for years, and languages like Self rely on it exclusively. It is not well known in the Smalltalk community, though, and deserves a place in the mature Smalltalker's bag of tricks.
The philosophical material illuminates the differences between Digitalk's and ParcPlace's view of good Smalltalk style. ParcPlace grew out of a research atmosphere where truth and beauty were admired. Although established in business now, ParcPlace continues to favor elegant solutions. Digitalk has always been driven by the desire to build commercial software and has often been staffed with engineers whose experience comes from other languages. Digitalk's solutions tend to be more pragmatic and the workings easier to follow operationally, even if they don't have the most elegant high-level models.
This was a very important article for me. I had been writing solo for some time. I needed to collaborate more, especially since I had been independent for almost a year and I was getting lonely for technical collaboration.
Bruce Anderson organized this fantastic workshop for IBM at its educational site in Thornwood, New York. Ralph Johnson was another one of the teachers. Late one night, I grabbed him and said, “I bet we can describe HotDraw using patterns.” He didn't know quite what I meant, but he has learned to humor me (probably because he's big enough to just bop me if I get out hand). There in a spartan little room in IBM's training facility in up state New York, we tried to recreate HotDraw using only patterns—this pattern tells us to create this object, then this pattern splits it in two, then…
The result was one of those crackling moments when you know you have something. Early the next morning, I described HotDraw to Desmond D'Souza, first using CRC cards the way I always had, then using the patterns. He confirmed that the pattern description communicated the “why” of the design much more clearly.
Ralph and I were confident enough of our findings that we wrote up the paper with a sweeping conclusion—any object architecture can be derived by applying a set of patterns.
My programming partner Ward Cunningham taught me to avoid complexity. In spite of my blue-chip, Silicon Valley brat credentials, I was never a very good programmer. Ward has more programming talent than I do, but he still programs simpler stuff, not because he must, but because he chooses. That is a big part of my success to date—picking development priorities and ignoring interesting side issues.
This was my first technical article. I was lucky to write it with Ward, because he had a pretty good handle on how to focus an article. That was the lesson of this paper for me—focus. I can remember discussing for days what the one single point was we wanted a reader to take away. That was a powerful lesson, and a bit painful, too. Ward and I had been working on lots of exciting stuff. I wanted to talk about all of it. Ward leaned and leaned on finding the one point that stood above all others. Finally we hit on this one.
The article introduces the Cunningham Diagram, a diagram with much the same information in it as Jacobson's Interaction Diagram, but (to my eyes, anyway) much more artistically rendered. As far as impact goes, this paper was a dud. The two good ideas here—the diagram itself and a tool for constructing it from running code—both disappeared without a trace.
You can't write a review without breaking some eggs. That was my conclusion after writing this article. I pretty much trashed the Enfin product as it stood, backed by my review research and a nasty experience at a potentially big client.
I was worried what my friends at Enfin would say after this came out. I was pleasantly surprised to find them supportive— “We know we have these problems. Let us show you how we are addressing them.”
I learned that readers appreciate it when you speak your mind plainly, but you'd better have some numbers to back up your opinions.
A funny thing happened on the way to objects. There was this C++ juggernaut that was supposed to trample all in its path. I can remember hearing all the talk at OOPSLA '86 in Portland about how C++ was the language for objects. “Too much momentum.” “Too many C programmers.” “The alternatives are too flaky.” Everything else was going to be trampled. Period. In spite of this, a thriving market has grown around Smalltalk, the granddadly of pure object languages. It may be a fraction of the C++ market, but it is currently the scene of enormous technical and business energy. I make my living with Smalltalk, so my opinions on the matter are suspect, but I'll present the facts of the products in the market and let you draw your own conclusions.
This was about where I started losing interest in writing the column. I had written this nice bit of code for a client, and I ran into a publishing deadline, so I turned it into a literate program and sent it off.
You'll notice that there are eight more columns after this one. Once again, my reluctance to change shows through. My lesson: once you decide not to do something, do not pass go, do not collect $200 (yep, that's the going rate). Quit and get on with something else.
In my case, I was distracted by trying to keep my business going (which in itself was too big a job for one person) and trying to get my patterns book done.
Not that this is a terrible column, or that it gives bad advice. The technique is useful, and belongs in every wizard's black bag. When I don't feel like writing the column, though, I shouldn't write the column.
Before I jump into this month's column, I'd like to tell you a little about what I learned at Digitalk's DevCon this year.
RANT
One thing I learned is that Digitalk is finally coming around to the idea that third-party support is important to their success. The slow growth of the third-party parts market has hurt them, I think, and they want to fix that. Their Partners Program, the third-party catalog to be shipped with their product, and their public and private statements at DevCon give me hope that they are coming around.
This column takes a little bit bigger chance. I never worked out the instance variable taxonomy to the degree I did with temps, but I went ahead and published what I had anyway (as a column, it's not in the book), because I thought it was interesting and potentially useful. Looking at it now, I can't see how terribly useful it is. Sigh. Anyway, I was about to quit as columnist, and this and the previous column were just about rock bottom.
In the last issue, I presented the four ways temporary variables are commonly used. This time, I'll talk about how instance variables are used. The results for instance variables are nowhere near as tidy as those for temps. I'll speculate as to why after I've presented the information.
SOAPBOX
But first, I'd like to whine and complain a little. Here's the essence of my beef—it's getting harder, not easier, to write Smalltalk applications. This is not what I expected. Smalltalk had already raised the level of programming so much from what I was used to that I figured the trend would continue. Today's clichés would become tomorrow's abstractions and the day after that we would forget we ever had to program that stuff. Onward and upward.
There are two notable points to make about this paper. First, it is one of the first times Ward and I published any pattern-related material (we presented some stuff at OOPSLA 87 in Orlando, I in Norm Kerth's “Where Do Objects Come From” workshop, Ward on a panel). Second, it argues that the worst problem of reuse is one of communication, not technology or economics.
The paper started out life as a Tektronix technical report. Ward and I had the habit of writing up just about everything we did as a TR. After we had written this, I think we submitted it as a position paper for some conference or workshop. Somehow, JOOP got hold of a copy and contacted us about publishing it.
The paper can be summed up as: “We created two sets of abstractions. The first was communicated as literate source code. The second was communicated as patterns for its reuse. The first set of objects was misused; the second was used correctly. We conclude that the problem of reuse is one of effectively communicating the intent of the code.”
Hold on a sec.…
Before I finish bashing case statements, I'd like to return to the scene of an earlier crime, my perfidious assault on that bastion of Smalltalk orthodoxy, the ubiquitous accessor method. (Whew! That's a tenbuck sentence if I ever seen one.) I argued that the violation of encapsulation provided by accessor methods more than offset any benefit of inheritance reuse.
This column is really just an application of Composed Method to deal with inheritance. Now I always try to make my code fragments be real code, no As, Bs, and Cs. You can see why from the example here that is written the other way.
The column is interesting in that it contains some of the first explicit links between patterns. Down at the end it says, “Use Composed Method if necessary to set this pattern up.” I paid considerably more attention to pattern linking when I wrote the pattern book, and I'll probably pay a lot more attention with my next set of patterns.
Patterns in isolation are all very interesting, but it is when they are linked together that they become powerful. It is only then that you can explain a simple solution to a problem, because you know that the rest of the solution was handled by previous patterns or will be handled by future patterns.
The topic of this issue's column on Smalltalk idioms, following the general theme of inheritance, is how to manage the use of super. Several issues back I wrote a column entitled “The Dreaded Super,” in which I catalogued all the legitimate (and otherwise) uses of super in the existing Smalltalk/V and VisualWorks images. I'm still very proud of that column, but a couple of days ago I discovered I had left out one very important technique in dealing with super.
As if one crusade wasn't enough, I had to take on the sacred cow of inheritance as well. This must have been my “caped crusader” phase. I still think inheritance is overrated, but I don't generally get in anyone's face about it anymore. Too many windmills under the bridge, I guess. There I go, sounding old and worn out again.
I like the way the pattern form makes concrete and clear the technique of separating state-related and service-related code. The how of it is clear, as is the why.
This is one of many attempts I have made to explain the pattern I now call Composed Method. I must have written this pattern six or eight times. Persistence (my wife calls it “stubbornness” for some reason) can make up for lack of raw talent.
The two patterns here are written as transformations and named as a transformation—you have a method and you split it apart or you have a class and you split it apart. I was very big on “patterns as transformations” for a while. All the patterns in the pattern book are written differently—as descriptions of the things created, not the process of creating them.
Of the three tenets of objects—encapsulation, polymorphism, and inheritance—inheritance generates by far the most controversy. Is it for categorizing analysis objects? Is it for defining common protocols (sets of messages)? Is it for sharing implementation? Is it really the computed goto of the nineties?
This column is the site of my greatest disaster as a column writer—I promised something I didn't deliver. This was another one of those “write the first half now and the rest later” columns. Unlike the column about applying patterns to design, however, I didn't know the second half of the material when I started. I stil feel bad about this, but I still don't know the material for the second half, so I still can't write it
I really like this column as a piece of pedagogy. It is an excellent example of lie management. I describe garbage collection simply one way, then simply another, then combine the two for a truer picture of garbage collection. And hey, I even included a bunch of pictures.
This month I'll talk about garbage collection. To paraphrase Mark Twain, everybody talks about the garbage collector, but nobody does anything about it. All of the commercial Smalltalks provide some ability to tune the garbage collector, but without knowing what's going on and why, you are unlikely to be able to know when these features are applicable or how to use them. This article discusses the common vocabulary of modern garbage collection. Later, we'll explore what you can do to tune the garbage collector in the various Smalltalks.