Immediate, Immutable, Singleton etc

I’ve heard these terms used in various places, just wondering where I
can find
out more about what they mean and how knowing about them can help my
programming

Gareth A. wrote:

I’ve heard these terms used in various places, just wondering where I can find
out more about what they mean and how knowing about them can help my programming

Hmm, generally the GOF[1] book is quite good on these things - it is
considered the Pickaxe of code design, so to say (although is more than
10 years old). Immutable is very well explained in Effective Java[2] -
however if you won’t like to study Java I don’t recommend this, it just
crossed my mind because I have seen it there recently (OTOH, if you
would like to learn Java idioms it is a cool book).
This page[3] also has some nice links to get you started…

If you are interested in a concrete thing, just google for it, and try
to add ‘design pattern’ or ‘pattern’, e.g.the combination ‘immutable
design pattern’ gives good results.

HTH,
Peter

[1]
http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612
[2]
http://www.amazon.com/Effective-Java-Programming-Language-Guide/dp/0201310058/sr=1-1/qid=1163509093/ref=pd_bbs_sr_1/002-5512879-9475208?ie=UTF8&s=books
also available online for free, just google for it
[3] http://hillside.net/patterns/onlinepatterncatalog.htm

__
http://www.rubyrailways.com

also available online for free, just google for it
Sorry, it’s the GOF book that can be found on the web, not Joshua Bloch

Peter

__
http://www.rubyrailways.com

Peter S. wrote:

Gareth A. wrote:

I’ve heard these terms used in various places, just wondering where I
can find
out more about what they mean and how knowing about them can help my
programming

Hmm, generally the GOF[1] book is quite good on these things - it is
considered the Pickaxe of code design, so to say (although is more than
10 years old).

http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612

GoF doesn’t teach code design. It documents design patterns. It’s most
useful to experienced software developers or architects who need a
common language describe concepts with which they are already familiar.
It’s also somewhat tied to a particular style of code design,

Gareth A. wrote:

I’ve heard these terms used in various places, just wondering where I
can find
out more about what they mean and how knowing about them can help my
programming

Gareth,

Immutable: the String class in Java is immutable meaning that it can’t
be changed once created. If ever you do an operation on a string in
java, a new instance is created so as to leave the original alone.
This behaviour allows strings to be passed everywhere and have countless
references to it without worrying about the underlying object changing
in any way. Strings in ruby are not immutable meaning that you can do
such things as val[1]=‘g’

Singleton: This is a gof pattern meanting that you can have exactly one
instance of an object. It’s used extensively as a manager over a
critical resource that that must be shared by a number of components
within a system such as a data source factory, or a transaction manager.
It has many other uses as well however and is arguably the best
understood gof pattern. As was mentioned earlier, the GoF book is an
excellent resource no matter what language you are using.

Immediate: I have no idea, perhaps you overheard this in the morning: “I
need a coffee immediately!” which is only indirectly related to coding
in general. :slight_smile:

There are always new terms coming out so don’t think twice about asking.
I have no qualms about looking like a newb if I can get an answer that
will allow me to do my job… :slight_smile: google should be your best friend as
well…

ilan

On Nov 14, 2006, at 10:26 AM, Ilan B. wrote:

Singleton: This is a gof pattern meanting that you can have exactly
one
instance of an object.

This term is often used with Ruby in a different manner. In Ruby a
“singleton method” is a method added to an individual object:

normal = (1…5).to_a
=> [1, 2, 3, 4, 5]

special = normal.dup
=> [1, 2, 3, 4, 5]

class << special
def shuffle!
replace(sort_by { rand })
end
end
=> nil

special.shuffle!
=> [5, 1, 4, 2, 3]

normal.shuffle!
NoMethodError: undefined method `shuffle!’ for [1, 2, 3, 4, 5]:Array
from (irb):10

Ruby does also have an implementation of the GoF pattern though, in
the singleton standard library.

James Edward G. II