<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gsingh5</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gsingh5"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Gsingh5"/>
	<updated>2026-06-25T23:14:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71271</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71271"/>
		<updated>2012-11-28T20:55:03Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle[http://en.wikipedia.org/wiki/Open/closed_principle] and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# [http://en.wikipedia.org/wiki/C_Sharp_(programming_language)]and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Strategy_pattern Strategy Pattern]&lt;br /&gt;
* [http://www.dofactory.com/Patterns/PatternStrategy.aspx Strategy Pattern and Sorting]&lt;br /&gt;
* [http://www.dofactory.com/Patterns/PatternStrategy.aspx Strategy Pattern in c++, c#, Delphi,Java and PHP]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71270</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71270"/>
		<updated>2012-11-28T20:53:23Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle[http://en.wikipedia.org/wiki/Open/closed_principle] and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# [http://en.wikipedia.org/wiki/C_Sharp_(programming_language)]and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Strategy_pattern Strategy Pattern]&lt;br /&gt;
* [http://www.dofactory.com/Patterns/PatternStrategy.aspx Strategy Pattern and Soting]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71269</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71269"/>
		<updated>2012-11-28T20:51:29Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle[http://en.wikipedia.org/wiki/Open/closed_principle] and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# [http://en.wikipedia.org/wiki/C_Sharp_(programming_language)]and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Strategy_pattern Strategy Pattern]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71268</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71268"/>
		<updated>2012-11-28T20:51:13Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle[http://en.wikipedia.org/wiki/Open/closed_principle] and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# [http://en.wikipedia.org/wiki/C_Sharp_(programming_language)]and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Strategy_pattern Strategy] Pattern&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71267</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71267"/>
		<updated>2012-11-28T20:49:06Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: /* Strategy Pattern, Getting Started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle[http://en.wikipedia.org/wiki/Open/closed_principle] and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# [http://en.wikipedia.org/wiki/C_Sharp_(programming_language)]and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71266</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71266"/>
		<updated>2012-11-28T20:48:03Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: /* Strategy Pattern and a Directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle[http://en.wikipedia.org/wiki/Open/closed_principle] and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71265</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71265"/>
		<updated>2012-11-28T20:47:34Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: /* Strategy Pattern and a Directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71264</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71264"/>
		<updated>2012-11-28T20:46:47Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern [http://en.wikipedia.org/wiki/Software_design_patterns] that can be used to select a particular algorithm[http://en.wikipedia.org/wiki/Algorithm] among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71263</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71263"/>
		<updated>2012-11-28T20:45:38Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern[http://en.wikipedia.org/wiki/Strategy_pattern] is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71262</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71262"/>
		<updated>2012-11-28T20:44:34Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=9RBiwpWsJQ4 This] is a 5:50 min video which given an example in PHP&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71261</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71261"/>
		<updated>2012-11-28T20:43:19Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=-NCgRD9-C6o&amp;amp;feature=related This] 11:30 min video is a very descriptive tutorial which shows how to write code which is descriptive and then write better code using the Strategy Pattern&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71260</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71260"/>
		<updated>2012-11-28T20:40:56Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/watch?v=94t2ayF1l3o This] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71259</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71259"/>
		<updated>2012-11-28T20:40:29Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* [This http://www.youtube.com/watch?v=94t2ayF1l3o] video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA &lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71258</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71258"/>
		<updated>2012-11-28T20:39:53Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* This video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in [http://www.youtube.com/watch?v=94t2ayF1l3o JAVA]&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71257</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71257"/>
		<updated>2012-11-28T20:39:21Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* This video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in [JAVA http://www.youtube.com/watch?v=94t2ayF1l3o]&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71256</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71256"/>
		<updated>2012-11-28T20:38:48Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html] This is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* This video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in [JAVA http://www.youtube.com/watch?v=94t2ayF1l3o]&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71255</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71255"/>
		<updated>2012-11-28T20:38:07Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html] This is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* This video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA.&lt;br /&gt;
[http://www.youtube.com/watch?v=94t2ayF1l3o]&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71254</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71254"/>
		<updated>2012-11-28T20:37:10Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
* This video is a 9 min short lecture that explains the basic concepts of Strategy Pattern with example given in JAVA.&lt;br /&gt;
[http://www.youtube.com/watch?v=94t2ayF1l3o]&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71253</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71253"/>
		<updated>2012-11-28T20:33:59Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Short Video Lectures=&lt;br /&gt;
To gain further knowledge on the Strategy Pattern there are a number of video lectures that explain the concepts of the pattern. Some of them are mentioned here with a brief description:&lt;br /&gt;
&lt;br /&gt;
*  &lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71252</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71252"/>
		<updated>2012-11-28T20:27:23Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern and a Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71251</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w64 bg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w64_bg&amp;diff=71251"/>
		<updated>2012-11-28T20:26:02Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Overview=&lt;br /&gt;
&lt;br /&gt;
The Internet is the new and the biggest source of information today. The Internet is so overwhelmed with information that sometimes it is difficult to find the exact things. So the purpose of this Wikipedia page is to give the readers a list of references that explain the Strategy pattern and all the details about its implementation and working. The references given in this page will give a complete knowledge of this pattern. Further, with each references given in this page a briefing of what it covers, the programming language used and the purpose that it serves is mentioned.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Directory of sites=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strategy Pattern is a software design pattern that can be used to select a particular algorithm among many available ones at run time depending on certain conditions. A clear definition of the Strategy Pattern can be found [http://en.wikipedia.org/wiki/Strategy_pattern here]. This resource gives a general idea of the pattern, a useful reference for readers that have not used this pattern before. The reference  is written in a simple and easily understandable way that can be beneficial for a new reader as well as the programmers that want to have a very high level idea about the pattern. It includes a pictorial representation of the fundamental concept behind the pattern and explains it using an example in Java. This resource includes a discussion about the Open/Close principle and relates it with the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern, Getting Started=&lt;br /&gt;
&lt;br /&gt;
Now that you know the basic definitions and concept of the Strategy pattern, [http://www.oodesign.com/strategy-pattern.html this] will give a deeper insight into the pattern. It explains the motivation behind using the Strategy Pattern and various situations where strategy pattern is useful. A Java example is used to provide better understanding of the concept. Further, it adds some details with regard to implementing a Strategy Pattern such as passing data. It includes a discussion about other patterns that are related to the Strategy pattern.&lt;br /&gt;
&lt;br /&gt;
To gain further insight into the working of the Strategy Pattern, [http://www.codeproject.com/Articles/52807/Design-Patterns-Part-1-The-Strategy-Pattern this] resource gives a precise description with well accompanied example. The example is in C# and is very descriptive and easy to understand. The author of the article has shown how to apply the Strategy Pattern to solve a real problem. Additionally, it discusses some of the implementation problems associated with this pattern. This is a good extension to the previous resource.&lt;br /&gt;
&lt;br /&gt;
Patterns make the code better readable and easy to maintain. There are some difficulties &amp;lt;ref name=&amp;quot;Difficulties&amp;quot;&amp;gt; http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-designpatterns.html &amp;lt;/ref&amp;gt; when design pattern are not used. This reference gives a comprehensive idea on the disadvantages of not using a design pattern and how the code becomes readable and easy after using the strategy pattern. This resource demands some work from the reader and helps the reader better understand the pattern.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Switch statements=&lt;br /&gt;
&lt;br /&gt;
This section directs you to an interesting comparison between the Strategy Pattern and Switch statement both of which can be used to dynamically select an algorithm &amp;lt;ref name=&amp;quot;Difference&amp;quot;&amp;gt; http://blogs.microsoft.co.il/blogs/gilf/archive/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements.aspx &amp;lt;/ref&amp;gt; at run time. This explains the advantages of using the Strategy Pattern over the Switch statement.&lt;br /&gt;
&lt;br /&gt;
=Strategy Pattern over Inheritance=&lt;br /&gt;
&lt;br /&gt;
[http://docs.doctrine-project.org/en/2.1/cookbook/strategy-cookbook-introduction.html This] is a very good resource that discusses a scenario where Strategy Pattern can be used over Inheritance. It explains the concepts very well and has detailed example in php.&lt;br /&gt;
&lt;br /&gt;
=Application=&lt;br /&gt;
&lt;br /&gt;
Strategy pattern is used in real life appliactions &amp;lt;ref name=&amp;quot;Application&amp;quot;&amp;gt; [http://static.usenix.org/publications/library/proceedings/coots97/full_papers/garbinato/garbinato.pdf &amp;lt;/ref&amp;gt;. This article explains an interesting applications of the Strategy pattern which is to compose reliable Distributed Protocols. This paper does not contain any code but demonstrates the importance of strategy pattern in real life.&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
The page includes references that describe the usefulness, advantages and comparison of the Strategy pattern with other methodologies.&lt;br /&gt;
The reader can get a complete knowledge of the pattern by following the references given.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67501</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67501"/>
		<updated>2012-10-11T02:05:03Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)], Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
 1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
 2.	is a pre-defined structure.&lt;br /&gt;
 3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays[http://en.wikipedia.org/wiki/Array_data_structure] are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages[http://en.wikipedia.org/wiki/Object-oriented_programming], Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
*Refactoring [http://en.wikipedia.org/wiki/Refactoring]&lt;br /&gt;
*Code Reuse [http://en.wikipedia.org/wiki/Code_reuse]&lt;br /&gt;
*Java[http://en.wikipedia.org/wiki/Java_(programming_language)]&lt;br /&gt;
*Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67500</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67500"/>
		<updated>2012-10-11T02:04:03Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)], Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
 1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
 2.	is a pre-defined structure.&lt;br /&gt;
 3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays[http://en.wikipedia.org/wiki/Array_data_structure] are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages[http://en.wikipedia.org/wiki/Object-oriented_programming], Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
*Refactoring [http://en.wikipedia.org/wiki/Refactoring]&lt;br /&gt;
*Code Reuse [http://en.wikipedia.org/wiki/Code_reuse]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67499</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67499"/>
		<updated>2012-10-11T02:02:49Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)], Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
 1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
 2.	is a pre-defined structure.&lt;br /&gt;
 3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays[http://en.wikipedia.org/wiki/Array_data_structure] are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages[http://en.wikipedia.org/wiki/Object-oriented_programming], Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
[[Refactoring [http://en.wikipedia.org/wiki/Refactoring]]&lt;br /&gt;
[[Code Reuse [http://en.wikipedia.org/wiki/Code_reuse]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67498</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67498"/>
		<updated>2012-10-11T02:01:25Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)], Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
 1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
 2.	is a pre-defined structure.&lt;br /&gt;
 3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays[http://en.wikipedia.org/wiki/Array_data_structure] are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages[http://en.wikipedia.org/wiki/Object-oriented_programming], Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
1:Refactoring [http://en.wikipedia.org/wiki/Refactoring]&lt;br /&gt;
2:Code Reuse [http://en.wikipedia.org/wiki/Code_reuse]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67497</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67497"/>
		<updated>2012-10-11T01:59:06Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)], Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
 1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
 2.	is a pre-defined structure.&lt;br /&gt;
 3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays[http://en.wikipedia.org/wiki/Array_data_structure] are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages[http://en.wikipedia.org/wiki/Object-oriented_programming], Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67496</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67496"/>
		<updated>2012-10-11T01:54:37Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java[http://en.wikipedia.org/wiki/Java_(programming_language)]. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby[http://en.wikipedia.org/wiki/Ruby_(programming_language)], Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67495</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67495"/>
		<updated>2012-10-11T01:53:04Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object[http://en.wikipedia.org/wiki/Object_(computer_science)] of a class. A variable[http://en.wikipedia.org/wiki/Variable_(computer_science)] is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67493</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67493"/>
		<updated>2012-10-11T01:51:47Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language[http://en.wikipedia.org/wiki/Programming_language]. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67492</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67492"/>
		<updated>2012-10-11T01:50:55Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes[http://en.wikipedia.org/wiki/Classes_(computer_science)] and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67491</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=67491"/>
		<updated>2012-10-11T01:49:57Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66814</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66814"/>
		<updated>2012-10-04T00:09:43Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc Polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66811</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66811"/>
		<updated>2012-10-04T00:08:53Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[Polymorphism in object-oriented programming|Polymorphism]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66808</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66808"/>
		<updated>2012-10-04T00:07:13Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[Polymorphism_in_object-oriented_programming|Polymorphism]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66807</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66807"/>
		<updated>2012-10-04T00:06:54Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming|Polymorphism]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66803</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66803"/>
		<updated>2012-10-04T00:06:19Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[Polymorphism in object-oriented programming|Polymorphism]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66794</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66794"/>
		<updated>2012-10-04T00:03:17Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[polymorphism in object oriented languages]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66791</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66791"/>
		<updated>2012-10-04T00:02:54Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[polymorphism|in object oriented languages]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66784</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66784"/>
		<updated>2012-10-04T00:00:05Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc [[polymorphism]][http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66782</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66782"/>
		<updated>2012-10-03T23:57:27Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66779</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66779"/>
		<updated>2012-10-03T23:56:44Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Weak_typing &amp;lt;/ref&amp;gt; mainly because they support changing one data type to another implicitely [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Polymorphism_(computer_science) &amp;lt;/ref&amp;gt;. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. A class contains data field members to maintain the state and methods to define the desired behaviour of the class.&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Class_(computer_programming) &amp;lt;/ref&amp;gt; The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.”&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language&amp;lt;ref&amp;gt;http://www.ruby-doc.org/docs/ProgrammingRuby/&amp;lt;/ref&amp;gt;.  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. &lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.&amp;lt;ref&amp;gt;http://www.khelll.com/blog/ruby/ruby-reflection/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. &amp;lt;ref&amp;gt;http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html &amp;lt;/ref&amp;gt;&lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.&amp;lt;ref&amp;gt;http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/ &amp;lt;/ref&amp;gt; This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance.&amp;lt;ref&amp;gt;http://www.javaworld.com/javatips/jw-javatip107.html &amp;lt;/ref&amp;gt; Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66768</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66768"/>
		<updated>2012-10-03T23:50:11Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely Link to #REDIRECT [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66765</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66765"/>
		<updated>2012-10-03T23:49:39Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely Link to #REDIRECT [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;refrences /&amp;gt;&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66764</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66764"/>
		<updated>2012-10-03T23:48:42Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Strong_typing&amp;lt;/ref&amp;gt;. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely Link to #REDIRECT [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
{{reflist}}&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66746</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66746"/>
		<updated>2012-10-03T23:44:16Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned{{http://en.wikipedia.org/wiki/Strong_typing}}. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely Link to #REDIRECT [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66740</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66740"/>
		<updated>2012-10-03T23:42:32Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned[4]. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely Link to #REDIRECT [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66732</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66732"/>
		<updated>2012-10-03T23:39:49Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned[4]. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely Link to [[http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion]] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66724</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66724"/>
		<updated>2012-10-03T23:37:50Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned[4]. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html       &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)   &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66720</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66720"/>
		<updated>2012-10-03T23:36:45Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned[4]. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[http://en.wikipedia.org/wiki/Polymorphism]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection [http://en.wikipedia.org/wiki/Reflection_(computer_programming)], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap]&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html        &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66710</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w51</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w51&amp;diff=66710"/>
		<updated>2012-10-03T23:32:57Z</updated>

		<summary type="html">&lt;p&gt;Gsingh5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
It is often that we talk about classes and types in the context of a programming language. A programming language can be a strongly typed language or non-typed language with respect to its classes Every programming language has a way to define a variable which can be an object of a class. A variable is a named address location which stores a particular value. Now a class of an object (variable) defines the internal state and implementation details of the object whereas the type of the object define the behaviour of the object. Let us look into the concepts of classes and types in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types =&lt;br /&gt;
Let us explain the concept of a type and class using an analogy. Imagine a variable to be a vacant house. It could have animals, humans, robots, or another smaller house..There should be a way, from a third party perspective, so as to be cognizant of the kind of things that reside in the house. So in this case the house is the class and the thing (one of many possible) residing inside the house is type of the class i.e. house.  A typed language or a strongly typed language is one where the type of a variable has to be declared so as to avoid any wrong dealings of the value during run time. Here, values are restricted from performing certain operations based on the different data types assigned[4]. For example, Consider the strongly typed language - Java. If I need to use two integers for addition, I would explicitly have to mention them as an integer as shown in the below example.&lt;br /&gt;
  int integer1;&lt;br /&gt;
  int integer2;&lt;br /&gt;
However, we can’t then re-initialize the declared integer variables  to any other type in its defined scope. The following example throws an error, since we are trying to assign a string type to the integer variable.&lt;br /&gt;
  integer1 = “Hello World”;  // cannot map an int to a String&lt;br /&gt;
In the case of non-typed languages or weakly typed languages such as Ruby,, Visual Basic, etc, we don’t need to explicitly specify the type of the variable being declared. Consider the example shown below. &lt;br /&gt;
  def variable1;&lt;br /&gt;
  def variable2;&lt;br /&gt;
Now, the above defined variables,  could be initialized with any type of data. Hence, weakly typed languages are less restrictive[5] mainly because they support changing one data type to another implicitely [http://en.wikipedia.org/wiki/Implicit_type_conversion#Implicit_type_conversion] . The reason could also be that they support ad-hoc polymorphism where a uniform interface takes care of different data types assigned during run time.[7]. Sometimes both implicit conversion and ad-hoc polymorphism[[http://en.wikipedia.org/wiki/Polymorphism]]  are supported. [7]. Now let us assign different values for the defined variables. &lt;br /&gt;
 variable1 = 3&lt;br /&gt;
as well as&lt;br /&gt;
 variable1 = “Good morning Vietnam”&lt;br /&gt;
The above example shows that the variable1 can be assigned values of different types.&lt;br /&gt;
&lt;br /&gt;
= Classes=&lt;br /&gt;
&lt;br /&gt;
A class is a blueprint from which its instances can be created. [9][10]. A class contains data field members to maintain the state and methods to define the desired behaviour of the class. [10] The basic difference between a class and a regular primitive type is that a class:&lt;br /&gt;
1.	consists of one or more primitive or non-primitive variables.&lt;br /&gt;
2.	is a pre-defined structure.&lt;br /&gt;
3.	defines methods which operate on the internal state of the object.&lt;br /&gt;
The Type of Class is “Class”, just like the Type of integer is “integer” in case of strongly typed languages.&lt;br /&gt;
In case of Java:-&lt;br /&gt;
“The types of the Java programming language are divided into two categories: primitive types and reference types. The primitive types are the boolean type and the numeric types. The numeric types are the integral types byte, short, int, long, and char, and the floating-point types float and double. The reference types are class types, interface types, and array types. There is also a special null type. An object is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class Object. String literals are represented by String objects.” [2]&lt;br /&gt;
Now, let us look at 2 data types available in Java. They are:&lt;br /&gt;
 i.	Primitive Types.&lt;br /&gt;
 ii.	Reference Types.&lt;br /&gt;
Classes, Interfaces, Arrays are all consolidations of Primitive types, so they just need to “point” to or reference the primitive ones, hence the name. It is sometimes confusing and difficult to come up with a clear and robust distinction between Types and Classes. One might think &amp;quot;Class to be a Type of Type&amp;quot;. It is, however, important to know that in strict Object Oriented Languages, Type is a union of Classes and Primitives. &lt;br /&gt;
Let us look into the types and classes in few different languages defined below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Types and Classes in Languages =&lt;br /&gt;
&lt;br /&gt;
==Ruby==&lt;br /&gt;
Ruby claims to be a strong object oriented language[12].  It is object oriented to the extent that every thing is an object. Primitive datatypes are objects, and we can make use of the object oriented techniques,even on primitive data types.. As mentioned before, Ruby is a dynamic typed language, as the type is bound at compile time. Everything in Ruby has a class. Every class in Ruby is inherited from class Class. [12]&lt;br /&gt;
Type in Ruby is well defined as well. Using self inspection (known as reflection)[hyperlink 13], we can find out information about a class or object, during run time. Let us see this in action.&lt;br /&gt;
In the below example, as we can see, the “class” of number “5” is Fixnum and class of string “hello” is String.&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 &amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
  &lt;br /&gt;
But have you thought of your class as an object? Well that seems odd, but that’s how ruby works:&lt;br /&gt;
 5.class #=&amp;gt; Fixnum&lt;br /&gt;
 class Foo;end  #=&amp;gt; nil&lt;br /&gt;
 Foo.class #=&amp;gt; Class&lt;br /&gt;
What does the above snippet of code mean exactly? It means 2 things : Foo is a constant and that constant holds(refers to) an object of type “Class”.Let us prove that in the following  example.&lt;br /&gt;
 Foo = Class.new&lt;br /&gt;
 (irb):8 warning: already initialized constant Foo&lt;br /&gt;
 =&amp;gt; Foo&lt;br /&gt;
As we can see, we received a warning because we tried to initialize the constant Foo again.&lt;br /&gt;
Therefore ,when we define some class ‘Foo’ in ruby, we are mainly doing the following:: &lt;br /&gt;
1. Instantiating an object of type Class. &lt;br /&gt;
2. Initializing the constant Foo that refers to that created object .&lt;br /&gt;
Hence, when we say “object” ,then we do mean any object; an object of Class type, or any object of any type.[3]&lt;br /&gt;
&lt;br /&gt;
==Java==&lt;br /&gt;
As mentioned before, Java is a strongly typed language. The type of data needs to be declared before using. The types of &amp;quot;types&amp;quot; in Java are:&lt;br /&gt;
  * Primitive Types:-  boolean and numeric. The numeric types are the integral types byte, short, int, long, and char, and the         &lt;br /&gt;
    floating-point types float and double. &lt;br /&gt;
  * Reference Types:- class types, interface types and array types. [2] &lt;br /&gt;
Java is an object-oriented language, but it does make a clear distinction between the primitive type and Classes. The data types i.e. int, float, char etc. are primitive data types , and the data types,  other than the primitives are references. It is an interesting distinction to note, because of the differences in in the way methods are called in different languages. Java makes a distinction by using &amp;quot;call-by-value&amp;quot; when a primitive data types are passed as  parameters, and using &amp;quot;call-by-reference&amp;quot; when objects are passed. In fact, if a primitive data type is passed, a call-by-value is invoked, but when a Class object is passed, only a reference is passed to the object.&lt;br /&gt;
For a more language specific treatment of types and classes, you can refer: http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_6_ap&lt;br /&gt;
=Discussion of Issues=&lt;br /&gt;
Now, the question is, how do we make a choice between primitive data types and Class? &lt;br /&gt;
There are several features that each of the types provide. The decision is hard to make. Let us look into the advantages and disadvantages of each of the data types.&lt;br /&gt;
&lt;br /&gt;
=Primitive Types=&lt;br /&gt;
==Advantages==&lt;br /&gt;
===Simplicity===&lt;br /&gt;
In strongly typed languages, primitive types are ideal for data which doesn't necessarily need to be partitioned into several smaller components. If you are looking to store and represent a simple throw-away integer for looping, for example, there's little reason why one would want to construct a class for this throw-away integer purpose.&lt;br /&gt;
Primitive types are also often coupled with native operations.&lt;br /&gt;
For example, in Java, variables of type integer, are automatically given operations such as addition, subtraction, multiplication, and so on. In simple terms,  these operations work as follows:&lt;br /&gt;
1.	Receive both inputs required for performing the operation.&lt;br /&gt;
2.	Cast if necessary (for example, from an integer to a double)&lt;br /&gt;
3.	Perform the required calculation.&lt;br /&gt;
4.	Return the result.&lt;br /&gt;
It is important to note that the primitive types themselves are left unchanged, and the result is returned from the operation, giving the programmer the ability to place the result elsewhere.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Efficiency===&lt;br /&gt;
In efficiency-critical applications, primitive types and their operations are often mapped directly to hardware-supported equivalents, thus operations can be performed very quickly. This style of downgrading the logic to the hardware level has been replaced over the years for general applications, since improvements to hardware components have eradicated the once-imperative necessity to program efficiently. Another point of view concerning efficiency could be from development time: if the program, one is writing doesn't require complex design, it would be quicker to use the language's built-in types instead of taking the time to design a class, to do the same feature. &lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Single-state storage===&lt;br /&gt;
One of the biggest disadvantages of primitive types is that, they are generally capable of only holding a single dimension state.[15] This limitation requires the programmer to use other variables in conjunction if they desire to hold more than one field of data.&lt;br /&gt;
&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Since primitive types do not allow you to encapsulate your data, if you ever desire to change the behavior of your program, you are forced to manually check each use of the variable for enforcement.&lt;br /&gt;
For example, suppose you have a system designed in Java that maintains an integer value to represent the number of books you have in a library.&lt;br /&gt;
 int numBooks;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks = 0;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks++;&lt;br /&gt;
 ...&lt;br /&gt;
 numBooks--;&lt;br /&gt;
 ...&lt;br /&gt;
A few days later, you realize that you should probably refactor your system to maintain a log to capture the updates on this variable. You immediately face a problem since, as it is, your code directly manipulates a single-state type integer. Without resorting to a more object-oriented solution, you would have to update each location in the code, where a change takes place, in order to establish this bookkeeping (pun intended). Example is shown below:&lt;br /&gt;
 public static void integerValueChanged(){&lt;br /&gt;
  // records that the value has been changed&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
 public static void main(String[]args){&lt;br /&gt;
  int numBooks;&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks = 0;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks++;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
  numBooks--;&lt;br /&gt;
  integerValueChanged();&lt;br /&gt;
  ...&lt;br /&gt;
 }&lt;br /&gt;
To generalize this concept, it is often necessary, to modify &amp;quot;what happens&amp;quot; when something is updated, and this cannot be easily accomplished by merely using primitive types.&lt;br /&gt;
&lt;br /&gt;
=Class Types=&lt;br /&gt;
== Advantages==&lt;br /&gt;
===Multi-dimensional Storage===&lt;br /&gt;
Unlike primitive types, classes allow programmers to couple a varying number of fields. Grouping fields of data into a single class, then instantiating such an object and manipulating it is much more convenient than keeping track of several individual variables.&lt;br /&gt;
===Refactoring===&lt;br /&gt;
Oftentimes, it is necessary to refactor a system. to execute the code when a change happens. In object-land, we are able to do this through the ability to control what happens in our methods.&lt;br /&gt;
Taking our example from above, we can give a quick example of how a class could be defined to handle the situation much more elegantly.&lt;br /&gt;
 public class RecordedNumber{&lt;br /&gt;
  // The integer value, kept concealed in the class&lt;br /&gt;
  private int value;&lt;br /&gt;
  public RecordedNumber(int value){&lt;br /&gt;
    this.value = value;&lt;br /&gt;
  }&lt;br /&gt;
  public int getValue(){&lt;br /&gt;
    return value;&lt;br /&gt;
  }&lt;br /&gt;
  public void setValue(int newValue){&lt;br /&gt;
    // code to do any necessary recording.&lt;br /&gt;
    ...&lt;br /&gt;
    this.value = newValue;&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 public class MyExample{&lt;br /&gt;
  public static void main(String[]args){&lt;br /&gt;
    RecordedNumber numBooks = new RecordedNumber(0);&lt;br /&gt;
    ...&lt;br /&gt;
    numBooks.setValue(4); // the object handles all necessary bookkeeping&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Code-reuse===&lt;br /&gt;
Another useful feature of class-types, is the encapsulation of the concept of code re-usability, especially in topics such as inheritance. [16] Classes allow the programmer to enhance an already existing class-type and to make it more specific with additional features. This helps prevent excessive code duplication.&lt;br /&gt;
&lt;br /&gt;
===Application Structure===&lt;br /&gt;
Designing an application in an object-oriented / class-specific style can reduce the challenges of designing and building a difficult system into merely making objects successfully interact. It is from this concept that languages such as Unified Modeling Language (UML) have been created, allowing software engineers to build around the notion of classes and their relationships to one another.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages==&lt;br /&gt;
===Speed Considerations===&lt;br /&gt;
In computational-intensive applications, objects built from classes tend to be less efficient than primitive data types built around procedural context. This is due in part because of the object's creation, since it isn't supported directly at hardware level. Consideration is placed more so on good-design and coding-practices when implementing functionality around classes.&lt;br /&gt;
===Complexity===&lt;br /&gt;
Oftentimes one doesn't need the functionality provided by classes to handle the problem they are trying to solve. Consequently, such an unnecessary use, over-complicates the principle design and may add unnecessary burden to maintain the code. This is more so geared towards small-programs where objects and classes may not be the best fit for their implementation. Examples of this situation vary, since it is highly opinionated, but are more so an example of bad design in an object-oriented sense: to quote Albert Einstein, &amp;quot;Everything should be made as simple as possible, but no simpler.&amp;quot;&lt;br /&gt;
=References=&lt;br /&gt;
[1] A:http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[2] Java:- Types, Values and Variables: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html    &lt;br /&gt;
[3] Ruby Reflection ,http://www.khelll.com/blog/ruby/ruby-reflection/     &lt;br /&gt;
[4] http://en.wikipedia.org/wiki/Strong_typing     &lt;br /&gt;
[5] http://en.wikipedia.org/wiki/Weak_typing     &lt;br /&gt;
[6] http://en.wikipedia.org/wiki/Type_conversion (hyper link for type conversion)    &lt;br /&gt;
[7] http://en.wikipedia.org/wiki/Polymorphism_(computer_science)     &lt;br /&gt;
[8] http://docs.oracle.com/javase/tutorial/java/concepts/class.html     &lt;br /&gt;
[9] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[10] http://en.wikipedia.org/wiki/Class_(computer_programming)     &lt;br /&gt;
[11] http://www.tutorialspoint.com/java/java_basic_datatypes.htm     &lt;br /&gt;
[12] http://www.ruby-doc.org/docs/ProgrammingRuby/     &lt;br /&gt;
[13] http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html     &lt;br /&gt;
[14] http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html      &lt;br /&gt;
[15] http://www.sitepoint.com/beginning-java-data-types-variables-and-arrays/       &lt;br /&gt;
[16] http://www.javaworld.com/javatips/jw-javatip107.html&lt;/div&gt;</summary>
		<author><name>Gsingh5</name></author>
	</entry>
</feed>