View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 2 - Patrick Jarrett

Part 1:
How does choice of language affect the use of design patterns?

To state the obvious, language choice affects design patterns through the abilities and strengths of that language. You wouldn’t use Java for an air-traffic control system, and you wouldn’t use Pascal for any modern desktop programs. But past what you wouldn’t use them for, when given the option of Java or Python, there are many reasons you would use one over another. Java provides cross platform compatibility. Python provides ease of programming for the programmer.

The reason different programming languages exist is that they are meant to fulfill someone’s need or someone’s desire in a programming language. No 2 programming languages are exactly alike. Among the differences in languages are things from the handling of variables and garbage collection, functions, object oriented language, or even macros from Lisp.

These all affect the design patterns because they affect how the program can be done in the language. If I know Java will handle the garbage collection for me, I won’t write a cleanup routine. If Smalltalk needs it initialized a certain way, I work around that need.


Part 2:
http://www.fluffycat.com/java/JavaNotes-GoFSingleton.html

This is a design which shows how an object can distribute itself, not copies of itself, but itself. It has controls to check availability before changing its location. It also works for multiple spoons through the use of an array. One thing they note in the design notes is that this design is not safe for threads.

Looking through the code it all makes sense, in fact it makes a scary amount of sense. It’s so simple I don’t know if I ever would have thought of it.

Links to this Page