<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>OOP and Design Patterns @ timstall.dotnetdevelopersjournal.com</title><link>http://timstall.dotnetdevelopersjournal.com/</link><description>(OOP and Design Patterns) </description><copyright>Copyright 2008 timstall.dotnetdevelopersjournal.com</copyright><generator></generator><lastBuildDate>Sat, 06 Sep 2008 21:21:00 GMT</lastBuildDate><image><title>OOP and Design Patterns @ timstall.dotnetdevelopersjournal.com</title><url>http://res.sys-con.com/portlet/163/featured-blog-graphic-145.gif</url><link>http://timstall.dotnetdevelopersjournal.com/</link></image><ttl>360</ttl><docs>http://backend.userland.com/rss</docs><item><title>Enterprise Library Tips for Strong Names and Versions</title><guid isPermaLink="true">http://timstall.dotnetdevelopersjournal.com/enterprise_library_tips_for_strong_names_and_versions.htm</guid><link>http://timstall.dotnetdevelopersjournal.com/enterprise_library_tips_for_strong_names_and_versions.htm</link><pubDate>Fri, 24 Jun 2005 02:30:00 GMT</pubDate><comments>http://timstall.dotnetdevelopersjournal.com/console/comments/popup/?f=enterprise%5Flibrary%5Ftips%5Ffor%5Fstrong%5Fnames%5Fand%5Fversions</comments><dc:creator>Tim Stall</dc:creator><description><![CDATA[<p>Previously I offered some tips for <a href="/enterprise_library_tips_for_configuration.htm">configuring Enterprise Library</a>. Today I'll discuss another problematic area - adding strong names.</p><p>First, this builds on concepts about <a href="/strong_names_and_publickeytokens.htm">Strong Names and PublicKeyTokens</a>.  You may need to add a strong name to the EntLib blocks if you include it in a project that already uses strong names (because this requires that all assemblies being referenced also have strong names).</p><p>To add a strong name, you'll need to create a key and reference it in the AssemblyInfo.cs file.</p><p><b>Strong Names and Versioning Tips</b></p><p>0 - You will need to add the key to the source code. Microsoft gives us the source code partially so that we can do things like this.</p><p>1 - Put properties (like strong-naming) in the GlobalAssemblyInfo.cs. This requires you to remove (or comment out) the key from the other 38 AssemblyInfo files, however it lets you change it in one place.</p><p>2 - Note that there are <b>two</b> places that DLLs are stored.</p><ul><li>C:\Program Files\Microsoft Enterprise Library\bin</li><li>C:\Program Files\Microsoft Enterprise Library\src\&lt;variousFolder&gt;\bin</li></ul><p>Opening the EntLib solution and compiling creates copies in the \src dir. You still need to copy these to the \bin<br />Make sure to run the &quot;Copy Assemblies to Bin Directory&quot; script included in the EntLib start menu. If you're not putting DLLs in the GAC,  EntLib's config tool pulls DLLs from the \bin dir. So you'll notice strong-name nightmares if you don't do this. It will set the assembly name (like PublicKeyToken) from those DLLs, not merely the ones used in your project. For example, check the version of the DLLs loaded by the config tool, and make sure that they include the strong name.</p>]]></description></item><item><title>Enterprise Library Tips for Configuration</title><guid isPermaLink="true">http://timstall.dotnetdevelopersjournal.com/enterprise_library_tips_for_configuration.htm</guid><link>http://timstall.dotnetdevelopersjournal.com/enterprise_library_tips_for_configuration.htm</link><pubDate>Tue, 21 Jun 2005 03:09:00 GMT</pubDate><comments>http://timstall.dotnetdevelopersjournal.com/console/comments/popup/?f=enterprise%5Flibrary%5Ftips%5Ffor%5Fconfiguration</comments><dc:creator>Tim Stall</dc:creator><description><![CDATA[<p>Enterprise Library is Microsoft's next generation of Application Blocks. It's a free, integrated suite of common architectural components that your project probably needs. It has several good perks:</p><ul><li>Includes all source code</li><li>An auto-config tool to handle the Xml config files.</li><li>38 projects of well written code - i.e. a good example to learn from</li><li>Full documentation</li><li>A huge community supporting it.</li></ul><p>You can <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlib.asp">download it here</a>. Be sure to check the official blogs:</p><ul><li><a href="http://blogs.msdn.com/tomholl/default.aspx">Tom Hollander</a></li><li><a href="http://blogs.msdn.com/scottdensmore/default.aspx">Scott Densmore</a></li></ul><p>When I first was playing around with it, I had trouble with creating strong names and config files.</p><p><b>Configuration Tips</b></p><p>1. A single application can have multiple physical config files:</p><ul><li>CachingQuickStart.exe.config (app)</li><li>cachingConfiguration.config (other block)</li><li>dataconfiguration.config (other block)</li></ul><p>Furthermore, you'll need to make sure that the correct file is copied to the app's bin. Merely rebuilding or using EntLib's config tool doesn't copy all configs.</p><p>2 - For the data access block config, you'll need to set both the connection string as well as the individual params. Config looks like:</p><table id="AutoNumber3" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" bordercolor="#111111" cellpadding="2" width="100%" border="1"><tbody><tr><td style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-BOTTOM: medium none" width="100%"><blockquote><p><font face="Courier New" size="2">&lt;connectionString name=&quot;Data Source=localhost;Initial Catalog=Caching;Integrated Security=SSPI;&quot;&gt;<br />    &lt;parameters&gt;<br />        &lt;parameter name=&quot;Database&quot; value=&quot;Caching&quot; isSensitive=&quot;false&quot; /&gt;<br />        &lt;parameter name=&quot;Integrated Security&quot; value=&quot;True&quot; isSensitive=&quot;false&quot; /&gt;<br />        &lt;parameter name=&quot;Server&quot; value=&quot;localhost&quot; isSensitive=&quot;false&quot; /&gt;<br />    &lt;/parameters&gt;<br />&lt;/connectionString&gt;</font></p></blockquote></td></tr></tbody></table><p>3 - For the Caching Block's Data Provider:</p><ul><li>&quot;PartitionName&quot; does not correspond to actual database partitions, but rather a value in the Caching.CachData.PartitionName column. This means that you don't need to create a DB partition for the DB cache to work.</li><li>Make sure that you run the script to create the Caching DB ('Caching').</li><li>Make sure that user has access to the 'Caching' database, and can insert into the CacheData table. Merely running the create script doesn't provide access to custom users.</li></ul><p>4 - For the Caching Block's Isolated Storage, this uses <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemioisolatedstorage.asp">System.IO.IsolatedStorage</a>. You do not provide a physical file path name. Partition Name is a folder name like &quot;MyApp&quot;.</p><p>I'll discuss Strong Names in my next post.</p>]]></description></item><item><title>Method and Constructor Calling Order in OOP</title><guid isPermaLink="true">http://timstall.dotnetdevelopersjournal.com/method_and_constructor_calling_order_in_oop.htm</guid><link>http://timstall.dotnetdevelopersjournal.com/method_and_constructor_calling_order_in_oop.htm</link><pubDate>Mon, 21 Mar 2005 17:17:00 GMT</pubDate><comments>http://timstall.dotnetdevelopersjournal.com/console/comments/popup/?f=method%5Fand%5Fconstructor%5Fcalling%5Forder%5Fin%5Foop</comments><dc:creator>Tim Stall</dc:creator><description><![CDATA[<p>I'm starting OOP in my C# class, and one of the issues to explain is the order that methods and constructors are called for inherited objects. People with a vague idea of inheritance know that one object (derived) can inherit another (base), where the derived object can reuse parts of the base. However, the behavior of the objects depends on what order the members are called in. Given a base and derived object, we want to know the code flow if the derived <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_10_10.asp">constructor</a> or <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_10_5.asp">method</a> is called. </p><p>For constructors, the base member is always called first. For methods, the question is really not-applicable because when there is a base and derived method both with the same name, the base member is only called if the the developer explicitly calls it with the base keyword. Let's flush this out.</p><p><b>Constructors</b></p><p>Given the classes:</p><table id="AutoNumber3" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" bordercolor="#111111" height="517" cellpadding="2" width="100%" border="1"><tbody><tr><td style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-BOTTOM: medium none" width="100%" height="511"><blockquote><p><span id="output"><font size="2"><font face="courier new,courier,monospace"><span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">class</font></span> MyBase<br />{<br />    <span class="kwrd"><font color="#0000ff">public</font></span> MyBase()<br />    {<br />        Console.WriteLine(<span class="str"><font color="#006080">&quot;Mybase()&quot;</font></span>);<br />    }<br />}</font></font></span></p><p><span id="output"><font size="2"><font face="courier new,courier,monospace"><span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">class</font></span> MyDerived : MyBase<br />{<br />    <span class="kwrd"><font color="#0000ff">public</font></span> MyDerived()<br />    {<br />        Console.WriteLine(<span class="str"><font color="#006080">&quot;MyDerived()&quot;</font></span>);<br />    }<br /><br />    <span class="kwrd"><font color="#0000ff">public</font></span> MyDerived(<span class="kwrd"><font color="#0000ff">string</font></span> strName)<br />    {<br />        Console.WriteLine(<span class="str"><font color="#006080">&quot;MyDerived(string strName)&quot;</font></span>);<br />    }<br /><br />    <span class="kwrd"><font color="#0000ff">public</font></span> MyDerived(<span class="kwrd"><font color="#0000ff">string</font></span> strName, <span class="kwrd"><font color="#0000ff">int</font></span> intId) : <span class="kwrd"><font color="#0000ff">this</font></span>(strName)<br />    {<br />        Console.WriteLine(<span class="str"><font color="#006080">&quot;MyDerived(string strName, int intId)&quot;</font></span>);<br />    }<br /><br />}</font></font></span></p></blockquote></td></tr></tbody></table><p>Running MyDerived d = new MyDerived(&quot;name&quot;,5); will display:</p><p>Mybase()<br />MyDerived(string strName)<br />MyDerived(string strName, int intId)</p><p>As we walk through with the debugger, before executing any code, it will start at the overloaded MyDerived and walk down to the MyBase constructor. Once there, it executes the base constructor and walks back up to the calling point - executing MyDerived(string), and fthen finally MyDerived(string,int). </p><p>This makes sense - the base object should be instantiated first because we need to build the individual parts before building the whole.</p><p><b>Methods</b></p><p>Given that base class constructors are executed, many people subconsciously think that in cases where the base and derived methods have the same name, that base methods are executed too. However, this only occurs if the developer explicitly makes it that way, by using the &quot;base&quot; keyword (note that the derived can only call the immediate base, i.e. base.base would return an error):</p><table id="AutoNumber3" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" bordercolor="#111111" cellpadding="2" width="100%" border="1"><tbody><tr><td style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-BOTTOM: medium none" width="100%"><blockquote><p><span id="output"><font size="2"><font face="courier new,courier,monospace"><span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">new</font></span> <span class="kwrd"><font color="#0000ff">void</font></span> MyMethod(<span class="kwrd"><font color="#0000ff">string</font></span> strName) <br />{<br />    <span class="kwrd"><font color="#0000ff">base</font></span>.MyMethod(strName);<br />}</font></font></span></p></blockquote></td></tr></tbody></table><p>If &quot;base.MyMethod(strName)&quot; is omitted, then MyMethod will not be called - not with inheritance, polymorphism, or anything else. As we look at the keywords used in OOP, we see that this makes sense in each individual case:</p><table id="AutoNumber4" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellpadding="2" width="98%" border="1"><tbody><tr><td width="24%" bgcolor="#ffffcc"><b><font size="2">Base Method: Virtual/Abstract</font></b></td><td width="25%" bgcolor="#ffffcc"><b><font size="2">Derived Method: Override/New</font></b></td><td width="50%" bgcolor="#ffffcc"><b><font size="2">Result for calling Derived Method</font></b></td></tr><tr><td width="24%"><font size="2">virtual</font></td><td width="25%"><font size="2">override</font></td><td width="51%"><font size="2">Only current method is called.</font></td></tr><tr><td width="24%"><font size="2">abstract</font></td><td width="25%"><font size="2">override</font></td><td width="51%"><font size="2">Nothing to call (abstract has no implementation)</font></td></tr><tr><td width="24%"><font size="2">- (no keyword)</font></td><td width="25%"><font size="2">new</font></td><td width="51%"><font size="2">new keyword hides base, therefore base won't be called by the very nature of what this keyword does.</font></td></tr></tbody></table><p> </p>]]></description></item><item><title>Tips with OOP - New, Virtual, and Abstract</title><guid isPermaLink="true">http://timstall.dotnetdevelopersjournal.com/tips_with_oop__new_virtual_and_abstract.htm</guid><link>http://timstall.dotnetdevelopersjournal.com/tips_with_oop__new_virtual_and_abstract.htm</link><pubDate>Thu, 24 Feb 2005 16:29:00 GMT</pubDate><comments>http://timstall.dotnetdevelopersjournal.com/console/comments/popup/?f=tips%5Fwith%5Foop%5F%5Fnew%5Fvirtual%5Fand%5Fabstract</comments><dc:creator>Tim Stall</dc:creator><description><![CDATA[<p>As I prepare to teach a C# class, I've being looking at ways to explain and clarify certain Object Oriented Programming (OOP) concepts. I find that while a lot of people are familiar with the terms, the specifics always seem confusing. Two questions I often hear are:</p><ol><li>What is the difference between using virtual/override and new?</li><li>What is the difference between virtual and abstract?</li></ol><p>While there are certainly smarter people then myself who have thoroughly explained every inch of OOP, I'll give it my two cents anyway. (For those interested in other resources, I personally like <a href="http://www.deitel.com/">Deitel</a> and <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/CSharpSpecStart.asp">Microsoft's C# Spec</a>).</p><p><b>What is the difference between using virtual and new?</b></p><p>The <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfvirtualpg.asp">Virtual</a> keyword (used in the base class) lets a method be overridden (by using override in the derived class) such that if you declare an object of a base type, and instantiate it of a derived type, then calling the virtual method will call the derived type's method, not the base type. This is <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconimplementinginterfacesincomponents.asp">polymorphism</a>. </p><p>The <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfnewoppg.asp">new</a> keyword (used in the derived class) lets you hide the implementation of a base method such that when you declare and instantiate an object of the same type, the method of that type is called. There is no polymorphism here.</p><p>I think the best way to explain this is via a code sample that shows the different effects of using virtual vs. new. Say you have the following two classes:</p><table id="AutoNumber3" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" bordercolor="#111111" cellpadding="2" width="100%" border="1"><tbody><tr><td style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-BOTTOM: medium none" width="100%"><blockquote><p><span id="output"><font face="courier new,courier,monospace" size="2">    <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">class</font></span> MyBase <br />    {<br />        <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">virtual</font></span> <span class="kwrd"><font color="#0000ff">string</font></span> MyVirtualMethod() <br />        {<br />            <span class="kwrd"><font color="#0000ff">return</font></span> <span class="str"><font color="#006080">&quot;Base&quot;</font></span>;<br />        }<br /><br />        <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">string</font></span> MyNonVirtualMethod() <br />        {<br />            <span class="kwrd"><font color="#0000ff">return</font></span> <span class="str"><font color="#006080">&quot;Base&quot;</font></span>;<br />        }<br />    } //end of sub class<br /><br />    <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">class</font></span> MyDerived : MyBase<br />    {<br />        <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">override</font></span> <span class="kwrd"><font color="#0000ff">string</font></span> MyVirtualMethod()<br />        {<br />            <span class="kwrd"><font color="#0000ff">return</font></span> <span class="str"><font color="#006080">&quot;Derived&quot;</font></span>;<br />        }<br /><br />        <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">new</font></span> <span class="kwrd"><font color="#0000ff">string</font></span> MyNonVirtualMethod()<br />        {<br />            <span class="kwrd"><font color="#0000ff">return</font></span> <span class="str"><font color="#006080">&quot;Derived&quot;</font></span>;<br />        }<br />    } //end of sub class</font></span></p></blockquote></td></tr></tbody></table><p>This has two classes, MyBase and MyDerived. For illustration, the classes each only have two methods. For comparison, MyBase has one method virtual, and one not. Likewise, MyDerived overrides the virtual method and hides the non-virtual. The following code snippet shows three separate cases. Note that the virtual-new keywords affect the value of MyNonVirtualMethod based on whether the object is declared as type MyBase or MyDerived.</p><table id="AutoNumber3" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" bordercolor="#111111" cellpadding="2" width="100%" border="1"><tbody><tr><td style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-BOTTOM: medium none" width="100%"><blockquote><p><span id="output"><font size="2"><font face="courier new,courier,monospace"><b>MyBase</b> m1 = <span class="kwrd"><font color="#0000ff">new</font></span> MyDerived();<br />Console.WriteLine(<span class="str"><font color="#006080">&quot;MyVirtualMethod='&quot;</font></span> + m1.MyVirtualMethod() + <span class="str"><font color="#006080">&quot;', MyNonVirtualMethod='&quot;</font></span> + m1.MyNonVirtualMethod() + <span class="str"><font color="#006080">&quot;'&quot;</font></span>);<br /></font></font><font size="2"><font face="courier new,courier,monospace"><font color="#008000"><span class="rem">//    Returns: MyVirtualMethod='Derived', MyNonVirtualMethod='<b>Base</b>'</span><br /><br /></font><b>MyDerived</b> md = <span class="kwrd"><font color="#0000ff">new</font></span> MyDerived();<br />Console.WriteLine(<span class="str"><font color="#006080">&quot;MyVirtualMethod='&quot;</font></span> + md.MyVirtualMethod() + <span class="str"><font color="#006080">&quot;', MyNonVirtualMethod='&quot;</font></span> + md.MyNonVirtualMethod() + <span class="str"><font color="#006080">&quot;'&quot;</font></span>);<br /><span class="rem"><font color="#008000">//    Returns: MyVirtualMethod='Derived', MyNonVirtualMethod='<b>Derived'</b></font></span></font></font></span></p></blockquote></td></tr></tbody></table><p>Note that in the first case, where we declare the object of type MyBase yet instantiate it to type MyDerived, calling MyNonVirtual method is called on the declared type. In the second case, it is called on the Instantiated type.</p><p>These concepts are very common when declaring an array of base objects, and then cycling through the array and calling virtual members. A classic example is making an array of Shape objects, calling the GetArea() method on each one, and it correctly returning the area for that shape.</p><p><b>What is the difference between virtual and abstract?</b></p><p>These two keywords are sometimes confused because both can be over-ridden. However, unlike Virtual members, <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfabstract.asp">Abstract</a> members have no implementation. As Deitel puts it, &quot;Abstract base classes are too generic to define real world objects&quot; (C# How to Program, pg 392). The Abstract keyword can be applied to either members or the class as a whole. Note that if a class has an abstract member, then that class must itself be abstract (There is no such thing as a &quot;virtual&quot; class). </p><p>In the following code snippet below (from Deitel, pg. 394), the abstract class shape has two virtual methods: Area and Double, and one abstract property Name. Note that both virtual members have a concrete implementation. If you create a derived class &quot;Point&quot;, and call its Area method, it will return 0.</p><table id="AutoNumber3" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px" bordercolor="#111111" cellpadding="2" width="100%" border="1"><tbody><tr><td style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-BOTTOM: medium none" width="100%"><blockquote><p><span id="output"><font size="2"><font face="courier new,courier,monospace"><span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">abstract</font></span> <span class="kwrd"><font color="#0000ff">class</font></span> Shape <br />{<br />    <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">virtual</font></span> <span class="kwrd"><font color="#0000ff">double</font></span> Area() <br />    {<br />        <span class="kwrd"><font color="#0000ff">return</font></span> 0;<br />    }<br /><br />    <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">virtual</font></span> <span class="kwrd"><font color="#0000ff">double</font></span> Volume() <br />    {<br />        <span class="kwrd"><font color="#0000ff">return</font></span> 0;<br />    }<br /><br />    <span class="kwrd"><font color="#0000ff">public</font></span> <span class="kwrd"><font color="#0000ff">abstract</font></span> <span class="kwrd"><font color="#0000ff">string</font></span> Name<br />    {<br />        get;<br />    }<br />}</font></font></span></p></blockquote></td></tr></tbody></table><p>The following table highlights these differences:</p><table id="AutoNumber4" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellpadding="2" width="100%" border="1"><tbody><tr><td width="33%" bgcolor="#ffffcc"> </td><td width="33%" bgcolor="#ffffcc"><b><font size="2">Virtual</font></b></td><td width="34%" bgcolor="#ffffcc"><b><font size="2">Abstract</font></b></td></tr><tr><td valign="top" width="33%"><font size="2">Has implementation</font></td><td valign="top" width="33%"><font size="2">Yes</font></td><td valign="top" width="34%"><font size="2">No</font></td></tr><tr><td valign="top" width="33%"><font size="2">Scope</font></td><td valign="top" width="33%"><font size="2">members only</font></td><td valign="top" width="34%"><font size="2">members and classes</font></td></tr><tr><td valign="top" width="33%"><font size="2">Can create an instance of</font></td><td valign="top" width="33%"><font size="2">Not Applicable (you can only create instances of classes, not members)</font></td><td valign="top" width="34%"><font size="2">No - but you can create an instance of a class that derives from an abstract class. And you can declare a type Abstract class and instantiate that as a derived class.</font></td></tr></tbody></table><p>Common Abstract classes in the .Net framework include <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlnodeclasstopic.asp">System.Xml.XmlNode</a> and <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiostreamclasstopic.asp">System.IO.Stream</a>. Perhaps the most common virtual method is <a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemobjectclasstostringtopic.asp">System.Object.ToString()</a>.</p>]]></description></item><item><title>Design Patterns</title><guid isPermaLink="true">http://timstall.dotnetdevelopersjournal.com/design_patterns.htm</guid><link>http://timstall.dotnetdevelopersjournal.com/design_patterns.htm</link><pubDate>Tue, 01 Feb 2005 14:39:00 GMT</pubDate><comments>http://timstall.dotnetdevelopersjournal.com/console/comments/popup/?f=design%5Fpatterns</comments><dc:creator>Tim Stall</dc:creator><description><![CDATA[<p>&quot;Design patterns are recurring solutions to software design problems you find again and again in real-world application development.&quot; (<a href="http://www.dofactory.com">www.dofactory.com</a>). Using design patterns in your code provides structure, good practice, familiarity for other developers, and greater confidence that you’re doing it &quot;the right way&quot;.</p><p>In my experience, many .Net developers have never needed to consciously use patterns because .Net is simple yet powerful enough to get away with it. However, as clients demand better applications, design patterns are becoming almost required.</p><p>The groundwork for design patterns is the 23 described in <em>Design Patterns: Elements of Reusable Object-Oriented Software</em> by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (the &quot;Gang of Four&quot; GOF). data &amp; object factory provides a convenient, online, C#, reference for these on their website: <a href="http://www.dofactory.com/Patterns/Patterns.aspx">http://www.dofactory.com/Patterns/Patterns.aspx</a>. Steven John Metsker also wrote the book <em>Design Patterns in C#</em>, which covers these standard patterns using C#.</p><p>Moving beyond the GOF patterns, Microsoft’s Architecture website provides many enterprise patterns for enterprise applications: <a href="http://msdn.microsoft.com/architecture/patterns/default.aspx?pull=/library/en-us/dnpatterns/html/ESP.asp">http://msdn.microsoft.com/architecture/patterns/default.aspx?pull=/library/en-us/dnpatterns/html/ESP.asp</a></p><p>The more I use patterns, the more I like them.<br /></p>]]></description></item></channel></rss>