Browse files


git-svn-id: 54883e8d-cf1d-0410-83d6-f114b9419f37
  • Loading branch information...
Oscar Nierstrasz
Oscar Nierstrasz committed Sep 17, 2007
0 parents commit 10edf02e9b660d02648e5bdcee62b0b8410acd0e
Showing 305 changed files with 64,112 additions and 0 deletions.
@@ -0,0 +1,22 @@
% This bibliography was produced by using jurabib.bst
\bibitem[{Woolf\jbdy {1998}}%
{Addison Wesley\bibbdsep {} 1998}}%
{{Null Object}%
\jbbibargs {\bibnf {Woolf} {Bobby} {B.} {} {}} {Bobby Woolf} {au} {\bibapifont
{Null Object}\bibatsep\ \incolledformat {\bibenf {Martin} {Robert} {R.} {}
{}\Bibbfsesep \bibenf {Riehle} {Dirk} {D.} {} {}\Bibbstesep \bibenf
{Buschmann} {Frank} {F.} {} {}}{\edfont {\editorsname}}{\bibbtfont {Pattern
Languages of Program Design 3}\bibatsep\ }{}{} \apyformat {Addison
Wesley\bibbdsep {} 1998} \jbPages{5--18}} {\bibhowcited} \jbdoitem
{{Woolf}{Bobby}{B.}{}{}} {{Martin}{Robert}{R.}{}{}; {Riehle}{Dirk}{D.}{}{};
{Buschmann}{Frank}{F.}{}{}} {} \bibAnnoteFile {Wool98a}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,77 @@
% $Author$
% $Date$
% $Revision$
% --------------------------------------------
% Lulu:
% --------------------------------------------
% A4:
% \documentclass[a4paper,11pt,twoside]{book}
% \input{../common.tex}
% \usepackage{a4wide}
% --------------------------------------------
\graphicspath{{figures/} {../figures/}}
\renewcommand{\nnbb}[2]{} % Disable editorial comments
\sd{I would remove that section too}
The \emph{associating} method category contains a single method \ct{->}, which is used to create an \ct{Association} between a key (the receiver) and a value (the argument). An \ct{Array} of \ct{Associations} can be used to conveniently initialize a \ct{Dictionary}:
Dictionary newFrom: { #start -> (1@1) . #end -> (3@4) } --> a Dictionary(#end->3@4 #start->1@1 )
\ct{Object>>>-->} is an example of a \emph{Shortcut Constructor Method}\footnote{See: Kent Beck, \emph{Smalltalk Best Practice Patterns}, Prentice-Hall, 1997.}, which allows you to construct an object by sending a message to one of its constructor arguments. Shortcut Constructor Methods have the great advantage that they make object creation much more concise, but if abused they can clutter the receiver class with many methods unrelated to the key responsibilities of the class.
\sd{I do not like to talk about that here. I would remove that section. Add a note on the asString and printString difference}
Whenever it is possible in Smalltalk to convert an object from one class \ct{A} to be an instance of another class \ct{B}, this is usually accomplished by sending it a message of the form \ct{asB}. Of course, there is no magic, so this must be implemented at the appropriate level. There are a few such messages provided already by the class \ct{Object}. The most important are \ct{asString} and \ct{asOrderedCollection}.
Every object should have a \ct{String} representation. The default implementation is to return the \ct{printString} representation of the object. We will see this in more detail when we look at \ct{Object}'s \emph{printing} method category below.
"Answer a string that represents the receiver."
^ self printString
Object new --> an Object
The other standard conversion method is \ct{asOrderedCollection}:
"Answer an OrderedCollection with the receiver as its only element."
^ OrderedCollection with: self
1 asOrderedCollection --> an OrderedCollection(1)
Oops, something went wrong.

0 comments on commit 10edf02

Please sign in to comment.