<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3318182078195283600</atom:id><lastBuildDate>Fri, 22 Apr 2011 02:02:44 +0000</lastBuildDate><category>A.I.</category><category>C#</category><category>Introduction</category><category>Events Programming</category><category>Intermediate</category><category>Beginners</category><category>Prolog</category><category>Useful Links</category><category>Dot Net</category><category>Blog</category><category>Tutorials</category><category>LISP</category><title>Notebook on Programming</title><description>PLNotebook is a blog on programming and programming languages. It includes diverse articles on the topic including reviews of sites and software projects, code samples, tutorials, articles, ideas, tips and tricks and more.</description><link>http://plnotebook.blogspot.com/</link><managingEditor>noreply@blogger.com (VC)</managingEditor><generator>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/NotebookOnProgramming" /><feedburner:info uri="notebookonprogramming" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-sa/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-5322464059130216939</guid><pubDate>Tue, 22 Jul 2008 20:48:00 +0000</pubDate><atom:updated>2008-07-22T23:48:51.763+03:00</atom:updated><title>Decide the Accessibility of Class Members in C Sharp</title><description>Another article in wikiHow ...&lt;br /&gt;&lt;a style="font-weight: bold;" href="http://www.wikihow.com/Decide-the-Accessibility-of-Class-Members-in-C-Sharp"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.wikihow.com/Main-Page"&gt;&lt;img src="http://www.wikihow.com/skins/WikiHow/wikiHow.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;h1 style="margin-bottom: 0px;"&gt;&lt;a href="http://www.wikihow.com/Decide-the-Accessibility-of-Class-Members-in-C-Sharp"&gt;How to Decide the Accessibility of Class Members in C Sharp&lt;/a&gt;&lt;/h1&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;from &lt;a href="http://www.wikihow.com/Main-Page"&gt;wikiHow - The How to Manual That You Can Edit&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 153);"&gt;O&lt;/span&gt;ne of the choices you always make as a C# programmer is to decide the accessibility of each member (field, event, property and method) you declare in your classes. For advanced C# programmers, this is not actually really hard, but it can be pretty destructive for new to intermediate C# programmers, and seldom, even to advanced one. This article outlines the process of deciding the accessibility of your members in a systematic, easy to remember and straightforward approach.&lt;br /&gt;&lt;a name="Steps"&gt;&lt;/a&gt;&lt;h2&gt;  Steps &lt;/h2&gt;&lt;ol&gt;&lt;li&gt; Design and implement your members as if you have already decided their accessibility level (usually this is done by implementing all members as public)&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Start deciding the accessibility of each member by itself repeating the following steps on all members:&lt;br /&gt;&lt;ol&gt;&lt;li&gt; Start by giving the member the lowest accessibility possible: (private)&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Answer the following questions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Will any existing code in your application or solution be affected by declaring the member on this accessibility level? For example, some other class might have code that accesses this member or uses it and because of the current level of accessibility chosen, it won't be able to access it anymore.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Is your member designed to be used by other developers, and if so, will they be able to access it in its current accessibility level?&lt;br /&gt;&lt;/li&gt;&lt;li&gt; In your future code, will changing the accessibility of this member be near impossible?&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Is your class intended to be inherited, and if so, will the inheriting class face troubles accessing this member (if it is allowed to)?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Check if the answers to all the previous questions were "no" or not.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; If the answers were all "no", leave the accessibility level as it is and start deciding the accessibility of another member&lt;br /&gt;&lt;/li&gt;&lt;li&gt; If one or more of the answers was "yes", increase the level of accessibility one degree and repeat the steps for the same member, from step 2&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;a name="Tips"&gt;&lt;/a&gt;&lt;h2&gt;  Tips &lt;/h2&gt;&lt;ul&gt;&lt;li&gt; Stick to this approach until you find that more than 90% of your decisions without using this approach match the results obtained by applying this approach, then you can start counting more on your own initial judgment.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; When you become more and more familiar with programming in C#, many standard choices become obvious and they do not need a method to be decided. Hence, you start applying this approach only to those member you doubt or not included in any standard.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Even for advanced programmers, this approach can be helpful when used while skimming through your code in the final stages. It might catch some member declared using a higher accessibility than actually required even if that happened by chance or as a result of a typing error.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Some of the standard accessibility levels that became well established amongst C# programmers are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Fields are usually declared private in &lt;i&gt;struct&lt;/i&gt;s and &lt;i&gt;sealed&lt;/i&gt; classes and as protected in most other classes (unless you do not intend to inherit the class neither allow anyone who does to access the field, then private it is)&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Class fields that are &lt;i&gt;static readonly&lt;/i&gt; or &lt;i&gt;const&lt;/i&gt; are usually public as they usually hold constant data available to other users of the class&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Methods can be declared of any accessibility but usually are either:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;b&gt;private&lt;/b&gt; for internal implementation methods.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;b&gt;protected&lt;/b&gt; for virtual methods such as event firing methods.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;b&gt;public&lt;/b&gt; for user methods (methods that will be used by users of the class)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Events are usually public. In rare cases we need private events and even less protected events.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Properties are usually public or private. In rare situations we need protected or internal properties.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a name="Warnings"&gt;&lt;/a&gt;&lt;h2&gt;  Warnings &lt;/h2&gt;&lt;ul&gt;&lt;li&gt; It is considered a very bad programming practice to declare members with higher accessibility levels than they really require. This puts holes in your code.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Do not take the last tip in the "Tips" section as a starting point unless you are really familiar with the steps before it and have applied them many times. They are not always correct and they depend mainly on the situation.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;  Related wikiHows &lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.wikihow.com/Get-Started-Programming-in-C-Sharp" title="Get Started Programming in C Sharp"&gt;How to Get Started Programming in C#&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.wikihow.com/Create-an-Event-for-a-C-Sharp-Class" title="Create an Event for a C Sharp Class"&gt;How to Create an Event for a C# Class&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.wikihow.com/Design-and-Implement-a-Property-Using-C-Sharp" title="Design and Implement a Property Using C Sharp"&gt;How to Design and Implement a Property Using C#&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;i&gt;Article provided by &lt;a href="http://www.wikihow.com/Main-Page"&gt;wikiHow&lt;/a&gt;, a collaborative writing project to build the world's largest, highest quality how-to manual. Please edit this article and find author credits at the original wikiHow article on &lt;a href="http://www.wikihow.com/Decide-the-Accessibility-of-Class-Members-in-C-Sharp"&gt;How to Decide the Accessibility of Class Members in C Sharp&lt;/a&gt;.  All content on wikiHow can be shared under a &lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.5/"&gt;Creative Commons license&lt;/a&gt;.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-5322464059130216939?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/Rix0R90EVV8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/Rix0R90EVV8/decide-accessibility-of-class-members.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/07/decide-accessibility-of-class-members.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-6037726316458147490</guid><pubDate>Sat, 19 Jul 2008 22:53:00 +0000</pubDate><atom:updated>2008-07-20T01:53:01.870+03:00</atom:updated><title>How to Use Regular Expression Classes in the .Net Framework</title><description>&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; Any .NET Language&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Everyone&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; Regular Expressions in the .NET Framework&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt; &lt;/span&gt;&lt;a href="http://www.wikihow.com/index.php?title=Use-Regular-Expression-Classes-in-the-.Net-Framework"&gt;How to Use Regular Expression Classes in the .Net Framework&lt;/a&gt;&lt;hr /&gt;&lt;span style="font-weight: bold;"&gt;My last article on wikiHow:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.wikihow.com/index.php?title=Use-Regular-Expression-Classes-in-the-.Net-Framework"&gt;How to Use Regular Expression Classes in the .Net Framework - wikiHow&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;M&lt;/span&gt;any beginning programmers spend much time coding search and replace logic while the .NET framework offers a powerful class framework to use regular expressions that you can use to perform various tasks on text and binary data. This article introduces you to the regular expression classes in the .NET framework and how to use them to perform tasks easier in a systematic way.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Steps&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Decide the specific use of regular expressions you need. Regular expressions are normally used for one of the following: &lt;ol&gt;&lt;li&gt;Check if a string has a certain pattern within it&lt;/li&gt;&lt;li&gt;Validate a string against a pattern&lt;/li&gt;&lt;li&gt;Replace a specific pattern with another pattern&lt;/li&gt;&lt;li&gt;Split a string using a pattern delimiter&lt;/li&gt;&lt;li&gt;Find all ocurrences of a certain pattern within a string&lt;/li&gt;&lt;li&gt;Extract pattern pieces/groups from a string (like in syntax checking/highlighting)&lt;/li&gt;&lt;/ol&gt; &lt;/li&gt;&lt;li&gt;Design and decide the regular expression you want to use. See a tutorial on regular expressions or visit an online library of regular expressions&lt;/li&gt;&lt;li&gt;Decide the regular expressions matching options you want to use. The setting you need to decide are: &lt;ol&gt;&lt;li&gt;Case sensitivity of matching&lt;/li&gt;&lt;li&gt;Whether you want to ignore any white spaces within the regular expression while matching or not&lt;/li&gt;&lt;li&gt;Whether the matching is multiline or not (this changes the meaning of ^ and $ to match to the beginning and end of lines and not only the beginning and end of the whole string)&lt;/li&gt;&lt;li&gt;The direction of the matching process (left-to-right or right-to-left)&lt;/li&gt;&lt;li&gt;Whether . will match any character including or not including new line&lt;/li&gt;&lt;li&gt;Whether to compile the regular expression to the assembly (slow start up, fast processing) or not (the contrary)&lt;/li&gt;&lt;li&gt;Whether to ignore culture variance/change or not&lt;/li&gt;&lt;li&gt;Whether to use ECMA Script compliant mode or not&lt;/li&gt;&lt;li&gt;Whether to capture every group (any sub-expression within parenthesis) or only groups that are named&lt;/li&gt;&lt;/ol&gt; &lt;/li&gt;&lt;li&gt;Create a RegexOptions object and add all options (by using bit-wise or "|") - This step is optional&lt;/li&gt;&lt;li&gt;Choose the member method you want to use. This depends on your choice in step 1. You have the following choices: &lt;ul&gt;&lt;li&gt;&lt;b&gt;IsMatch()&lt;/b&gt; - if you only need to check whether a match was found or not&lt;/li&gt;&lt;li&gt;&lt;b&gt;Match()&lt;/b&gt; - if you want to get the first match found. Calling this method again will get the next match and so on.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Matches()&lt;/b&gt; - if you want to retrieve all matches of the pattern in one call&lt;/li&gt;&lt;li&gt;&lt;b&gt;Split()&lt;/b&gt; - if you want to split the string at the matches of the pattern&lt;/li&gt;&lt;li&gt;&lt;b&gt;Replace()&lt;/b&gt; - if you want to replace the matches of the pattern with another pattern or string&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;Decide whether you want to use the static version of the method or the instance version. Static methods do not require the creation of a Regex object but they do not keep the status of matching between calls. According to your choice, follow the following steps: &lt;ul&gt;&lt;li&gt;For static versions of the methods: &lt;ol&gt;&lt;li&gt;Declare an appropriate reference to hold the results of the operation if necessary. Here is a list of the methods and the type of results they return: &lt;ul&gt;&lt;li&gt;&lt;b&gt;IsMatch()&lt;/b&gt; - bool&lt;/li&gt;&lt;li&gt;&lt;b&gt;Match()&lt;/b&gt; - Match&lt;/li&gt;&lt;li&gt;&lt;b&gt;Matches()&lt;/b&gt; - MatchCollection&lt;/li&gt;&lt;li&gt;&lt;b&gt;Replace()&lt;/b&gt; - string&lt;/li&gt;&lt;li&gt;&lt;b&gt;Split()&lt;/b&gt; - string[]&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;Call the appropriate method from the Regex class passing it the regular expression, the string, the options, and the replacement pattern in case of Replace() and assign the result to the reference you declared in the previous step.&lt;/li&gt;&lt;/ol&gt; &lt;/li&gt;&lt;li&gt;For instance versions of the methods: &lt;ol&gt;&lt;li&gt;Create a Regex object passing the regular expression you created, and the matching options to the constructor.&lt;/li&gt;&lt;li&gt;Declare an appropriate result reference to hold the results obtained (like step 1 in the static version of the method)&lt;/li&gt;&lt;li&gt;Call the method you choose from the regex object passing it the string to be matched and assign the result to the reference created in the previous step.&lt;/li&gt;&lt;/ol&gt; &lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;Use the results obtained at the end of step 6 in the rest of your code. Usual uses of results are listed below in the "Common Uses of Regex Methods Results" section&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;Common Uses of Regex Methods Results&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;IsMatch()&lt;/b&gt;: returns a boolean value that is usally used in: &lt;ul&gt;&lt;li&gt;A single conditional construct such as the "if .. else" code construct or the "?:" operator construct. This is usually when you want to check if a pattern generally exists in a string to decide whether to do some action or not (for example check if the text of a post contains some offensive word to decide whether to allow the post or ban it altogether)&lt;/li&gt;&lt;li&gt;A looping construct such as a while or do ... while loop. This usually is used with instance versions of the method Match to iterate through all matches as long as there are matches to iterate through. Sometimes, it is used with streamed string to check the matches of apattern in a text while it arrives through the stream.&lt;/li&gt;&lt;li&gt;Validation of controls. Usually this is done by binding some property of the control to the result (for example, making a textbox disabled as long as the regex can not find a match in the string within the text box&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;&lt;b&gt;Replace()&lt;/b&gt;: returns a string with the pattern replaced with the replacement pattern or string. The resulting string is usually used in place of the original string. Some examples of the use of Replace() are: &lt;ul&gt;&lt;li&gt;Replacing all offensive words in a post with special characters such as ! or #&lt;/li&gt;&lt;li&gt;Replacing all html markup with html code that will display the markup instead of executing it (for example, replacing &lt;&gt;&lt;li&gt;Encrypting strings (premutation encryption)&lt;/li&gt;&lt;li&gt;Replacing special characters with other escaped values (for example replacing \ with \\)&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;&lt;b&gt;Split()&lt;/b&gt;: returns a string array with all tokens after spliting the original string at the patterns found. This is usualy used in code parsing.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Match()&lt;/b&gt;: returns a Match object that has information on the match found by the last call of Match(). Match objects contain information on capture groups and captures within the single match. Example uses of the Match object result and the Match() method: &lt;ul&gt;&lt;li&gt;Syntax highlighting.&lt;/li&gt;&lt;li&gt;Storing the matches found in some data storage facility such as a database.&lt;/li&gt;&lt;li&gt;Performing more complex replacing on the string by calculating the replacement of each capture.&lt;/li&gt;&lt;li&gt;Detailed finding of matches within a long text.&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;&lt;b&gt;Matches()&lt;/b&gt;: returns a MatchCollection object which is actually a collection of Match objects (you may think of it as a typed ArrayList of Match objects). This method is a call-once alternative to Match() so it has the same uses.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Tips&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;All matching options are turned off by default (that is, if you don't specify any of the options or use RegexOptions.None)&lt;/li&gt;&lt;li&gt;If you don't uinderstand any of the regular expressions matching options, leave turned off.&lt;/li&gt;&lt;li&gt;You can use Regex.Escape() and Regex.Unescape() methods to escape/un-escape special regex characters within a regular expression&lt;/li&gt;&lt;li&gt;To get the regular expression that was passed to the constructor of a Regex object, use the ToString() method. The method is overriden in Regex so that it returns the regular expression.&lt;/li&gt;&lt;li&gt;Thoroughly examine your regular expression before using it in a production-environment application. Regular expressions can be very tricky. Look at the "Related websites and online tutorials" section for further reading on regular expressions.&lt;/li&gt;&lt;li&gt;Use lookahead and lookbehind expressions wisely. They are hard to write and cost a lot of processing.&lt;/li&gt;&lt;li&gt;If your regular expression is large, uses a lot of backtracking, very complex or is intended to process large amounts of data, consider using a compiled assembly version of the regular expression. You can create regular expressions compiled assembly by using the Regex.CompileToAssembly() method.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Warnings&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Passing an invalid regular expression to the constructor of Regex or to one of the static methods in the Regex class will through an exception so use try ... catch blocks.&lt;/li&gt;&lt;li&gt;Extra large regular expressions might cause the executing PC to run out of memory, so avoid using them.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Things You will Need&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A .NET or mono compliant compiler and programming language.&lt;/li&gt;&lt;li&gt;A prior knowledge of regular expressions. See the "Related Websites and Online Tutorials" section for further information on regulare expressions.&lt;/li&gt;&lt;li&gt;A regular expressions toolbox application like RegexBuddy will help you test your regular expressions. This is optional.&lt;/li&gt;&lt;li&gt;A .NET integrated development environment will help you write code easier. This is optional.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Related Websites and Online Tutorials&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Regular_expression" class="external text" title="http://en.wikipedia.org/wiki/Regular_expression" rel="nofollow"&gt;Wikipedia's Article on Regular Expressions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.regular-expressions.info/" class="external text" title="http://www.regular-expressions.info/" rel="nofollow"&gt;Regular-Expressions.Info&lt;/a&gt;: This site contains introductory to intermediate tutorials on regular expressions.&lt;/li&gt;&lt;li&gt;&lt;a href="http://regexlib.com/" class="external text" title="http://regexlib.com/" rel="nofollow"&gt;The Regex Library&lt;/a&gt;: This is an online, collaborative, user contributed library of regular expressions where users post their regex and others rate them. It's a godd start to see some sample regular expressions.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.zytrax.com/tech/web/regex.htm" class="external text" title="http://www.zytrax.com/tech/web/regex.htm" rel="nofollow"&gt;Regular Expressions - User Guide&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amk.ca/python/howto/regex/" class="external text" title="http://www.amk.ca/python/howto/regex/" rel="nofollow"&gt;Regular Expression How To&lt;/a&gt;: This page is aimed at python developers but the discussion of regular expressions in it might be useful and the examples are good. They can be cryptic to users not familiar with python or unix.&lt;/li&gt;&lt;li&gt;&lt;a href="http://forums.msdn.microsoft.com/en-US/regexp/threads/" class="external text" title="http://forums.msdn.microsoft.com/en-US/regexp/threads/" rel="nofollow"&gt;MSDN Regex Forums&lt;/a&gt;: You can ask questions about regular expressions and get answers from other users.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Related wikiHows&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.wikihow.com/Get-Started-Programming-in-C-Sharp" class="external text" title="http://www.wikihow.com/Get-Started-Programming-in-C-Sharp" rel="nofollow"&gt;How to Get Started Programming in C Sharp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.wikihow.com/Create-an-Event-for-a-C-Sharp-Class" class="external text" title="http://www.wikihow.com/Create-an-Event-for-a-C-Sharp-Class" rel="nofollow"&gt;How to Create an Event for a C Sharp Class&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.wikihow.com/Understand-Object-Oriented-Programming" class="external text" title="http://www.wikihow.com/Understand-Object-Oriented-Programming" rel="nofollow"&gt;How to Understand Object Oriented Programming&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-6037726316458147490?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/hGAx5Ij5cd0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/hGAx5Ij5cd0/how-to-use-regular-expression-classes.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/07/how-to-use-regular-expression-classes.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-2019589419051243603</guid><pubDate>Thu, 10 Jul 2008 09:14:00 +0000</pubDate><atom:updated>2008-07-10T14:38:04.567+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Intermediate</category><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">Dot Net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Events Programming</category><title>Create an Event for a C Sharp Class</title><description>&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Guide, Tutorial&lt;br /&gt;
  &lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Moderate&lt;br /&gt;
  &lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;
  &lt;b style="color: rgb(51, 102, 255);"&gt;&lt;/b&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title: &lt;/b&gt;&lt;/span&gt;&lt;a href="http://www.wikihow.com/Create-an-Event-for-a-C-Sharp-Class"&gt;Create an Event for a C Sharp Class - Article I wrote for wikiHow&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I found this new Wiki which is also powered by WikiMedia, the same organization that powers Wikipedia. It features a wiki of how-to articles wrote by volunteers, and I can't resist this. So I wrote the following article in wikiHow. It was my first contribution to the site and I hope it will not be the last. I also include it here for those not familiar with wikiHow and for my students. I kept the same article structure used in wikiHow which is designed for good how-to documents and might be not really appropriate for a blog. however,  because the site is based on a &lt;i&gt;&lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.5/"&gt;Creative Commons license&lt;/a&gt;, &lt;/i&gt;I had to keep the disclaimer at the end. My Screen Name on wikiHow is C#Freak which I'm trying to use in every community from now on.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.wikihow.com/Main-Page"&gt;&lt;img src="http://www.wikihow.com/skins/WikiHow/wikiHow.gif" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;i&gt;from &lt;a href="http://www.wikihow.com/Main-Page"&gt;wikiHow - The How to Manual That You Can Edit&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;Many C# programmers use events in other classes by attaching event handlers to them but have you ever wanted to implement your own event(s) in classes that you develop? This is a systematic straightforward guide to creating your own events without worrying about forgetting anything.&lt;/p&gt;&lt;p&gt;&lt;span style="color: rgb(51, 51, 153); font-weight: bold;font-family:verdana;font-size:180%;"  &gt;Steps &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;1. Create the Event Arguments Class&lt;/b&gt;:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Decide what you want to communicate with your event subscribers (other programmers who will attach event handlers to your event). For example, if your event is to notify developers when a value changes, you might want to tell them the old value and the new one. If you have nothing to communicate to subscribers, use the &lt;span style="color: rgb(0, 102, 0);"&gt;System.EventArgs&lt;/span&gt; class and skip this step.&lt;/li&gt;&lt;li&gt;Create a class named &lt;span style="font-style: italic; color: rgb(0, 102, 0);"&gt;EventName&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;EventArgs&lt;/span&gt; where &lt;span style="font-style: italic; color: rgb(0, 102, 0);"&gt;EventName&lt;/span&gt; is the name of your event&lt;/li&gt;&lt;li&gt;Inherit the &lt;span style="font-style: italic; color: rgb(0, 102, 0);"&gt;EventName&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;EventArgs&lt;/span&gt; class from &lt;span style="color: rgb(0, 102, 0);"&gt;System.EventArgs&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create a protected field for each piece of data you want to communicate with your subscribers. For example, in an event that will notify developers of a change in a string value, you might want to tell them the old and the new strings so the fields will look like:&lt;div  style="font-family:courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;protected string&lt;/span&gt; oldVal, newVal;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Create a public property for each field you created in 1.4 that has only a &lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;get&lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt;{ &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;return&lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt; &lt;i&gt;fieldName&lt;/i&gt;;}&lt;/span&gt; method (where &lt;i&gt;fieldName&lt;/i&gt; is the name of the field you created in 1.4&lt;/li&gt;&lt;li&gt;Create a private empty constructor for the class with no implementation. The constructor should look like: &lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;private &lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt;EventNameEventArgs(){}&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create a public constructor for the class that takes as many arguments as there is fields/data. For example, in a string value change event, the constructor will look like:&lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;public&lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt; EventNameEventArgs(&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;string &lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt;oldValue, &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;string &lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt;newValue){oldVal = oldValue; newVal = newValue;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;b&gt;2. Declare the event delegate&lt;/b&gt;. If you did not create an event arguments class because there is no data to communicate with subscribers, use the &lt;span style="color: rgb(0, 102, 0);"&gt;System.EventHandler&lt;/span&gt; delegate and skip this step. The delegate declaration should look like: &lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;public delegate void&lt;/span&gt; &lt;i style="color: rgb(0, 102, 0); font-family: courier new,monospace;"&gt;EventName&lt;/i&gt;&lt;span style="color: rgb(0, 102, 0);font-family:courier new,monospace;" &gt;Handler&lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt;(&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new,monospace;" &gt;object &lt;/span&gt;&lt;span style="font-family:courier new,monospace;"&gt;sender, &lt;/span&gt;&lt;i style="color: rgb(0, 102, 0); font-family: courier new,monospace;"&gt;EventName&lt;/i&gt;&lt;span style="color: rgb(0, 102, 0);font-family:courier new,monospace;" &gt;EventArgs&lt;/span&gt; e);&lt;/p&gt;&lt;p&gt;&lt;b&gt;3. Declare the event itself in the containing class&lt;/b&gt;: use the event handler delegate you declared/decided in 2 as the event type. The declaration should look like:&lt;span style="color: rgb(51, 51, 255);"&gt;public event&lt;/span&gt; &lt;i style="color: rgb(0, 102, 0);"&gt;EventName&lt;/i&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Handler &lt;/span&gt;&lt;i&gt;EventName&lt;/i&gt;;&lt;/p&gt;&lt;p&gt;&lt;b&gt;4. Declare the event-firing method&lt;/b&gt; - a protected virtual method that has exactly the following declaration:&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;protected virtual void&lt;/span&gt; On&lt;/span&gt;&lt;i style="font-family: courier new,monospace;"&gt;EventName&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt;(&lt;/span&gt;&lt;i style="font-family: courier new,monospace; color: rgb(0, 102, 0);"&gt;EventName&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;EventArgs &lt;/span&gt;e){ if(&lt;/span&gt;&lt;i style="font-family: courier new,monospace;"&gt;EventName&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt; != &lt;span style="color: rgb(51, 51, 255);"&gt;null&lt;/span&gt;) { &lt;/span&gt;&lt;i style="font-family: courier new,monospace;"&gt;EventName&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt;(&lt;span style="color: rgb(51, 51, 255);"&gt;this&lt;/span&gt;, e); } }&lt;/span&gt;Use the event arguments class you decided to use in 1&lt;/p&gt;&lt;p&gt;&lt;b&gt;5. Call the event-firing method you declared in 4 whenever the event occurs&lt;/b&gt;. This is the hardest part. You should know when the event you are creating will fire (what areas in your code causes the event to occur) and call the method with the appropriate event arguments class instance. For example, in the string value change event, you must see what code can cause this value to change, save its old value before the change, allow the code to change the value, create an event arguments object with the old and new values passed to the constructor and pass the object to the event-firing method.&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 153);font-family:verdana;font-size:180%;"  &gt;Tips &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Be committed to the naming convention stated in this guide, it is a de-facto standard and most .NET/Mono developers use it.&lt;/li&gt;&lt;li&gt;Do not over communicate to your subscribers. In other words, do not transfer data that is not related to the event.&lt;/li&gt;&lt;li&gt;Choose the name of your event carefully and clearly. Event names like "ValPsd" instead of "ValuePassed" is not encouraged.&lt;/li&gt;&lt;li&gt;Usually, the accessibilities used in this article is the case. However, you can change the accessibility of any declaration as long as it does not render the element changed unusable by other elements of the event creation process.&lt;/li&gt;&lt;li&gt;Examine all places in your code where the event might occur. Sometimes, more than one piece of code causes the event to fire.&lt;/li&gt;&lt;li&gt;Watch for any changes you make to your class after you declare the event. See if the change affects the triggering/firing of the event.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 153);font-family:verdana;font-size:180%;"  &gt;Warnings &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: rgb(0, 102, 0);font-size:6;" &gt;&lt;b&gt;I&lt;/b&gt;&lt;/span&gt;f you are adding the event to a &lt;b&gt;struct&lt;/b&gt; instead of a &lt;b&gt;class&lt;/b&gt;, take notice of the following changes:&lt;/p&gt;&lt;ol&gt;  &lt;li&gt;Use "&lt;span style="color: rgb(51, 51, 255);"&gt;private&lt;/span&gt;" instead of "&lt;span style="color: rgb(51, 51, 255);"&gt;protected virtual&lt;/span&gt;" when declaring the event-firing method in 4.&lt;/li&gt;  &lt;li&gt;In the constructor of the struct that declares the event, you must initialize the event itself or you will get a compile error. Initialize events by creating new event handler delegate objects and assigning them to the event. The initialization code should look like:&lt;i style="font-family: courier new,monospace;"&gt;EventName&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt; = &lt;span style="color: rgb(51, 51, 255);"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;i style="font-family: courier new,monospace; color: rgb(0, 102, 0);"&gt;EventName&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Handler&lt;/span&gt;();&lt;/span&gt; or &lt;i&gt;&lt;span style="font-family:courier new,monospace;"&gt;EventName&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family:courier new,monospace;"&gt;Handler = &lt;span style="color: rgb(51, 51, 255);"&gt;null&lt;/span&gt;;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 153);font-family:verdana;font-size:180%;"  &gt;Things You'll Need &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;A .NET framework installed (either MS .NET framework on Windows or Mono on other operating systems).&lt;/li&gt;&lt;li&gt;A C# compiler (the csc tool in the MS .NET SDK, cmcs in the Mono framework, or the compiler included in .NET IDEs such as Visual Studio 2005/2008 for Windows or MonoDev for Linux).&lt;/li&gt;&lt;li&gt;The code of the class you wish to add the event to.&lt;/li&gt;&lt;li&gt;Some code editing tool (Notepad is enough, but Visual Studio, MonoDev, Notepad++ or any other editor might make development and code writing easier.&lt;/li&gt;&lt;/ul&gt;&lt;i&gt;Article provided by &lt;a href="http://www.wikihow.com/Main-Page"&gt;wikiHow&lt;/a&gt;, a collaborative writing project to build the world's largest, highest quality how-to manual. Please edit this article and find author credits at the original wikiHow article on &lt;a href="http://www.wikihow.com/Create-an-Event-for-a-C-Sharp-Class"&gt;How to Create an Event for a C Sharp Class&lt;/a&gt;.  All content on wikiHow can be shared under a &lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.5/"&gt;Creative Commons license&lt;/a&gt;.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-2019589419051243603?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/zwiYsUT1EEQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/zwiYsUT1EEQ/create-event-for-c-sharp-class.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/07/create-event-for-c-sharp-class.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-5097674862996752279</guid><pubDate>Mon, 07 Jul 2008 16:15:00 +0000</pubDate><atom:updated>2008-07-10T13:36:56.997+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">Dot Net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>1) An Introduction to Designing Classes in C# - Pt.3</title><description>&lt;span style="font-size: 85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#&lt;br /&gt;
&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;
&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Beginners&lt;br /&gt;
&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;
&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; &lt;/span&gt;&lt;span style="font-size: 85%;"&gt;Designing and Implementing Classes in C#&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: 85%;"&gt; &lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt; &lt;/span&gt;&lt;span style="font-size: 85%;"&gt;1) An Introduction to Designing Classes in C#&lt;/span&gt; - Pt.3&lt;br /&gt;
&lt;hr /&gt;&lt;b&gt;Quick Review:&lt;/b&gt;&lt;br /&gt;
In part 1 of this article, we discussed classes and how to design them. We established what classes are and what they are used for and what they consist of. In part 2, we introduced the general syntax for defining classes in C# and discussed the first part of the declaration: access modifiers. In this article, we will continue discussing the declaration of classes and will introduce the different types of members of classes.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: rgb(102, 0, 204);"&gt;&lt;b&gt;Remind me again how to declare a class in C#!&lt;/b&gt;&lt;/div&gt;
Here's a small reminder:&lt;br /&gt;
access-modifier [&lt;span style="color: rgb(51, 51, 255);"&gt;static&lt;/span&gt;|&lt;span style="color: rgb(51, 51, 255);"&gt;abstract&lt;/span&gt;|&lt;span style="color: rgb(51, 51, 255);"&gt;sealed&lt;/span&gt;] &lt;span style="color: rgb(51, 51, 255);"&gt;class&lt;/span&gt; &lt;span style="font-style: italic;"&gt;class-name&lt;/span&gt; [: [&lt;span style="font-style: italic;"&gt;parentClass&lt;/span&gt;][, &lt;span style="font-style: italic;"&gt;implementedInterface&lt;/span&gt;]*]&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: rgb(102, 0, 204);"&gt;&lt;b&gt;Oh yes, I remember now. So we stopped at access modifiers. What are these three other words (static, sealed and abstract)?&lt;/b&gt;&lt;/div&gt;
I'll introduce each of these modifiers briefly. However, the concepts behind them depend on other concepts we have not discussed yet such as inheritance, polymorphism and scope.&lt;br /&gt;
We start with the scope modifier, &lt;span style="color: rgb(51, 51, 255);"&gt;static&lt;/span&gt;.&lt;br /&gt;
&lt;b&gt;Static Classes&lt;/b&gt; &lt;br /&gt;
Classes are usually defined so that we can declare objects of them later. In some cases however, we only need to declare one object of the class, no more no less. For example, if we want to define a class from which we will declare an object that describes the monitor of the system, the memory of the system, the cpu of the system or perhaps, the company for which we are developing the software. Classes like that are called singleton classes. Simply, one use of static classes is to represent these classes. Static, in C#, is usually used to describe members. It means in some way: "belonging to the class itself and not to any specific object of the class". For example, if we are defining a Point class, representing geometrical point objects, we might want to run the code in one of two modes: Cartesian and polar coordinates. The fact that "points" are expressed in either format, is irrelevant to any specific "point". In fact, it affects "all" points. That's a member that belongs to the class of points as a whole not to objects of the class. Now, static classes, are by definition in C# classes with all members being static. Meaning all members of a static class has to be declared static, which in turn means they belong to the class itself. By this, we can think of the class itself as being the only object declared. Static classes are also used to group a set of methods and properties that are related by task but not belonging to any specific object. For example, a set of methods that compare/convert objects of different types in some application are all related by task, but they do not belong to a specific object as they will always behave the same no matter what object they are in (or are not in for that matter). These members are all grouped as static members of a static class. Now we discuss the second modifier: &lt;span style="color: rgb(51, 51, 255);"&gt;abstract&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Abstract classes:&lt;/b&gt;&lt;br /&gt;
Abstract classes are used when building hierarchies of classes that are related. To fully understand this modifier, you must be familiar with inheritance and polymorphism, so I will only say, they are classes with at least one abstract member. We will discuss abstract members immediatly after inheritance. That leaves us with only one modifier: sealed&lt;br /&gt;
&lt;b&gt;Sealed classes:&lt;/b&gt;&lt;br /&gt;
Sealed classes are simply classes that do not allow any other class to inherit from them. Again, you must be familiar with the concept of inheritance to fully understand sealed classes, and they will be revisited in inheritance&lt;br /&gt;
&lt;div style="color: rgb(102, 0, 204);"&gt;&lt;b&gt;Fair enough. So, can I learn to declare my first class now, or do I have to learn inheritance first?&lt;/b&gt;&lt;/div&gt;
Actually, it will be nearly impossible and in vain to learn inhertance when you don't know how to declare members. Also, except for an empty class, classes will usually need you declare one or more members. So let's start by a brief introduction about the syntax of these members and then writing the first class?&lt;br /&gt;
&lt;font size="4"&gt;&lt;b&gt;Types of Class Members:&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;
Classes at most, consist of Fields, Methods, Properties, Events and Nested Types. Following is a brief description of each one:&lt;br /&gt;
&lt;b&gt;Nested Types:&lt;/b&gt; These are simply types nested within other types. In other words, they are types that are defined within another type. They are used when a major type needs to gather a set of information to be used only by that type. For example, a software that interacts with a hardware device might need a structure to hold the settings of the device not as seen by a high level user, but after converting them to the complex and more detailed binary values that will actually be sent to the device. Nesting types within each other is usually seen in large software libraries development to emphasize a type is only declared for the use of another type only. You nest types simply by declaring the nested type/class within the scope boundaries of the nesting class as you would normally declare any class:&lt;br /&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;class&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;PrinterDriver &lt;/span&gt;{&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(51, 51, 255);"&gt;class&lt;/span&gt; hardwarePageSettings{&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;}&lt;/div&gt;
&lt;b&gt;Fields&lt;/b&gt;: fields can be thought of as being the data storage slots of the class. Fields are data (informational) members that do actually store the object's data (unlike properties). In other words, if a class having a field called "length", is used to declare objects, all objects of this class will have its own "length". That's of course if the field is not &lt;b&gt;static&lt;/b&gt;. As we mentioned earlier, static members belong to the class, meaning only one copy of the member will be available at anytime regardless of the objects declared from that class. Well, fields are no exception! Also, we mentioned earlier that members have access modifiers. Being a data storage, you must also provide the type of data that will be stored. According to this, the simplest good field declaration will look something like: &lt;br /&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;MailPackage&lt;/span&gt;{&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(51, 51, 255);"&gt;public int&lt;/span&gt; width;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(51, 51, 255);"&gt;public int&lt;/span&gt; height;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(51, 51, 255);"&gt;public int&lt;/span&gt; depth;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;}&lt;/div&gt;
&lt;b&gt;Methods:&lt;/b&gt; are used to represent the operational attributes of a class. They can be thought of as being blocks of code that takes inputs, makes some processing and return an output. The fields of the class (and the values of these fields in object of the class) are always available to the methods in the class to read and modify. The last feature eleminates the need for long parameters list in methods. Inputs are given to the method in the form of parameters (some methods take no inputs and so have no parameters). Each parameter is defined by a data type and an alias to be used by the moethod to distinguish it from other parameters. Parameters can be passed by value (default behavior), by reference (&lt;span style="color: rgb(51, 51, 255);"&gt;ref&lt;/span&gt; parameters) and as output parameters (&lt;span style="color: rgb(51, 51, 255);"&gt;out&lt;/span&gt; parameters). C# also supports variable length parameters lists (&lt;span style="color: rgb(51, 51, 255);"&gt;params&lt;/span&gt; arguments). Here's a sample method that will take an integer and calculates its square:&lt;br /&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;IntegerCalculations&lt;/span&gt;{&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public int&lt;/span&gt; Squared( &lt;span style="color: rgb(51, 51, 255);"&gt;int&lt;/span&gt; x){&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/span&gt; x*x; &lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;}&lt;/div&gt;
&lt;b&gt;Properties: &lt;/b&gt;are fake fields, or at least, that what they look like to C++ programmers! You use a property just like you would use a field in code. However, when declared, a property is actually two methods! One is used to get the value of the fake field and an optional one that will set that value. You usually use properties for the following purposes:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;To act like proxies for you fields. That is, you declare private fiields and create a public property for each field that will return and set its value. This is a common practice amongst programmers because it gives you the opportunity to modify the way a field is retrieved if it was needed or may be call some method everytime the field is written to.&lt;/li&gt;
&lt;li&gt;To declare calculated fields. These are fields that do not actually need to be stored because they can be inferred/calculated from other fields in the object. An example would be the area of a circle object which can be calculated from its radius.&lt;/li&gt;
&lt;li&gt;To make a field read-only for users of the class and still be able to write to it within the class. This is done by only defining the get method of the property&lt;/li&gt;
&lt;/ol&gt;
An example of properties is shown below where CenterX, CenterY and Radius are accessor (proxy) properties and Area is a calculated read only property:&lt;br /&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;Circle&lt;/span&gt;{&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;private double&lt;/span&gt; x,y,r;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public double&lt;/span&gt; CenterX{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;x;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{x = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public double&lt;/span&gt; CenterY{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;y;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{y = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public double&lt;/span&gt; Radius{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;r;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{r = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public double&lt;/span&gt; Area{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Math&lt;/span&gt;.PI*r*r;}} &lt;/div&gt;
&lt;span style="font-family: courier new,monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Events:&lt;/b&gt; wil actually be fully discussed in depth along with delegates in a coming article. In brief, they provide a means for other developers who will use your class to be notified when some event of interest occurs. This is done in a Publisher-Event-Subscriber model that works as follows:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;You publish an event by creating an event member in your class that will be accessible by subscribers&lt;/li&gt;
&lt;li&gt;Subscribers who are interested in the event will provide a method (or more) that should be executed when the event occurs. This is called "Attaching" "Handlers" to event, where handlers are the methods subscribers provide.&lt;/li&gt;
&lt;li&gt;Whenever the event occurs within your class, you find all methods attached to the event and execute them.&lt;/li&gt;
&lt;/ol&gt;
An example will be in the case where you want to notify develoeprs of a change in the radius of a circle, you will declare an event within the Circle class like this: &lt;span style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;
public event&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;EventHandler&lt;/span&gt; RadiusChanged;&lt;/span&gt;&lt;br /&gt;
Events are declared as if they were fields and their type must be a delegate.&lt;br /&gt;
&lt;font size="4"&gt;&lt;b&gt;Finally, Your First Class&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;
Here we go, the first full class (well, not exactly full, but it will do). We will develop a Name class that is capable of holding the structured information of a person's name (First Name, MiddleName, LastName)&lt;br /&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;Name&lt;/span&gt;{&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;i&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;//Private fields&lt;/span&gt;&lt;/i&gt; &lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;private string&lt;/span&gt; first, middle, last;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;private string&lt;/span&gt; prefix, suffix;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;i&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;//Public Accessor Properties&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public string&lt;/span&gt; First{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;first;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{first = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public string&lt;/span&gt; Middle{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;middle;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{middle = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public string&lt;/span&gt; Last{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;last;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{last = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt; &lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt; &lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public string&lt;/span&gt; Prefix{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;prefix;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{prefix = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public string&lt;/span&gt; Suffix{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;suffix;}&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt;{suffix = &lt;span style="color: rgb(51, 51, 255);"&gt;value&lt;/span&gt;;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;i&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;//Public Read-Only Calculated Properties&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt;&amp;nbsp; &lt;span style="color: rgb(51, 51, 255);"&gt;public string&lt;/span&gt; Full{&lt;span style="color: rgb(51, 51, 255);"&gt;get&lt;/span&gt;{&lt;span style="color: rgb(51, 51, 255);"&gt;return &lt;/span&gt;last + ", " + first + " " + middle;}}&lt;/div&gt;
&lt;div style="font-family: courier new,monospace;"&gt; &lt;/div&gt;
&lt;span style="font-family: courier new,monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now that you've written your first class, the following articles, will first tackle common basic types in C# and the .NET framework. The understanding of these fundamental types and some of there commonly used members is essential to writing any code. That concludes it for today's article.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-5097674862996752279?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/Wz6PFFqn9Bg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/Wz6PFFqn9Bg/1-introduction-to-designing-classes-in.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/07/1-introduction-to-designing-classes-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-1124801851969601094</guid><pubDate>Sun, 06 Jul 2008 19:12:00 +0000</pubDate><atom:updated>2008-07-07T21:43:18.557+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Useful Links</category><category domain="http://www.blogger.com/atom/ns#">Prolog</category><category domain="http://www.blogger.com/atom/ns#">A.I.</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>Get Started With Prolog</title><description>&lt;a href="http://en.wikipedia.org/wiki/Prolog"&gt;Prolog - Wikipedia, the free encyclopedia&lt;/a&gt;:&lt;br /&gt;
As usual, a good place will always be to go visit &lt;a href="http://en.wikipedia.org/"&gt;wikipedia&lt;/a&gt; and search for whatever it is you're looking for. This page includes all starting information you need to know about Prolog before you go search for any other resource.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.csupomona.edu/%7Ejrfisher/www/prolog_tutorial/pt_framer.html"&gt;prolog :- tutorial&lt;/a&gt;&lt;br /&gt;
A very neat and full of examples tutorial by J.R. Fisher on the Prolog programming language. Excellent place to begin learning prolog hands-on approach&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=21413"&gt;ISO 13211-1:1995 - The ISO Standard for Prolog&lt;/a&gt;&lt;br /&gt;
For those interested in the ISO standard for Prolog, this is the official place to go. However, the ISO standards are only sold on this site!&lt;br /&gt;
Instead, you can go &lt;a href="http://pauillac.inria.fr/%7Ederansar/prolog/docs.html"&gt;here&lt;/a&gt; to find some description on the standard, this time for free!&lt;br /&gt;
&lt;a href="http://www-2.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/lang/prolog/doc/standard/"&gt;&lt;span style="text-decoration: underline;"&gt;This site&lt;/span&gt;&lt;/a&gt; contains the December 1991 draft,         the March 1993 draft, Richard O'Keefe's 1984 Prolog         standard draft, and Michael Covington's summary of         the standard. Note that no one at that site can         answer any questions about the standard; it is just         an FTP site for the standard in the USA.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.logic.at/prolog/faq/"&gt;FAQ - comp.lang.prolog&lt;/a&gt;&lt;br /&gt;
An extensive FAQ on Prolog, available in different formats (PDF, HTML, Text, SGML, Sources)&lt;br /&gt;
Look at &lt;a href="http://www.logic.at/prolog/faq/faq.html#AEN39"&gt;this question&lt;/a&gt; on the HTML version of the FAQ, it will contain a list of where you can get a free Prolog compiler.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://kti.ms.mff.cuni.cz/%7Ebartak/prolog/index.html" style="font-weight: bold;"&gt;Online guide to Prolog Programming&lt;/a&gt;&lt;br /&gt;
This is a Prolog book/guide with a very distinguished idea that I personally liked very much, which is the "&lt;a href="http://kti.ms.mff.cuni.cz/%7Ebartak/prolog/testing.html"&gt;Test Zone&lt;/a&gt;" which is a java applet where you can test your samples and code. The site and guide is designed and written by an Associate Professor at Charles University, Prague, &lt;a href="http://kti.ms.mff.cuni.cz/%7Ebartak/index.html"&gt;Roman Barták&lt;/a&gt;. I like this very much. It's also very useful of course!&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.amzi.com/ExpertSystemsInProlog/index.htm"&gt;Building Expert Systems in Prolog&lt;/a&gt;&lt;br /&gt;
A good old fashioned book in Prolog of 12 chapters ending with the Rubik's Cube solving expert system. The book is well organized, have many examples, and very useful.&lt;br /&gt;
&lt;br /&gt;
You'll also find a lot of useful links in the Wikipedia page for Prolog, so really start there in any case. I included an extract from the comp.lang.prolog FAQ which is a list of places you can get a free Prolog:&lt;br /&gt;
&lt;br /&gt;
&lt;table style="border: 1px solid maroon; width: 100%;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="width: 50%;"&gt;&lt;span style="font-weight: bold;"&gt;ALF (Albgebraic Logic Functional language)&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: Unknown&lt;br /&gt;
E-mail: Rudolf Opalla &lt;opalla@julien.informatik.uni-dortmund.de&gt;&lt;br /&gt;
Info: WAM-based language with narrowing/rewriting&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Amzi! Prolog + Logic Server&lt;/span&gt;&lt;br /&gt;
Platforms: Window, Linux and Solaris&lt;br /&gt;
Available: &lt;a href="http://www.amzi.com/download/"&gt;http://www.amzi.com/download/&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;info@amzi.com&gt;&lt;br /&gt;
Info: Registration is compulsory, except for the Free Academic/Personal/Evaluation License.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Aquarius Prolog 1.0&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: &lt;a href="http://www.info.ucl.ac.be/people/PVR/aquarius.html"&gt;http://www.info.ucl.ac.be/people/PVR/aquarius.html&lt;/a&gt;&lt;br /&gt;
Info: High performance, commercial functionality except debugging and modules.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Argo Prolog v.1.1&lt;/span&gt;&lt;br /&gt;
Platforms: Solaris 1.x and HP-UX 9.x&lt;br /&gt;
Available: Unknown&lt;br /&gt;
Contact: Takao Doi &lt;doi@csk.co.jp&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Arity/Prolog32&lt;/span&gt;&lt;br /&gt;
Platforms: Win32&lt;br /&gt;
Available: &lt;a href="http://www.arity.com/www.pl/products/ap.htm"&gt;http://www.arity.com/www.pl/products/ap.htm&lt;/a&gt;&lt;br /&gt;
Info: Arity/Prolog32 provides a complete Prolog programming environment in which you can write, debug, and run Prolog programs in 32-bit Windows environments (95/98/NT/2000). Arity/Prolog32 is a powerful, highly optimized, and extended version of the logic programming language Prolog. Arity/Prolog32 is a complete compiler and interpreter written in Prolog, C, and Assembly language and is a superset of Clocksin and Mellish Prolog.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;B-Prolog 4.0&lt;/span&gt;&lt;br /&gt;
Platforms: Win32, Solaris, SunOS, UNIX, FreeBSD and Linux&lt;br /&gt;
Available: &lt;a href="http://www.probp.com/"&gt;http://www.probp.com/&lt;/a&gt;&lt;br /&gt;
E-mail: Neng-Fa Zhou &lt;support@probp.com&gt;&lt;br /&gt;
Info: Freely available for non-commercial use. For other use a license is needed.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;BinProlog 7.0&lt;/span&gt;&lt;br /&gt;
Platforms: Windows 95/98/NT, Linux and all major Unix platforms.&lt;br /&gt;
Available: &lt;a href="http://www.binnetcorp.com/BinProlog/"&gt;http://www.binnetcorp.com/BinProlog/&lt;/a&gt;&lt;br /&gt;
E-mail: Paul Tarau &lt;binnetcorp@binnetcorp.com&gt;&lt;br /&gt;
Info: Download free evaluation copies and see online demos. Inexpensive Educational licensing available.Has built-in networking, multi-threading, mobile code and distributed blackboards. Supports BinNet Internet Programming Tool kit (see &lt;a href="http://www.binnetcorp.com/Internet"&gt;http://www.binnetcorp.com/Internet&lt;/a&gt;).&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Brain Aid Prolog (BAP) v1.4&lt;/span&gt;&lt;br /&gt;
Platforms: Transputer systems&lt;br /&gt;
Available: &lt;a href="http://www.comnets.rwth-aachen.de/%7Eost/private.html"&gt;http://www.comnets.rwth-aachen.de/~ost/private.html&lt;/a&gt;&lt;br /&gt;
Info: BAP is a parallel prolog system for Transputer systems. Available under a Berkely style of copyright.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;C#Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Win32, UNIX&lt;br /&gt;
Available: &lt;a href="http://sourceforge.net/projects/cs-prolog/"&gt;http://sourceforge.net/projects/cs-prolog/&lt;/a&gt;&lt;br /&gt;
E-mail: John Pool &lt;j.pool@ision.nl&gt;&lt;br /&gt;
Info: A Prolog interpreter written in C#. Can easily be integrated in C# programs. Characteristics: reliable and quite fast beta version, command line interface, builtin DCG, XML-predicates, persistent predicates (using Firebird RDBMS), extendible.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Ciao 1.4&lt;/span&gt;&lt;br /&gt;
Platforms: Linux, Win32 (95/98/NT), Solaris, SunOS, UNIX in general.&lt;br /&gt;
Available: &lt;a href="http://www.clip.dia.fi.upm.es/Software/Ciao"&gt;http://www.clip.dia.fi.upm.es/Software/Ciao&lt;/a&gt;&lt;br /&gt;
E-mail: Developers &lt;ciao@clip.dia.fi.upm.es&gt;, Users &lt;ciao-users@clip.dia.fi.upm.es&gt;&lt;br /&gt;
Info: Next generation LP/CLP system. Commercial functionality, but freely available w/source. ISO-Prolog + modules, networking, multi-threading, clp(r), clp(q), interfaces (Java, C, tcltk, WWW, databases/ODBC, ...), functions, higher-order, records, persistence, objects, assertions (types, modes, ...), source debugger, auto-documenter, static debugger, and more.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;clp(FD)&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: anonymous FTP from &lt;a href="ftp://ftp.inria.fr/INRIA/Projects/ChLoE/LOGIC_PROGRAMMING/clp_fd"&gt;ftp://ftp.inria.fr/INRIA/Projects/ChLoE/LOGIC_PROGRAMMING/clp_fd&lt;/a&gt;&lt;br /&gt;
Contact: Daniel Diaz &lt;daniel.diaz@inria.fr&gt;&lt;br /&gt;
Info: Constraint logic programming over finite domains. Requires GNU C v.2.4.5 or higher.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;clp(FD,S)&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: &lt;a href="http://contraintes.inria.fr/%7Egeorget/software/clp_fds/clp_fds.html"&gt;http://contraintes.inria.fr/~georget/software/clp_fds/clp_fds.html&lt;/a&gt;&lt;br /&gt;
Contact: Yan Georget &lt;yan.georget@inria.fr&gt;&lt;br /&gt;
Info: Requires GNU C (gcc) version 2.4.5. or higher.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;CLP(R)&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: E-mail request from Joxan Jaffar &lt;joxan@watson.ibm.com&gt;.&lt;br /&gt;
Info: Constraint logic programming language, for academic and research purposes only.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;ECLiPSe Constraint Logic Programming System, subsuming Prolog.&lt;/span&gt;&lt;br /&gt;
Platforms: Solaris, Linux, Linux/Alpha, Mac OS X, Windows&lt;br /&gt;
Available: &lt;a href="http://www.eclipse-clp.org/%20or%20http://www.sourceforge.net/projects/eclipse-clp"&gt;http://www.eclipse-clp.org/ or http://www.sourceforge.net/projects/eclipse-clp&lt;/a&gt;&lt;br /&gt;
Info: ECLiPSe is a Prolog and Constraint Programming platform with a long history and has been open-sourced in Sept 2006.&lt;br /&gt;
License: MPL&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;IF Prolog V5.3&lt;/span&gt;&lt;br /&gt;
Platforms: Windows 95/98/NT/2000/XP, Linux, Solaris, AIX, HP-UX and other UNIX platforms&lt;br /&gt;
Available: &lt;a href="http://www.ifcomputer.de/Products/Prolog/"&gt;http://www.ifcomputer.de/Products/Prolog/&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;info@ifcomputer.de&gt;&lt;br /&gt;
Info: IF Prolog is a commercial Prolog system with interfaces to C/C++, Java, sockets, Windows events and a COM servers. A graphical debugger allows step-forward, step backward debugging of Prolog code. A static module concept allows many additional errors to be detected at compile time. Constraint Programming (for finite domains, intervals and booleans using global constraints and linear optimisation).&lt;br /&gt;
License: Free evaluation copies and inexpensive educational licensing available.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;GNU Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Many Unixes, Windows, MacOS X&lt;br /&gt;
Available: &lt;a href="http://gnu-prolog.inria.fr/"&gt;http://gnu-prolog.inria.fr/&lt;/a&gt;&lt;br /&gt;
E-mail: Daniel Diaz &lt;daniel.diaz@inria.fr&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Jinni 2.27&lt;/span&gt;&lt;br /&gt;
Platforms: Java-based&lt;br /&gt;
Available: &lt;a href="http://www.binnetcorp.com/Jinni"&gt;http://www.binnetcorp.com/Jinni&lt;/a&gt;&lt;br /&gt;
Info: Multi-threaded, Java based Prolog interpreter with built-in networking, distributed blackboards and mobile code (inexpensive shareware licensing available).&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;JIProlog&lt;/span&gt;&lt;br /&gt;
Platforms: Java-based&lt;br /&gt;
Available: &lt;a href="http://www.ugosweb.com/jiprolog"&gt;http://www.ugosweb.com/jiprolog&lt;/a&gt;&lt;br /&gt;
Info: Java Internet Prolog is a cross-platform pure Java 100% prolog interpreter that supplies Java world with the power of prolog language and provides prolog language with a technology to implement new predicates in Java.&lt;br /&gt;
&lt;/daniel.diaz@inria.fr&gt;&lt;/info@ifcomputer.de&gt;&lt;/joxan@watson.ibm.com&gt;&lt;/yan.georget@inria.fr&gt;&lt;/daniel.diaz@inria.fr&gt;&lt;/ciao-users@clip.dia.fi.upm.es&gt;&lt;/ciao@clip.dia.fi.upm.es&gt;&lt;/j.pool@ision.nl&gt;&lt;/binnetcorp@binnetcorp.com&gt;&lt;/support@probp.com&gt;&lt;/doi@csk.co.jp&gt;&lt;/info@amzi.com&gt;&lt;/opalla@julien.informatik.uni-dortmund.de&gt;&lt;/td&gt;&lt;td style="width: 50%;"&gt;&lt;span style="font-weight: bold;"&gt;KLIC&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: Anonymous FTP from &lt;a href="ftp://ftp.icot.or.jp/ifs/symbolic-proc/unix/klic/klic.tgz"&gt;ftp://ftp.icot.or.jp/ifs/symbolic-proc/unix/klic/klic.tgz&lt;/a&gt;.&lt;br /&gt;
Info: ICOT Free Software. Concurrent logic programming. Tested on Sparcs, DEC 7000, Gateway P5-60.&lt;br /&gt;
Contact: &lt;ifs@icot.or.jp&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;LPA Win-Prolog, demo version&lt;/span&gt;&lt;br /&gt;
Platforms: Windows&lt;br /&gt;
Available: Available from &lt;a href="http://www.lpa.co.uk/ind_dow.htm"&gt;http://www.lpa.co.uk/ind_dow.htm&lt;/a&gt;&lt;br /&gt;
MINERVA&lt;br /&gt;
Platforms: Java&lt;br /&gt;
Available: Available from &lt;a href="http://www.ifcomputer.co.jp/MINERVA"&gt;http://www.ifcomputer.co.jp/MINERVA&lt;/a&gt;&lt;br /&gt;
Info: Proprietory commercial ISO-Prolog Compiler in 100% Java support for web programming, XML, servlets, applets, standalones. Free evaluation license.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Modular SB-Prolog (= SB-Prolog version 3.1 plus modules)&lt;/span&gt;&lt;br /&gt;
Platforms: SPARC, DECstation, MIPS, HP 9000 series, Sun 3.&lt;br /&gt;
Available: Anonymous FTP from &lt;a href="ftp://ftp.dcs.ed.ac.uk/"&gt;ftp://ftp.dcs.ed.ac.uk&lt;/a&gt;/&lt;br /&gt;
Info: Copy-lefted.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Newt Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Apple MessagePad Newton&lt;br /&gt;
Available: Currently only beta version available; download and more information on &lt;a href="http://www.cfht.hawaii.edu/%7Ejlv"&gt;http://www.cfht.hawaii.edu/~jlv&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;jlv@cfht.hawaii.edu&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Open Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Apple Macintosh&lt;br /&gt;
Available: &lt;a href="http://www.cs.tcd.ie/open-prolog/"&gt;http://www.cs.tcd.ie/open-prolog/&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;brady@cs.tcd.ie&gt;. (Michael Brady).&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Poplog Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Various Unixes, including Sun, Dec Alpha, HP and many others. Also a Win32 version is available. Sources available for other combinations.&lt;br /&gt;
Available: At the Free Poplog Web/FTP site, including full sources &lt;a href="http://www.cs.bham.ac.uk/research/poplog/freepoplog.html"&gt;http://www.cs.bham.ac.uk/research/poplog/freepoplog.html&lt;/a&gt; Mirror sites at &lt;a href="http://www.poplog.org/resources/dist/new/"&gt;http://www.poplog.org/resources/dist/new/&lt;/a&gt;&lt;br /&gt;
E-mail: queries may be posted to news://comp.lang.pop/, or to &lt;pop-forum@cs.bham.ac.uk&gt; or &lt;a.sloman@cs.bham.ac.uk&gt; (Last resort!)&lt;br /&gt;
Info: Robust incremental compiler, part of the multi-language Poplog system (including Common Lisp, Pop-11 and Standard ML). Unix, Linux &amp;amp; VMS versions include full support for X window facilities/Motif. More information at &lt;a href="http://www.cs.bham.ac.uk/research/poplog/poplog.info.html"&gt;http://www.cs.bham.ac.uk/research/poplog/poplog.info.html&lt;/a&gt; Licence modelled on XFree86. Can be freely distributed, though copyright is owned by Sussex University and ISL.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;PIE2&lt;/span&gt;&lt;br /&gt;
Platforms: Unknown&lt;br /&gt;
Available: On CompuServe in the AIEXPERT forum, interpreter and examples in PIE2.ZIP, documentation in PIEDOC.ZIP.&lt;br /&gt;
E-mail: Brent Ruggles &lt;ruggles@shell.com&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;QuProlog&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX, Linux, beta for MAC&lt;br /&gt;
Available: &lt;a href="http://www.itee.uq.edu.au/%7Epjr/HomePages/QuPrologHome.html"&gt;http://www.itee.uq.edu.au/~pjr/HomePages/QuPrologHome.html&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;pjr@itee.uq.edu.au&gt;&lt;br /&gt;
Info: Extended WAM with support for quantifiers and substitutions, multi-threaded, high-level communication.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Strawberry Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Windows 95/NT, plans for UNIX and Macintosh&lt;br /&gt;
Available: &lt;a href="http://www.dobrev.com/"&gt;http://www.dobrev.com/&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;dimiter@dobrev.com&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;SWI Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Binaries for Linux, Windows (NT/2000/XP/Vista) and Mac OS X (darwin). Sources: ANSI-C, both 32 and 64-bit machines, compiles on almost all Unix systems and more.&lt;br /&gt;
Available: &lt;a href="http://www.swi-prolog.org,%20ftp//ftp.tu-darmstadt.de/pub/programming/languages/prolog/swi-prolog/"&gt;http://www.swi-prolog.org, ftp://ftp.tu-darmstadt.de/pub/programming/languages/prolog/swi-prolog/&lt;/a&gt;&lt;br /&gt;
Info: Complete, ISO and Edinburgh standard, common optimizations, GC including atoms. Portable graphics, multiple threads, constraints, comprehensive libraries for (semantic) web programming, Unicode, source-level debugger, advanced syntax colouring&lt;br /&gt;
License: LGPL&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Trinc-Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Windows 95/98/NT 4.0, plans for Windows 2000, Linux and Sun Solaris&lt;br /&gt;
Available: &lt;a href="http://www.trinc-prolog.com/"&gt;http://www.trinc-prolog.com/&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;info@trinc-prolog.com&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;UPMAIL Tricia Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Apple Macintosh&lt;br /&gt;
Available: Anonymous FTP from &lt;a href="ftp://ftp.csd.uu.se/pub/Tricia"&gt;ftp://ftp.csd.uu.se/pub/Tricia&lt;/a&gt;; get README first.&lt;br /&gt;
Info: UPMAIL is still available, but unsupported.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Visual Prolog&lt;/span&gt;&lt;br /&gt;
Platforms: Win32&lt;br /&gt;
Available: &lt;a href="http://www.visual-prolog.com/"&gt;http://www.visual-prolog.com&lt;/a&gt;&lt;br /&gt;
Info: Includes all the facilities necessary to write mission critical commercial-grade applications. Fully visual development environment. Open architecture. Object-oriented. Built-in database system and ODBC support. Visual Prolog Personal Edition is available on a freeware license.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;wamcc&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX&lt;br /&gt;
Available: Anonymous FTP from &lt;a href="ftp://ftp.inria.fr/INRIA/Projects/ChLoE/LOGIC_PROGRAMMING/wamcc"&gt;ftp://ftp.inria.fr/INRIA/Projects/ChLoE/LOGIC_PROGRAMMING/wamcc&lt;/a&gt;&lt;br /&gt;
Info: Compiler which translates Prolog to C via WAM. Debuggers. Requires GNU C v.2.4.5 or higher.&lt;br /&gt;
Contact: Daniel Diaz &lt;daniel.diaz@inria.fr&gt;&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;XGP&lt;/span&gt;&lt;br /&gt;
Platforms: Apple Macintosh OS X, 10.2.3+&lt;br /&gt;
Available: &lt;a href="http://xgp.sourceforge.net/"&gt;http://xgp.sourceforge.net/&lt;/a&gt;&lt;br /&gt;
Info: XGP is an open source (GPL) integrated development environment with user interface and graphics support based on gprolog and Cocoa under Macintosh OS X.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;XSB&lt;/span&gt;&lt;br /&gt;
Platforms: Many, including SunOS, Linux and Windows&lt;br /&gt;
Available: &lt;a href="http://xsb.sourceforge.net/"&gt;http://xsb.sourceforge.net/&lt;/a&gt;&lt;br /&gt;
E-mail: &lt;xsb-users@lists.sourceforge.net&gt;&lt;br /&gt;
Info: system with SLG-resolution, HiLog syntax, and unification factoring.&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Yap 4.2.0&lt;/span&gt;&lt;br /&gt;
Platforms: UNIX-based platforms and Windows&lt;br /&gt;
Available: &lt;a href="http://www.ncc.up.pt/%7Evsc/Yap/"&gt;http://www.ncc.up.pt/~vsc/Yap/&lt;/a&gt;&lt;br /&gt;
E-mail: Vitor Santos Costa &lt;vsc@ncc.up.pt&gt;&lt;br /&gt;
Info: Yap is entirely written in C and Prolog and should be portable to most 32-bit and 64-bit Unix based platforms. A Windows port is also available. Yap4.2 is distributed under Perl's artistic license and can be freely distributed.&lt;/vsc@ncc.up.pt&gt;&lt;/xsb-users@lists.sourceforge.net&gt;&lt;/daniel.diaz@inria.fr&gt;&lt;/info@trinc-prolog.com&gt;&lt;/dimiter@dobrev.com&gt;&lt;/pjr@itee.uq.edu.au&gt;&lt;/ruggles@shell.com&gt;&lt;/a.sloman@cs.bham.ac.uk&gt;&lt;/pop-forum@cs.bham.ac.uk&gt;&lt;/brady@cs.tcd.ie&gt;&lt;/jlv@cfht.hawaii.edu&gt;&lt;/ifs@icot.or.jp&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-1124801851969601094?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/0_L31B2Rmek" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/0_L31B2Rmek/get-started-with-prolog.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/07/get-started-with-prolog.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-4231352881470159065</guid><pubDate>Tue, 01 Jul 2008 23:35:00 +0000</pubDate><atom:updated>2008-07-07T21:46:05.047+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Useful Links</category><category domain="http://www.blogger.com/atom/ns#">A.I.</category><category domain="http://www.blogger.com/atom/ns#">LISP</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>Get Started with LISP</title><description>&lt;span style="font-size:100%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;&lt;/b&gt;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Lisp_%28programming_language%29"&gt;Lisp (programming language) - Wikipedia, the free encyclopedia&lt;/a&gt;&lt;br /&gt;This is a great place to start especially if you're new to lisp. It gives the necessary introduction about the language and a simple quick discussion of its features then it provides you with resources about the language where you can go if you need more information.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://gigamonkeys.com/book/" class="external text" title="http://gigamonkeys.com/book/" rel="nofollow"&gt;Practical Common Lisp&lt;/a&gt;&lt;br /&gt;The most appreciated book on LISP. The book is published in HTML format and the site offers a download of the source code (not the book itself).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf"&gt;LISP 1.5 Programmers Manual&lt;/a&gt; [PDF]&lt;br /&gt;The first version of LISP&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.bitsavers.org/pdf/xerox/interlisp/1974_InterlispRefMan.pdf"&gt;InterLisp Reference Manual &lt;/a&gt;[PDF]&lt;br /&gt;A manual for the Interlisp dialect&lt;br /&gt;&lt;br /&gt;&lt;a href="http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+INCITS+226-1994+%28R1999%29"&gt;ANSI LISP Standard&lt;/a&gt;&lt;br /&gt;The ANSI standard for the language (Common LISP)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tutorials&lt;/span&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.gigamonkeys.com/book/" class="external text" title="http://www.gigamonkeys.com/book/" rel="nofollow"&gt;Practical Common Lisp&lt;/a&gt; an online book by Peter Seibel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://mypage.iu.edu/%7Ecolallen/lp/" class="external text" title="http://mypage.iu.edu/~colallen/lp/" rel="nofollow"&gt;Lisp Primer&lt;/a&gt; by Colin Allen and Maneesh Dhagat.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.geocities.com/fhzeya20042000/lisp.htm" class="external text" title="http://www.geocities.com/fhzeya20042000/lisp.htm" rel="nofollow"&gt;Lisp tutorial by Faiz ul haque Zeya&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.unmutual.info/startingwithcl.html" class="external text" title="http://www.unmutual.info/startingwithcl.html" rel="nofollow"&gt;A quick guide to starting with Common Lisp&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/dst/www/LispBook/index.html" class="external text" title="http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/dst/www/LispBook/index.html" rel="nofollow"&gt;Common Lisp: A Gentle Introduction to Symbolic Computation&lt;/a&gt; by David S. Touretzky, available online and aimed at beginners.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.lisperati.com/casting.html" class="external text" title="http://www.lisperati.com/casting.html" rel="nofollow"&gt;Casting SPELs in Lisp&lt;/a&gt; A cartoon introduction to Common Lisp.&lt;/li&gt;&lt;li&gt;&lt;a href="http://paulgraham.com/onlisptext.html" class="external text" title="http://paulgraham.com/onlisptext.html" rel="nofollow"&gt;On Lisp&lt;/a&gt; free downloadable version of the book by Paul Graham&lt;a href="http://en.wikipedia.org/wiki/Paul_Graham" title="Paul Graham"&gt;&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-4231352881470159065?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/Dhc3Yo7PNPk" height="1" width="1"/&gt;</description><enclosure type="application/pdf" url="http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf" length="0" /><enclosure type="" url="http://gigamonkeys.com/book/" length="0" /><enclosure type="" url="http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+INCITS+226-1994+%28R1999%29" length="0" /><enclosure type="application/pdf" url="http://www.bitsavers.org/pdf/xerox/interlisp/1974_InterlispRefMan.pdf" length="0" /><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/Dhc3Yo7PNPk/get-started-with-lisp.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/07/get-started-with-lisp.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-5102558589265957548</guid><pubDate>Mon, 30 Jun 2008 08:27:00 +0000</pubDate><atom:updated>2008-06-30T13:40:16.864+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">Dot Net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>An Introduction to Designing Classes in C# - Pt.2</title><description>&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Beginners&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Designing and Implementing Classes in C#&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt; &lt;/span&gt;&lt;span style="font-size:85%;"&gt;1) An Introduction to Designing Classes in C#&lt;/span&gt; - Pt.2&lt;hr /&gt;&lt;span style="font-weight: bold;"&gt;Quick Review&lt;/span&gt;&lt;br /&gt;In part 1 of this article, we discussed classes and how to design them by trying to answer the question of "What is it to declare/define a class?". We established (I hope) what classes are and what they are used for and what they consist of. We also distinguished between the informational and operational features of classes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Introduction and familiarization&lt;/span&gt;&lt;br /&gt;In summary, a class definition consists of defining the following members:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Fields&lt;/span&gt;: describing the informational features of the class that must be stored (some informational features are calculated so they do not need to be stored)&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Properties&lt;/span&gt;: aliases for the informational features supporting doing some operations before retrieving or storing a value in the fields. They are also used for calculated informational features.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Methods&lt;/span&gt;: represent the operations the class can do or the operations an object of the class can do.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Events&lt;/span&gt;: a way to make objects of the class capable of informing other pieces of code of any event of interest.&lt;/li&gt;&lt;li&gt;Class definitions may also contain definition of other types which we call "&lt;span style="font-weight: bold;"&gt;nested types&lt;/span&gt;"&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 204);"&gt;OK. That's fine, now how can I define a class using C#?&lt;/span&gt;&lt;br /&gt;The simplest class declaration in C# consists of the keyword "class" followed by the name of the class followed by a pair of curly brackets "{}". For example, for the mail package class:&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;class&lt;/span&gt; MailPackage{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;However, the complete syntax is:&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;access-modifier [&lt;span style="color: rgb(51, 51, 255);"&gt;static&lt;/span&gt;|&lt;span style="color: rgb(51, 51, 255);"&gt;abstract&lt;/span&gt;|&lt;span style="color: rgb(51, 51, 255);"&gt;sealed&lt;/span&gt;] &lt;span style="color: rgb(51, 51, 255);"&gt;class&lt;/span&gt; &lt;span style="font-style: italic;"&gt;class-name&lt;/span&gt; [: [&lt;span style="font-style: italic;"&gt;parentClass&lt;/span&gt;][, &lt;span style="font-style: italic;"&gt;implementedInterface&lt;/span&gt;]*]&lt;br /&gt;&lt;br /&gt;To fully understand this syntax, let's agree on the syntax description language I will be using to the end:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Italic identifiers&lt;/span&gt; means you need to supply it (for instance, the name of the class, its parent, etc.)&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Lower case colored blue words&lt;/span&gt;: C# keywords&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Lower case uncolored words&lt;/span&gt;: another coding element that needs further description (for example, the access-modifier)&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Things in square brackets&lt;/span&gt;: optional items (might be included or not)&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Things separated with a pipe (|) character&lt;/span&gt;: either the first or the second but not both.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Two things after each other, each being in square brackets&lt;/span&gt;: either the first or the second or both.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;The * symbol after an item&lt;/span&gt;: zero or more instances of this item can be repeated&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;The + symbol after an item&lt;/span&gt;: one or more instances of this item can be repeated&lt;/li&gt;&lt;/ul&gt;access-modifier can be one of:&lt;br /&gt;&lt;ul&gt;&lt;li style="color: rgb(51, 51, 255);"&gt;public&lt;/li&gt;&lt;li style="color: rgb(51, 51, 255);"&gt;internal&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 204);"&gt;OK, One at a time, now what are access modifiers and what do they do?&lt;/span&gt;&lt;br /&gt;Modifiers are keywords that when introduced before a declaration, it modifies the way the declaration will normally behave. Access modifiers are modifiers related to the accessibility of a declared item. Access modifiers are used both with classes and members of classes. The decide what code can "access" the class or member. By access we mean use in the possible ways, for example, accessing a class is being able to use its name to call methods or to declare and instantiate objects. Accessing a field on the other hand means the ability to write to and read from that field. Accessing a method means being able to call the method and execute it, and accessing a property means the ability to read from and (if possible) write to the property. Finally, accessing an event is being able to attach event handlers to that event.&lt;br /&gt;For classes not declared within other classes, there are two levels of accessibility: public and internal. Public classes are accessible in each and every code there is. That means you can use the class within the same assembly, in another assembly, in another country ... whatever and wherever! Internal classes can be accessed only within the same assembly it is in. For example, you can not create an object from a class that was declared internal in its assembly which is already compiled.&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204); font-weight: bold;"&gt;Do I have to specify an access modifier? and how do I decide which one to use?&lt;/span&gt;&lt;br /&gt;Well, if you don't supply an access modifier, C# assumes it is internal making your class inaccessible anywhere outside the assembly that it belongs to. It is a good practice though to explicitly state the access modifier for you class even if it is internal. The code becomes clearer and it will be less likely that you'll accidentally hide a class that you want public.&lt;br /&gt;As to how you choose, it depends. Usually, classes that are internal to the implementation of an application are declared internal. The rule of thumb is, declare all classes internal unless you want to access them from outside the assembly or you want other people to be able to. Usually, developers who develop class library for other developers to use (or even for themselves to use later on) use both public and internal classes. Application developers, especially when designing a single library unit/application/executable use all internal classes.&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204); font-weight: bold;"&gt;You said access modifier apply also to members of classes, how is that?&lt;/span&gt;&lt;br /&gt;When you declare members, all of them can have access modifiers and have a default access level. Most members can be one of five access levels defined by the following access modifiers (ordered from highest accessibility to the lowest):&lt;table style="width: 805px; height: 137px;" cellpadding="3" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;&lt;p&gt;Declared accessibility&lt;/p&gt;&lt;/th&gt;&lt;th style="text-align: left;"&gt;&lt;p&gt;Meaning&lt;/p&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;public&lt;/td&gt;&lt;td&gt;Access is not restricted.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;protected&lt;/td&gt;&lt;td&gt;Access is limited to the containing class or types derived from the containing class.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;internal&lt;/td&gt;&lt;td&gt;Access is limited to the current assembly.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;protected internal&lt;/td&gt;&lt;td&gt;Access is limited to the current assembly or types derived from the  containing class.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;private&lt;/td&gt;&lt;td&gt;Access is limited to the containing type.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;One thing to note is not to confuse accessibility with security. Access is granted to code scopes and not to persons or identities when we assign certain accessibility modifiers to classes or members. Also, although most members can have any access level, but usually, there is a scheme that goes on in most cases:&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="font-weight: bold;"&gt;Member Type&lt;/td&gt;&lt;td style="font-weight: bold;"&gt;Usual Accessibility levels (ordered from most usual)&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Field&lt;/td&gt;&lt;td&gt;private, protected, protected internal&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Property&lt;/td&gt;&lt;td&gt;public, internal&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Method&lt;/td&gt;&lt;td&gt;public, protected, private, protected internal, internal&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Events&lt;br /&gt;&lt;/td&gt;&lt;td&gt;public&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Here's the link to the accessibility modifiers in C# in MSDN:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx"&gt;Access Modifiers (C# Reference)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-5102558589265957548?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/ViQOKhHqg34" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/ViQOKhHqg34/introduction-to-designing-classes-in-c_30.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/06/introduction-to-designing-classes-in-c_30.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-9190795534850844962</guid><pubDate>Wed, 25 Jun 2008 07:58:00 +0000</pubDate><atom:updated>2008-06-25T13:01:03.056+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">Dot Net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>An Introduction to Designing Classes in C# - Pt.1</title><description>&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Beginners&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; Designing and Implementing Classes in C#&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt; 1) An Introduction to Designing Classes in C#&lt;/span&gt; - Pt.1&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;M&lt;/span&gt;&lt;/span&gt;ost books on C# (and programming in general) will usually start with the infamous "hello world" example. Although this approach is dominant in most trainings and books, I believe it can be misleading. In my opinion, an abstract introduction to the language and the programming framework is necessary before writing any code units that really works. With object oriented programming, the situation becomes tricky! Especially with a fully object oriented programming language such as C#. In this post, I try to address some concepts that I feel must be introduced abstractly before actually beginning to learn how to write code. Now, the topics I will discuss are mere introductions in most cases and they demonstrate the concepts without tying them to a specific Programming Language (PL). I put the topics in the form of question and answer, and these topics are mainly inspired by the questions I've been asked by students during training courses I gave throughout the years especially in the early introductory phases of the courses.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;font-size:130%;" &gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 153);"&gt;What is it to declare or define a class?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We mentioned earlier that classes describe types/categories of things, more vaguely, it tells us what a single thing/object of this category will look like.&lt;br /&gt;To do that, a class should list the features of objects within the class. In programming, the features of an object consists briefly of the data that describes the object and the operations that the object can do. So when we define/declare classes (I personally prefer define, however declare is the most commonly used word), what we usually do is write code units that will list the features of objects created from that class. That is, when you define a class, you should use the syntax elements your PL offers to describe and list every single feature(informational and operational) of that class.&lt;br /&gt;Let's take a simple example: suppose we are designing a software for mail-courier services. The software requires at some point that you represent the mail packages that the company is dealing with. The category of objects/things that we want to represent is MailPackage objects. Congratulations, you found the name of the class you will design! Now the hard part: listing features.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;To list the features of a mail package we need first to identify them (that's what we call analyzing the problem to design a solution!) As we mentioned earlier, we divide features into informational/data-related features and operational features, so let's do that!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Informational Features:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;First, let's see what informational features does a mail package have. At this point, we re-emphasize the importance of the context we are developing within. You need to identify what data features that a mail package has and that is relevant to our case (mail-courier services). In other words, you need to "&lt;span style="font-style: italic;"&gt;identify what kind of data do a &lt;span style="color: rgb(51, 51, 255);"&gt;mail-courier service&lt;/span&gt; need to store about each &lt;span style="color: rgb(51, 51, 153);"&gt;mail pacakge&lt;/span&gt;&lt;/span&gt;" - simple, isn't it!&lt;br /&gt;Let's say that after interviewing every one in the company, their wives and their children, you found out that this is what is important to the work of the company:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Size&lt;/span&gt; of package: in terms of width, height and depth.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Volume&lt;/span&gt; of package: in meter cubed&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Weight&lt;/span&gt; of package: in kgs rounded to the nearest integer&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Order number&lt;/span&gt;: a serial number generated for each order that contains letters and numbers&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Breakable&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;OneSide&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;Sensisitive&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;Hazardeous&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;Sealed&lt;/span&gt;: are all flags that can be yes or no&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Packaging&lt;/span&gt;: one of (PaperBag, PlasticBag, CartoonBox, WoodBox, MetalBox, PlasticBox, Safe)&lt;br /&gt;As you can see some of the features (let's call them properties or attributes) are calculated (Volume) and some are compund (Size). Keep that in mind for later use.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Operational Features:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Now let's take a look at what operational features does a mail package posses. When doing so, we are looking for "what mail packages can do?" Again, this should be within the context we are working within. Identifying operations can be tricky, and it much depends on the situation, but usally a good approach is generally to look for "verbs" related to the object at hand within you analysis papers. For example, you might find the following statement in one of the interview papers: "I should be able to find the order for any package that I know". Actually, the one with the information on the order is the package itself, so it is supposed to be responsible for finding its parent Order object. An operation is born: "FindParentOrder". Another type of operational features are "notifications". This enables an object of the class to notify other objects of certain things (status changes, value changes, user interactions, events in general). For example, a statement like this: "when an order is delivered, the owner should be emailed" in the interview makes a great candidate for a notification called OrderDelivered. Again, it depends on the situation but generally, notifications can be found from a statement that:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Is a rule of the form: "When ----- occurs, ------ should be done"&lt;/li&gt;&lt;li&gt;Is a rule of the form: "If ------ changes/occurs, ------ should change/be done"&lt;/li&gt;&lt;li&gt;Is a rule of the form: "In the case of /event of -------, ------- should be done"&lt;/li&gt;&lt;/ul&gt;Of course, again, you should tie this to the context of development. Notifications are called "events" in C# and the .NET framework in general&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-9190795534850844962?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/E-kekkhdAz4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/E-kekkhdAz4/introduction-to-designing-classes-in-c.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/06/introduction-to-designing-classes-in-c.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-4706866082321464957</guid><pubDate>Tue, 24 Jun 2008 19:06:00 +0000</pubDate><atom:updated>2008-06-24T23:47:04.540+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>Reference Types and Value Types</title><description>&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Beginners&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; Introduction to programming in C# and the .NET framework&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt; Reference vs. Value Types&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;As we mentioned previously, in c#, everything is a class. However, there are five types of classes in C# and those are: &lt;span style="color: rgb(51, 51, 255);"&gt;class&lt;/span&gt;,&lt;span style="color: rgb(0, 0, 153);"&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;struct&lt;/span&gt;&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;enum&lt;/span&gt;,&lt;span style="color: rgb(51, 51, 255);"&gt; delegate&lt;/span&gt; and&lt;span style="color: rgb(51, 51, 255);"&gt; interface&lt;/span&gt;. When I say they all are classes, that is in the .net framework, interfaces are actually abstract classes and that's how they are implemented in the level of MSIL (although text MSIL has a modifier that marks a class as an interface/struct ... etc, they are all declared as .class declarations)&lt;br /&gt;&lt;br /&gt;C# allows three kinds of data types:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Reference Types&lt;/li&gt;&lt;li&gt;Value Types&lt;/li&gt;&lt;li&gt;Pointer Types (Yes C/C++ programmers, it is pointer types alright)&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:180%;"&gt;P&lt;/span&gt;ointer types&lt;/span&gt; are only allowed in unsafe contexts and are thus not managed by the CLR. Therefore we will not discuss them until we do unsafe code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:180%;"&gt;V&lt;/span&gt;alue Types&lt;/span&gt; are types designed usually to hold single "values" as the name emplies. Now, when we say single, we don't mean a single simple type value. What we mean is that value type objects will hold a value rather than a real object. The destinction is unclear, I know, and it never will be because it's in the eyes of the programmer. For example a point might be thought of as a value, also size in terms of width, height and depth might be thought of as a comopund value. However, not all cases are as clear as the size case, consider a rectangle type, can we treat a rectangle as a value or should we treat it as an object. Value types however, have technical features that we will discuss later.&lt;span style="color: rgb(51, 51, 255);"&gt; struct&lt;/span&gt; and &lt;span style="color: rgb(51, 51, 255);"&gt;enum&lt;/span&gt; types are Value Types. All value type classes are automatically inherited (either directly or indirectly) from System.ValueType&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:180%;"&gt;R&lt;/span&gt;eference Types&lt;/span&gt; are types designed usually to hold objects that are "active" in some since. For example a Vehicle type will be needed for more than just to store the data of a car. Again, it is relative in some cases.&lt;span style="color: rgb(51, 51, 255);"&gt; class&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;interface&lt;/span&gt;, and &lt;span style="color: rgb(51, 51, 255);"&gt;delegate &lt;/span&gt;types are all reference types.&lt;br /&gt;&lt;br /&gt;Now let's suppose we have a type DataType, and that we write the following code:&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 51, 0);font-family:courier new;" &gt;&lt;blockquote&gt;DataType p = new DataType();&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt; Now, if we write the following line of code immediatly after the former:&lt;br /&gt;&lt;blockquote style="font-family: courier new; color: rgb(0, 51, 51);"&gt;DataType q = p;&lt;/blockquote&gt;The thing to note about reference types and value types is the way assignment works on both types. So, if DataType was a value type what will happen is that a copy of p will be assigned to q. That is, there will be actually two DataType objects in memory with the same value.&lt;br /&gt;However, if DataType is a reference type, what will happen is what we call reference assignment. That is, the q reference will be assigned the same object as reference p making two references p and q point to the same object. This means only one DataType object will be in memory. Now changing p won't change q in the first case (value types). It will change both p and q in the second case (reference types).&lt;br /&gt;&lt;br /&gt;Below is a comparison between reference and value types, characterizing the main features of each kind of types and the difference between them:&lt;br /&gt;&lt;br /&gt;&lt;table style="border: 1px solid maroon; width: 90%;" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%; font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Reference Types&lt;/span&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%; font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Value Types&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Holds reference to an object in memory&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Holds a value in memory&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Assignment of two references will make them point to the same object in memory&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Assignment of two value type objects will copy one to the other, keeping two separate objects in memory&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Declaring a reference does not automatically create an object for it&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Declaring a value type object automatically creates an object in memroy&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;class, interface, delegate&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;struct and enum&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Usually used for active objects, those which will need to perform various operations and interact with other objects&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;Usually used for creating value holding types (types from which objects will be able to hold values)&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;&lt;span style="font-weight: bold;"&gt;Sample candidates:&lt;/span&gt;&lt;br /&gt;Vehicle, Product, SaleItem, Delivery, Queue, Student, GraphicalShape, GeometricalShape, DataBase, NetworkMessage, ChatControl, BlogController&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;&lt;span style="font-weight: bold;"&gt;Sample candidates:&lt;/span&gt;&lt;br /&gt;Size, Volume, Area, PersonName, PhoneNumber, EmailAddress, MailingAddress, IpAddress, IpConfigurations, BlogSettings&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;Can be assigned a &lt;span style="color: rgb(51, 51, 255);"&gt;null&lt;/span&gt; value (a reference pointing to nothing - actually &lt;span style="color: rgb(51, 51, 255);"&gt;null&lt;/span&gt; is called nothing in VB.NET)&lt;br /&gt;&lt;/td&gt;&lt;td style="border: 1px solid maroon; width: 50%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;Can not be assigned a null/nothing value unless made nullable&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Sometimes we need to treat value types as reference types. This is done in an operation called boxing and it simply involves casting the value type value into an Object reference:&lt;br /&gt;&lt;blockquote style="font-family: courier new; color: rgb(0, 51, 51);"&gt;int i =10;&lt;br /&gt;object o1 = i; &lt;span style="color: rgb(0, 153, 0);"&gt;//Implicit boxing&lt;/span&gt;&lt;br /&gt;object o2=(object)i; &lt;span style="color: rgb(0, 153, 0);"&gt;// Explicit boxing&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;It is important to understand the difference between reference and value types to fully understand the difference between structs and classes and to know when to use which.&lt;br /&gt;&lt;br /&gt;The following built-in types in C# are value types:&lt;br /&gt;&lt;blockquote&gt;short, int, long, ushort, uint, ulong, byte, sbyte, float, double, decimal, bool, char, struct, enum&lt;/blockquote&gt;The default values for these types are 0's representation for numeral types, false for bool, the value produced by casting 0 to the enum type for enums, '\0' for char, the value produced by setting all value-type fields to their default values and all reference-type fields to null for structs&lt;br /&gt;&lt;br /&gt;I included links to other materials/references/articles on reference and value types for more information:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/3ewxz6et%28VS.71%29.aspx"&gt;MSDN C# reference article on reference and value types&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/cs/cskeywordspart2.aspx"&gt;Code Project: Article on Type Conversion, Operators and Types&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/cs/boxunbox.aspx"&gt;Code Project: Article on boxing and unboxing in C#&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-4706866082321464957?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/RTLw3UCgqxA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/RTLw3UCgqxA/reference-types-and-value-types.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/06/reference-types-and-value-types.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-5646670834159192053</guid><pubDate>Tue, 24 Jun 2008 08:55:00 +0000</pubDate><atom:updated>2008-06-24T13:33:28.543+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">Dot Net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>Namespaces, Assemblies and Modules</title><description>&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#, .NET in General&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Beginners&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; Introduction to programming in C# and the .NET framework&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt; .NET Namespaces, Assemblies&lt;/span&gt; and Modules&lt;br /&gt;&lt;hr /&gt;All .NET PLs share the same code cycle: Code is written, parsed, compiled into a binary MS Intermediate Language (MSIL) Assembly and then executed by the Common Language Runtime (CLR).&lt;br /&gt;&lt;br /&gt;Simply, an assembly is a compiled .NET code. The .net framework has a common intermediate language that is as close to the Assembly language as possible which all .net PLs should compile their code into. An assembly is a binary MSIL file, thus a compiled .net code.&lt;br /&gt;.NET assemblies come in three forms: Windows Executable (.exe), Console Executable (.exe) or Library (.dll)&lt;br /&gt;&lt;br /&gt;.NET assemblies contain Modules, a piece of compiled code that is not a complete assembly. This technique is primarily for development teams with more than one person working on the same assembly. Each of them can work on a different module of the assembly and the modules are merged together to form the assembly later (this way, one assembly can be developed using more than one PL, each developer accomplishes his/her work on his favorite .net language and compiles the code to a module which is then merged with the other developers' modules to form the assembly). Now, usually, an assembly will contain only one module, but for accuracy's sake, we introduced the concept of modules.&lt;br /&gt;&lt;br /&gt;The C# PL is a fully-object-oriented language, which means in colloquial terms "everything is a class". In .net terms, this means that C# modules can only contain class definitions, nothing more. Because assemblies are the binary MSIL binary compiled version of C# code files, this means that C# code files must not contain anything other than class definitions, and that is true. However, there is two more constructs that a C# code file can contain on its root level: namespace declaration and namespace using statements. Now, these are not memory consuming instructions like variable declaration nor are they code declaration/grouping constructs like methods. Namespaces are logical grouping of classes within a scope. They can be thought of as being prefixes to the class names of all the classes declared within them. They enable developers to create classes with globally unique names and at the same time help developers organize code within categories that you specify.&lt;br /&gt;&lt;br /&gt;Let's take a look at a namespace declaration:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;namespace &lt;span style="color: rgb(204, 0, 0);"&gt;GUI&lt;/span&gt;{&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  namespace &lt;span style="color: rgb(204, 0, 0);"&gt;DrawingShapes&lt;/span&gt;{&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class ShapeBase{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class Rectangle : ShapeBase{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class Circle : ShapeBase{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   ....&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  namespace &lt;span style="color: rgb(204, 0, 0);"&gt;Controls&lt;/span&gt;{&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class MyControlBase{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class MyButton : MyControlBase{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  }&lt;br /&gt;  namespace &lt;span style="color: rgb(204, 0, 0);"&gt;Text&lt;/span&gt;{&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class MyTextBox{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class MyRichTextBox{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  namespace &lt;span style="color: rgb(204, 0, 0);"&gt;Tools&lt;/span&gt;{&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class Tool1{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;   class Tool2{}&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  namespace &lt;span style="color: rgb(204, 0, 0);"&gt;InternalImplementation&lt;/span&gt;{&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;As you might have noticed, this is a clipping of a graphical user interface elements library. Now imagine two companies/developers working on the same project (GUI elements library). They both choose to develop a circle class, a rectangle class and so on. However, a developer wants to use both libraries together (may be the circle of the first company is drawn better than the one from the second company!) If there was no way to distinguish each class from the beginning, it will be impossible for the developer to use both libraries.&lt;br /&gt;However, as we said, a namespace is a scope of the classes defined within it and it becomes a part of its name, so now the full name of the Circle class in this example becomes: GUI.DrawingShapes.Circle&lt;br /&gt;Now, if every company/developer kept all his/her classes in a parent namespace of his choosing, it becomes nearly impossible that a naming collision will occur between his/her classes and other developers' classes. It also solves naming conflicts within the same library, for example, in an engineering design application library, you might want to develop a class that will represent the geometrical shape called Rectangle, and at the same time you want to represent a screen drawn Rectangle. These are two types sharing the same name.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Assemblies:&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Binary compiled code files&lt;/li&gt;&lt;li&gt; Contain Modules that contain classes&lt;/li&gt;&lt;li&gt; When deciding how to divide classes on assemblies, you usually want to physically separate classes in separate files (for example, dictionary classes and drawing classes in a word processing application should be physically separated because they are both optional components of the application so they might and might not be included in the installation of the application)&lt;/li&gt;&lt;li&gt; You should always separate classes in different assemblies if they are:&lt;ul&gt;&lt;li&gt; Different plug-ins/add-ins to a container application&lt;/li&gt;&lt;li&gt; Two optional separate feature of the application&lt;/li&gt;&lt;li&gt; Perform totally unrelated tasks&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt; An assembly can contain classes from different namespaces&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Namespaces:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt; &lt;li&gt; Logical scope of classes&lt;/li&gt;&lt;li&gt; Classes from the same namespace can span multiple assemblies&lt;/li&gt;&lt;li&gt; Is used to solve naming conflicts in classes&lt;/li&gt;&lt;li&gt; Adds a prefix to the class name&lt;/li&gt;&lt;li&gt; Is used to group similar classes (usually by task)&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-5646670834159192053?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/BXsRKS2EvD4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/BXsRKS2EvD4/namespaces-assemblies-and-modules.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/06/namespaces-assemblies-and-modules.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-3857735397257055951</guid><pubDate>Mon, 23 Jun 2008 22:01:00 +0000</pubDate><atom:updated>2008-06-24T11:16:10.884+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tutorials</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Beginners</category><title>Introduction to classes in C# and the .NET framework</title><description>&lt;span style="font-size:85%;"&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Programming Language:&lt;/b&gt; C#&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Type:&lt;/b&gt; Tutorial&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Level:&lt;/b&gt; Beginners&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Category:&lt;/b&gt; General Programming&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Main Series:&lt;/b&gt; &lt;span style="font-style: italic; font-weight: bold;"&gt;Introduction to programming in C# and the .NET framework&lt;/span&gt;&lt;br /&gt;&lt;b style="color: rgb(51, 102, 255);"&gt;Topic Title:&lt;/b&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;font-size:100%;"  &gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic; color: rgb(102, 0, 0);font-family:verdana;font-size:100%;"  &gt; Classes - Introduction&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:130%;"  &gt;&lt;span style="font-weight: bold;"&gt;What are classes and types?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Classes are code units that describe the attributes of interest of some real life object/thing to a software under development. It describes the data and data structures needed to define an instance (some arbitrary single object of the kind described by the class) of the class/type/kind and the operations that kind of objects can perform.&lt;br /&gt;&lt;br /&gt;In other words, the class is a digital representation of a "&lt;span style="font-style: italic;"&gt;kind of objects/things&lt;/span&gt;" or a "&lt;span style="font-style: italic;"&gt;category of things&lt;/span&gt;". It’s not a digital representation of the "&lt;span style="font-style: italic;"&gt;things&lt;/span&gt;" themselves. A digital representation of one of the things is an&lt;span style="color: rgb(51, 102, 255);"&gt; object/instance&lt;/span&gt; of that class!&lt;br /&gt;&lt;br /&gt;For example, let’s consider a software that needs to represent a &lt;span style="color: rgb(153, 51, 0);"&gt;car&lt;/span&gt; electronically. Of course a car represented digitally will not be an exact copy of the real life car neither will it include all its features. Instead we see what actually is of concern to our software and represent it. That is, we usually represent real-life things in a certain "&lt;span style="color: rgb(51, 102, 255); font-style: italic; font-weight: bold;"&gt;context&lt;/span&gt;" rather than representing them generally and thoroughly. The cars we want to represent are needed for the context of a software that car resellers can use, so the information of use will not include for example, the exact materials of which the car parts were manufactured, the list of brands of each component of the car neither the thorough dimensions or technical drawing of the car’s body.&lt;br /&gt;&lt;br /&gt;Instead, let’s suppose that for the client of the software you are designing, what matters is the color, make, model, tire model, number of passengers, manufacturer and price of the car.&lt;br /&gt;As we said earlier, classes represent kinds/categories not single instance things. So, we need to represent the type/kind/category of things called cars. A class will describe what kind of values are needed to represent the attributes of a car, but it will not give specific values for these attributes. Actually, the process of designing classes is simply the process of identifying the&lt;br /&gt;attributes of the kind/type/category of things the class will represent!&lt;br /&gt;&lt;br /&gt;So if we want to represent a car in the "&lt;span style="font-style: italic;"&gt;context&lt;/span&gt;" we extracted from the customer, we will need to represent its &lt;span style="color: rgb(51, 102, 255); font-style: italic;"&gt;color&lt;/span&gt;, its &lt;span style="color: rgb(51, 102, 255); font-style: italic;"&gt;make&lt;/span&gt;, its &lt;span style="font-style: italic; color: rgb(51, 102, 255);"&gt;model&lt;/span&gt; ... etc. The colored words are the names of the attributes/&lt;span style="font-weight: bold; font-style: italic;"&gt;fields&lt;/span&gt; needed to define a single car. By "&lt;span style="font-style: italic;"&gt;the attributes needed to define a car&lt;/span&gt;" we mean that to define a specific single car, we must give a value for each of these attributes. We will also need to define the type/kind of each attribute so as to be able to give it a value. For instance, a color can be represented by a number, a list of available color names and by three numbers each representing the amount of red, green and blue required to be mixed to get the color. We choose the representation that best fits our need.&lt;br /&gt;&lt;br /&gt;You can think of classes as the means by which we describe types of things to the computer. For example, if we want to describe to the computer what points (as a kind of geometrical shapes) are, we tell it that for a point to be defined, it needs an x coordinate and a y coordinate both being numbers (integers if we work on an integral environment)&lt;br /&gt;Now when we say that we want to define/create a specific point, we have to give the computer its specific x and y coordinates values.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;The primitive/built-in/fundamental classes in C# and .NET&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The C# programming language provides a set of what we call primitive/essential/fundamental/basic/simple types so as to use them in describing other types. Each of these types is a class like any other class you develop but it is built-in to the .NET framework and some of their names are reserved words in the C# language.&lt;br /&gt;&lt;br /&gt;For example, there is a set of types that represents the different kinds of numerals in the real world (the short, int, long, float, double, decimal, ushort , unsigned short, uint, ulong types/classes)&lt;br /&gt;&lt;br /&gt;The integer class itself (actually named Int32 in the .NET framework) describes integer numbers and an instance integer represents a single integer value. We declare a reference to an integer by writing:&lt;br /&gt;&lt;blockquote style="color: rgb(0, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;int someInteger;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;Then we must assign a value to the referenced object (actually for integers, it is given the value of 0 initially)&lt;br /&gt;&lt;blockquote  style="color: rgb(0, 102, 0);font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;someInteger = 10;&lt;/span&gt;&lt;/blockquote&gt;Some of the classes that are considered simple/basic/primitive are:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-family:courier new;"&gt;short, int, long, ushort, uint, ulong, float, double, decimal, string, object, byte, void&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;Some of the more complex but still considered basic by many:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;blockquote&gt;DateTime, TimeSpan, Version, Guid, DayOfWeek&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-3857735397257055951?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/nK8L46qMwHw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/nK8L46qMwHw/programming-language-c-type-tutorial.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/06/programming-language-c-type-tutorial.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3318182078195283600.post-4492628760489696335</guid><pubDate>Mon, 23 Jun 2008 11:29:00 +0000</pubDate><atom:updated>2008-06-23T15:01:40.485+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Introduction</category><category domain="http://www.blogger.com/atom/ns#">Blog</category><title>Yet another notebook on programming ...</title><description>&lt;span style="color: rgb(102, 51, 255);font-size:180%;" &gt;&lt;span style="font-weight: bold;"&gt;O&lt;/span&gt;&lt;/span&gt;ne thing every developer/programmer knows for sure is: you never know it all! In fact, we can safely say: you never know enough about programming!&lt;br /&gt;Here's another fact about programming: problems never seize to exist! They just keep appearing and popping.&lt;br /&gt;I've been working as a trainer for MCSD .NET for a while now (about 5 years) and I tried in so many ways to share my experience with others, and I FAILED. Not that I could not find content to share but in the contrary, there were too many that I never found the time to put it all up together in one place. Being programmer makes you a little verbose and a little perfectionist, so every time I tried to put up some material, I started categorizing and reasoning then starting from scratch. So for example if I wanted to write about printing documents using C#, I had to write about the classes you use, and then I found myself writing about classes in general and then about what classes do, and so I started from scratch all over again.&lt;br /&gt;When I tried to write a series of articles on my blog, It took my five years and it is not finished yet!&lt;br /&gt;I found out that the problem is that order of topics and reasoning was an obstacle to the old blog. You know, it's ironic that the world of the internet is going from hierarchial services to cloud structured services (for example, email, bookmarks, topics, etc. used to be categorized in a hierarchial folder structure back in the old days, then came the "TAG" magic and it al changed)&lt;br /&gt;I decided to open up a new blog, fresh start, clean slate, where I can post topics as they come to my mind, no matter if they are related to each other or not, and no matter if they are tutorials, ideas, code samples, questions, suggestions, links and websites or any other form of thought as long as it is related to programming.&lt;br /&gt;&lt;br /&gt;Now, I've used around 17 programming languages during my life (not counting the different flavors/versions of a language) but currently I'm kind of stable with using C# for desktop development (C++ and its flavors when C# is not an option), C# and PHP for web development, SQL Server 2005 (2000 if 2005 not an option) and MySQL for databases, Prolog for knowledge intensive AI applications and I love both open source and proprierty software (I appreciate unix and love MS)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3318182078195283600-4492628760489696335?l=plnotebook.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/NotebookOnProgramming/~4/2MKaUUN7HLc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/NotebookOnProgramming/~3/2MKaUUN7HLc/yet-another-notebook-on-programming.html</link><author>noreply@blogger.com (VC)</author><thr:total>0</thr:total><feedburner:origLink>http://plnotebook.blogspot.com/2008/06/yet-another-notebook-on-programming.html</feedburner:origLink></item></channel></rss>

