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 no-reply@cambridge.org
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.
Here is a great example of a column I wish I'd never written. It presents a new control structure to deal with the complexity of the Composite/Wrapper pattern used in the user interface code in Visual Works. I wrote the column, sent it off, then had a quick talk with David Liebs about the subject. “So you need to talk to a particular wrapper, eh? Why don't you keep a pointer to the wrapper you need to talk to and give it a useful name? Then you can just send it messages.” Duh…
The other aspect of the column I regret is that it seems to condone adding new control structures to Smalltalk. The meta facilities of Smalltalk are extremely powerful, but 99.99 percent of the time, you shouldn't use them. Oh, they'd get the job done alright, but at what cost?
When you write something like #wrapperSend:, you have to take off your application-programmer hat and put on your language-designer hat. The responsibilities of the language designer are ten times as great as those of an application developer. Whatever you do, you have to implement it and test it, sure, but you also have to document it like a new language feature, extend the programming environment to handle it smoothly, and worst of all, maintain it through all future releases of the image.
Okay, back to tilting at windmills. Sometimes I think people just don't get Smalltalk. Why in the world would you want a grungy old explicit case statement when you have a superior substitute in the polymorphic message? How could you read and write Smalltalk code for enough years to be able to implement new language features and not understand that you didn't need them?
I guess my tights and cape aren't far enough at the back of the closet…
This month's topic is case statements: practical necessity or pernicious contaminant? My interest in the topic comes from several areas at once. SmalltalkAgents has added a form of case statement to their Smalltalk for the Macintosh. CompuServe has hosted a lively discussion of isKindOf: and its relatives. Finally, net news has had a discussion of case statements. What's the deal?
Cutting right to the punch line, I think case statements are an inappropriate holdover from procedural thinking. While vital in procedural languages, their use in object programs is obviated by the much more powerful mechanism of the polymorphic message send. Anytime you find yourself wishing for or using a case statement, you have an opportunity to take advantage of objects instead. The noncase version will yield a more maintainable, more flexible, more readable, and faster solution.
As with the previous column, this column has a strong confessional flavor. I like using my mistakes for columns, because I'm sure there is something to learn there.
The meat of the column is good stuff—refactoring and adding stuff becomes easy. I can't imagine how many times and ways I have said this in the last ten years. This is one of my better attempts, because it doesn't just say it, it shows it. (See “Make it Run, Make it Right” for another example.)
When I started writing this, I felt like I was getting preachy. Maybe that's what's so good about demonstrating from my mistakes—I can't be preaching if I'm explaining how I screwed up.
The personal material up front shows that I was aware that my attention was wandering. I'm glad I kept it together enough to say something important here.
Is it my imagination, or are these columns getting harder to write? I think I know exactly what I want to say, but I've started writing three different times without getting anywhere. Maybe this third time will work.
Simply put, here's what I want to say—the best programming style for Smalltalk is to have lots of little methods, and lots of little objects.
That's a pretty broad statement, broad enough that it can't possibly be true in all cases. What are the tradeoffs, the issues that affect programming style?
This is my abortive attempt to bring patterns to the masses. Dr. Dobbs (which I used to read as a Silicon Valley brat in the late '70s) called to ask for a pattern article. I thought, “Here is my chance to step outside the narrow confines of the object universe.”
Ha. Nobody got it. I'm sure I misjudged my audience, but I think there are more serious problems with the presentation here. Looking at the paper again, though, I'll be hanged if I can figure what. I'll take a shot at it, though.
One of the problems is certainly that I am talking about a different kind of pattern here than most people talk about. The patterns in the Design Patterns book, for example, show you how people use objects over and over. You can take the same approach to using a particular framework, however. People use MVC the same way over and over. You can write the things they do as patterns.
Part of the problem with the paper now that I look at it is that I got away from Ward's question, “What is the one thing you want the reader to take away?” This paper is all over the place. Another problem is that the paper isn't explicit about even those points that it does make. It tells a story (kinda), but it doesn't come out and say, “Communication is the problem.”
What features to look for in an object-oriented (OO) language.
We'll compare and contrast the leading OO development languages: C++, Smalltalk, Java, and ObjectCOBOL.
How to develop for the world of electronic commerce.
What other development tools you may need to successfully build OO applications.
In this chapter we will discuss what features to look for in an OO language, describing the main features of each of the leaders. We will also compare and contrast the languages as well as discuss how to build electronic commerce applications using OO development languages.
It wouldn't be right to have a book about OO development without covering the most common OO development languages. It needs to be pointed out, however, that this book isn't about OO programming, it's about OO development. Although I could easily write a book about each language covered in this chapter I'm not going to. The fact is that all I want to do is to give you a brief overview of what each language is like and what is typically used for, that's it. If you want more then I highly suggest that you pick up one or more of the books that I've listed in the references section at the end of this chapter.
I have started and stopped working on this book several times. Each time I began writing the introduction to a paper, I looked at it about half way through and said, “This seems awfully arrogant and self-centered. It's all about me, not about Smalltalk. Who wants to read about me?” I gave myself a good old-fashioned Puritan lecture about the virtues of self-effacement, and quit writing.
Recently I got Natalie Goldberg's second book about writing, Wild Mind. Her first book, Writing Down the Bones, was a collection of exercises for freeing the flow of ideas from mind to paper. I was reading Wild Mind sitting on a smooth teak bench in the Rose Garden of the Royal Botanical Gardens in Sydney. The yellowy autumn morning sun was baking the smell out of the roses. I read a comment another author made about the first book: “Why Natalie, this book should be very successful. When you are done with it, you know the author better. That's all a reader really wants, to know the author better. Even if it's a novel, they want to know the author.”
Creaking teak as I sat back. A flutter of wings as the gathered ibis around me took off. I blinked my eyes, hard. If a novel is about getting to know the author, and a book of writing exercises is about getting to know the author, then why shouldn't a book of Smalltalk essays be about getting to know the author?
This was my last column, and the one I'm proudest of. I have a habit of trying to take lessons from the world around me. If I see a tree leaning against another tree I say, “What is that like? Well, if one person leans on another too long, they both end up falling down.” I always kept these little stories to myself, though.
For my last column, I decided to break out. By now I was fully confident in my ability to describe a technical situation. I'd never tried to describe something from the real world in a publication before. This was my first attempt.
Looking at it now, it looks clumsy, but I still really like the underlying story. I've probably told the parable of the woodpile twenty times in the year since I wrote it.
In a way, this column represents the shift that I had been undergoing all along. I got completely away from technical stuff and completely into people stuff, and I did it in people-y, proto-literate way.
IT'S THE OBJECTS, STUPID
Sometimes it takes me a while to see the obvious. Sometimes even longer than that. Three or four times in the last month I've been confronted by problems I had a hard time solving. In each case, the answer became clear when I asked myself the simple question, “How can I make an object to solve this problem for me?” You think I'd have figured it out by now: got a problem? make an object for it.
The various trends and techniques in creating distributed applications.
How to distribute applications using client/server technology, taking both a two-tier and three-tier approach.
How to distribute the classes of your object-oriented application using traditional client/server approaches, object-oriented client/server (OOCS), and applets.
How to create applications using Common Object Request Broker Architecture (CORBA), a distributed object standard.
The architecture for application development is becoming more and more distributed. We're moving from the centralized mainframe approach popularized in the 1960s and 1970s through the client/server approach of the 1980s, into the distributed classes and distributed objects approaches of the 1990s. In this chapter we will compare and contrast these approaches, concentrating on object-oriented client/server design, a technique for distributing classes across a network of computers.
Over the past 15 years we have seen a general migration from highly centralized mainframe computers with dumb terminals to more and more decentralized information technologies. In Figure 5.1 we see how information technology is slowly evolving from mainframe technology to client/server technology to distributed classes and finally to distributed objects. In this chapter we will discuss the merits of all four of these technologies, concentrating on the reality of today and the near future: distributed classes and distributed objects.
Why your persistence strategy is important for successful application development.
What terminology is commonly used with respect to persistence.
How to map objects to flat files.
How to map objects to relational databases, concentrating on several critical topics: the impedance mismatch; mapping objects to tables; implementing object relationships; inheritance mapping strategies; and mapping success factors.
How to use object-oriented databases and object/relational databases as your persistence mechanism.
Persistence deals with the issue of how one ensures that the objects that he or she works with last, or persist, between invocations of object-oriented applications. In other words, persistence addresses one's strategy for saving objects to permanent storage. There are four common mechanisms used to store objects: flat files, relational databases, object-oriented databases, and object/relational databases. Although you may have heard that mapping objects into a relational database is a nightmare, and it can be if you make a mistake, we'll see in this chapter that using relational databases to store your objects is a very viable approach to persistence.
The vast majority of business objects must be persistent, or in other words they need to be saved to permanent storage so that you can work with them in the future. Fortunately or unfortunately depending on your point of view, we have several mechanisms that we can use to make our objects persistent: flat files, relational databases, object-oriented databases, and object/relational databases. We will cover each of these mechanisms in detail, discussing the issues for how to use them to make your objects persistent.
This was the column that generated the most interest and email for me, all of it positive. Other than that, there's not much to say, except “Get to work writing tests—yeah, you, the Smalltalk hacker.”
You can't argue with inspiration (or deadlines). I started to write the final column in the sequence about using patterns for design, but what came out was this. It describes some work I have been doing with a framework that takes the tedium out of writing tests. I'll get back to the pattern stuff in the next issue.
Smalltalk has suffered because it lacks a testing culture. This column describes a simple testing strategy and a framework to support it. The testing strategy and framework are not intended to be complete solutions, but, rather, are intended to be starting points from which industrial strength tools and procedures can be constructed.
The article is divided into four sections:
Philosophy. Describes the philosophy of writing and running tests embodied by the framework. Read this section for general background.
Framework. A literate program version of the testing framework. Read this for in-depth knowledge of how the framework operates.
Example. An example of using the testing framework to test part of the methods in Set.
Cookbook. A simple cookbook for writing your own tests.
Notice that I am still calling what I am doing “idioms.” What I am describing are really patterns, even if they are small-scale patterns. I figured it was better to bring my audience along a bit, prove myself useful, and then spring the bigger idea of which this is all a part.
I wouldn't do this again. Better to just say what you mean, and if you lose some people, so be it. I have a real tendency to try to please everybody, so this approach kind of goes against the grain.
The tension between evolutionary and revolutionary change is something I struggle with constantly. On consulting gigs, it is always a temptation to just say, “Throw the bastards out,” to start fresh. Often this will produce the best results the quickest. However, it requires courage and a lack of ego to “toss out” hard work. On the other hand, I'm always worried that if I were a little smarter, I'd be able to deal with the situation as it is.
The column is a good example of a technique I learned from Dave Thomas that he calls “lie management.” You present an over-simplified but essentially correct view of the world, then you fix it. The engineer in me recoils at this—I will go to ridiculous lengths to understand things completely, and everyone must be like me, right?
This one seems like a real stretch now. Half the column is taken up describing a client and giving advice to other consultants. That's not what a Smalltalk I dioms column should be about, and it doesn't really fit. Not that the advice is bad; it just doesn't go with the rest of anything else I was saying.
The technical part still seems right on. I recently used MetaObject to extend tools for use with Gemstone, and it worked like a charm.
The other thing going on here was my shock at seeing myself quoted at length in an earlier Smalltalk Report. When I spoke at the first Smalltalk Solutions, I got pretty outrageous—taking digs at my friends and potshots at big companies. All this was dutifully reported, and it looked pretty stupid in print. I was both disappointed at myself for having said it, and disappointed that it was made so public. Well, so much more public.
The lesson for me out of all this is that if people are going to take what I say seriously, I'd better damn well take what I say seriously, too. That's tough to do without taking myself seriously, which would be fatal. Having four kids is a great antidote to ever feeling like you have everything under control, though, so I'm not too terribly worried.
Which traditional testing concepts still work for object-oriented (OO) development and which don't.
How to test during all phases of the development life cycle: analysis, design, construction.
How to implement test cases within program code.
How to perform function, regression, stress, and user-acceptance testing.
Testing an object-oriented (OO) application is both very similar and very different as compared to testing a procedural application. The good news, if you can call it that, is that you still need to formulate test cases, you still need to document them, you still need to run and verify them, you still need both black-and-white box tests, you still need regression testing, and you still need stress testing. The bad news, however, is that the new development concepts provided by the OO paradigm require new approaches to testing. In this chapter we will discover several key concepts required for testing object-oriented applications.
I'm a strong believer in something called full life-cycle object-oriented testing (FLOOT), which involves testing your object-oriented applications throughout the entire system development life cycle (SDLC). We'll see that there are many reasons why you want to test throughout the entire SDLC, not the least of which is if you leave testing to the end of a project it typically doesn't get done properly. In this chapter we will discuss a number of testing techniques that together form a FLOOT process (there has to be a music joke in here somewhere).