<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Book Reviews</title><link>http://forums.asp.net/58.aspx</link><description>Discuss your favorite ASP.NET books here. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=70&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Pro JavaScript Design Patterns by APress</title><link>http://forums.asp.net/thread/3192211.aspx</link><pubDate>Thu, 28 May 2009 04:03:21 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3192211</guid><dc:creator>rami_nassar</dc:creator><author>rami_nassar</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3192211.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=58&amp;PostID=3192211</wfw:commentRss><description>&lt;p&gt;thanks bmains&lt;/p&gt;</description></item><item><title>Pro JavaScript Design Patterns by APress</title><link>http://forums.asp.net/thread/3192055.aspx</link><pubDate>Thu, 28 May 2009 02:13:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3192055</guid><dc:creator>bmains</dc:creator><author>bmains</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3192055.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=58&amp;PostID=3192055</wfw:commentRss><description>&lt;p&gt;
 
  Normal
  0
  
  
  
  
  false
  false
  false
  
  EN-US
  X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  
   
   
   
   
   
   
   
   
   
   
   
  

 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 




 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:&amp;quot;Table Normal&amp;quot;;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:&amp;quot;&amp;quot;;
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;}



&lt;/p&gt;&lt;p class="MsoNormal"&gt;When you read the book, “Pro JavaScript Design Patterns”
from Ross Harmes and Dustin Diaz, it’s clear that Ross and Dustin have a strong
understanding of JavaScript, its strengths, and its limitations.&lt;span&gt;&amp;nbsp; &lt;/span&gt;JavaScript has a lot of stengths, in that it
supports dynamic typing at runtime, public and private typing of members,
flexible coding style , and existing support of class/object development.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Its weaknesses, such as support for other
constructs, like explicit namespaces or interface support, the writers attempt
to make up for by showing potential workarounds to the issue.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;The first three chapters setup some of the more complex
topics: flexibility and mutability of objects, dynamic typing, structuring of
classes and how to assign methods to an object’s prototype.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Another important subject is the
differentiation between public and private members, and how these members are
scoped and accessed in the class’s instance.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;Speaking of classes, there are a couple of different ways to
setup class definitions and inheritance.&lt;span&gt;&amp;nbsp;
&lt;/span&gt;The first option is prototypical inheritance, where the derived class
inherits the members of the base class.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Other
options are mixin classes, using a helper method to copy over class definitions
from one object to another.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This book,
with great detail, discusses the differences between the two options.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;The book continues to discuss the following design patterns,
and implements in full JavaScript.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The
concepts in the first four chapters, discussed above, are reused in the design
pattern process.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Each chapter
highlighted below has an explanation, example (or several), guide on when to
implement, pros, cons, and summary.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpFirst" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Singleton Pattern – While not following the
exact traditional pattern that you would see in other server-based environments,
like the .NET framework, the Singleton pattern implemented in JavaScript
provides a central accessible object to the application.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The book also covers the subject of lazy
instantiation and brancing of internal members (one example cited was to vary
method implementation by browser).&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Chaining – More commonly seen in the JQuery
library, chaining is the creation of a central object that gets returned from
every method call.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Within the prototype
of every (or at least most) method is a call to return that same object.&lt;span&gt;&amp;nbsp; &lt;/span&gt;This way, the object can call one method
after the other, after the other, in a more convenient fashion.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Factory Pattern – The factory pattern provides a
way to create the correct object using some sort of identifier (string, enum,
object, etc.).&lt;span&gt;&amp;nbsp; &lt;/span&gt;The factory pattern
instantiates an object that inherits from the same base class type, and thus
the factory is responsible for its instantiation.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Bridge Pattern – This pattern bridges multiple
classes together that implement a similar functionality.&lt;span&gt;&amp;nbsp; &lt;/span&gt;It’s a way to break out logical components
into different objects, and follow more closely the Singular Responsibility
pattern. &lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Composite Pattern – This pattern requires that a
particular set of objects all implement the same interface,regardless of whether
a specific function is used within that object or not.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The pattern is made up of leaf elements
(elements at the bottom of the structure), and composite elements (which have
one or more composite/leaf elements).&lt;span&gt;&amp;nbsp;
&lt;/span&gt;The example used to illustrate this pattern is displaying of individual
elements (textboxes and such), versus displaying composite elements.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Façade Pattern – The façade pattern simplifies
common tasks by grouping them into a parent function.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For example, there are various nuances in
JavaScript that vary by browser.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The
façade pattern facilitates working around these nuances by creating a central
object with a method that checks browser type, and calls the correct
method.&lt;span&gt;&amp;nbsp; &lt;/span&gt;From then on, the developer has
to call this one method, instead of handling the various JavaScript nuances.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Adapter Pattern – The adapter pattern provides a
common interface across disparate interfaces that provide differing
implementations.&lt;span&gt;&amp;nbsp; &lt;/span&gt;For instance, suppose
you had to integrate various web service implementations.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Each implementation would have a different
implementation; the adapter pattern can accommodate this by providing one
common interface, which this object then interacts with the web service.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Decorator Pattern – The decorator pattern can be
used to modify the behavior of its target.&lt;span&gt;&amp;nbsp;
&lt;/span&gt;Decorators can be strung together to continually alter its behavior in
some way, providing that each decorator alters the object appropriately.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The chapter also explains what to watch out
for when implementing this pattern, such as the order the patterns are created
and processed.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Flyweight Pattern – This pattern provides a
caching to reuse commonly used elements, to make the underlying processes run
faster.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The system would first check the
cache to see if the object exists before instantiating it.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Proxy Pattern – A proxy provides access control
to its underlying object’s methods calls.&lt;span&gt;&amp;nbsp;
&lt;/span&gt;It implements the same methods as its target, and can be a way to
optimize usage of resources (especially expensive ones).&lt;span&gt;&amp;nbsp; &lt;/span&gt;This isn’t necessarily related to just
security in this regard.&lt;span&gt;&amp;nbsp; &lt;/span&gt;There are three
types of proxies: virtual proxy, remote proxy, and protection proxy.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Observer Pattern – The observer pattern uses
subscribers and publishers.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The
publisher publishes to its subscriber that some event happened, and the
subscriber can react to it in some way.&lt;span&gt;&amp;nbsp;
&lt;/span&gt;One approach is through the use of a delegate that the publisher can
call.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Command Pattern – A command is some action that
occurs within the application.&lt;span&gt;&amp;nbsp; &lt;/span&gt;A command
provides a specific interface that varying command objects implement.&lt;span&gt;&amp;nbsp; &lt;/span&gt;The command can then be executed and perform
its underlying action: this may be copy, paste, undo, or other operations.&lt;/p&gt;

&lt;p class="MsoListParagraphCxSpLast" style="text-indent:-0.25in;"&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;·&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-size-adjust:none;font-stretch:normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Chain of Responsibility Pattern – The chain of
responsibility pattern is similar to some of the above patterns: it uses a
chaining approach, which consists of firstly the sender, followed by a series
of receivers that will process or ignore the request. It’s a complex design
pattern that the book describes very well.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;Most of the chapters are explained very well; some of the
examples didn’t make the most sense to me as I didn’t fully grasp some of the
patterns.&lt;span&gt;&amp;nbsp; &lt;/span&gt;It’s clear the authors know a
lot more about design patterns than I do.&lt;span&gt;&amp;nbsp;
&lt;/span&gt;However, don’t let that detract you from the book because reading it
again and trying it out yourself will help you to grasp the fundamentals.&lt;span&gt;&amp;nbsp; &lt;/span&gt;Alternatively, most of the examples are
clear, concise, and to the topic at hand.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;The book is a small book, consisting of many chapters
(nicely broken out so I was able to do one a day).&lt;span&gt;&amp;nbsp; &lt;/span&gt;It has a lot of power to the punch for its
size, which makes it a great book, and a great overview of design patterns in
the JavaScript world, a world much different than most server-based languages.&lt;/p&gt;</description></item></channel></rss>