Foreword
“Controllingcomplexityistheessenceofcomputerprogramming.”
—BrianKernighan
“Allproblemsincomputersciencecanbesolvedbyanotherlevelofindirection(abstraction).”
—DavidWheeler
Theprecedingtwoquotesbytwowellknowncomputerscientistsillustratetheproblem
facedbythemodernsoftwaredesigner—comingupwithagood,stable,reusable,flexible
solutiontoasoftwaredesignproblem.
Designpatternssolvetheprecedingproblemsinthemostelegantway.Designpatterns
abstractandpresentinneat,well-definedcomponentsandinterfacestheexperienceof
manysoftwaredesignersandarchitectsovermanyyearsofsolvingsimilarproblems.
Thesearesolutionsthathavewithstoodthetestoftimewithrespecttoreusability,
flexibility,scalability,andmaintainability.
Therehavebeenmanybooksondesignpatternswiththewell-knownGangofFour(GoF)
bookformingthecornerstoneofnearlytheentiredomain.
However,inthiseraofwebandmobilecomputing,whereprogramstendtogetwrittenin
high-levellanguagessuchasPython,Ruby,andClojure,thereisoftenaneedforbooks
thattranslatetheratheresotericlanguageusedinsuchbooksintomorefamiliarterms,
withreusablecodewritteninthesenewer,moredynamicprogramminglanguages.Thisis
especiallytruewhenitcomestonewbieprogrammerswhooftentendtogetlostinthe
complexitiesofdesignversusimplementationandoftenrequireanexperthelpinghand.
Thisbookfulfillsthatroleverywell.Itusesthetemplateofdesignpatternsaslaidoutin
theGoFbookandaddsafewothersaswellforcompletion—butbeforejumpingintothe
patternsitself,givestheyoungandinexperiencedreaderthefundamentalsofsoftware
designprinciplesthathavegoneintothethinkingbehindthecreationandevolutionof
thesedesignpatterns.Itdoesn’twalkthegentlereaderblindlyintothemazeofthepattern
world,butlaysoutthefundamentalswellbeforeopeningthatdoorandcarryingthereader
alongthatpathoflearning.
ThebookiswrittenwithPythonasthelanguageforimplementingthesamplecodeforthe
patterns—andthismakesexcellentsense.Assomeonewhohasspentmorethan12years
inthecompanyofthiswonderfulprogramminglanguage,Icanattesttoitsbeautyand
simplicityanditseffectivenessinsolvingproblemsrangingfromroutinetothemost
complex.Pythonisideallysuitedtotherookieandyoungprogrammer,andwiththeease
oflearningit,itisalsoalotoffuntocodein.Theyoungprogrammerwouldfindtheir
timespentinthecompanyofPythonalonginthisbookveryrewardingandfruitful.
ChetanGiridharhasbeenworkingandcontributingtoPythonforwellover7years.Heis
ideallysuitedforthejobofpenningabooklikethis,ashehasgonethroughsomeofthe
cyclesoflearningthecomplexitiesofimplementationanddesignhimselfandhaslearned