<?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=Achandr6</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=Achandr6"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Achandr6"/>
	<updated>2026-05-17T01:00:05Z</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_2w35_av&amp;diff=71193</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71193"/>
		<updated>2012-11-20T11:05:35Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Factory Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here in this example, the MotifWidgetFactory has its own implementation of the createScrollBar and createWindow functions that instantiate MotifWindow and MotifScrollBar. This allows any number of newer types of objects to be created by just extending the abstract class and implementing the desired features. The clients call these operations to obtain the widget instances, but they'll never know which concrete classes have been used to create them. All the operations that are done by the client is done using the Abstract factory interface. &lt;br /&gt;
&lt;br /&gt;
Abstract factory pattern helps in achieving the following, &lt;br /&gt;
# a system should be independent of how its products are created, composed, and represented.&lt;br /&gt;
# a system should be configured with one of multiple families of products.&lt;br /&gt;
# a family of related product objects is designed to be used together, and you need to enforce this constraint.&lt;br /&gt;
# you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Factory Method == &lt;br /&gt;
&lt;br /&gt;
In factory method, a class defines interface for creating an object but lets the subclasses to decide which class to instantiate. Factory methods are used in the following situations. &lt;br /&gt;
# a class can't anticipate the class of objects it must create.&lt;br /&gt;
# a class wants its subclasses to specify the objects it creates.&lt;br /&gt;
# classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.&lt;br /&gt;
&lt;br /&gt;
In this method, there exists an Abstract Creator class, that is implemented by a ConcreteCreator class. The problem occurs when the ConcreteCreator has to create an object of Product class, but doesn't know the exact type of product is required by the object of ConcreteCreator. Such situations occur when there is no proper relation between the Product and Creator. So, it will not be possible to say that a particular type of Creator always requires a particular type of Product. So a method in ConcreteCreator is used to create an object of the required type and is therefore called a Factory method. &lt;br /&gt;
&lt;br /&gt;
The major difference between Builder pattern and Factory method is that, like Abstract factory there is no step by step process for the creation of an object. Factory method also provides a good way to connect parallel class hierarchies by allowing clients to access the factory methods for creating objects. A major advantage of using this methods is that, the factory methods can be as parameterized methods thus allowing to create a variety of different types of object as required by the Creator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prototype Method ==&lt;br /&gt;
&lt;br /&gt;
Prototype method allows to specify the kinds of objects to create using a prototypical instance and new objects can be created by copying this prototype. This approach is mainly useful when the type of object will  not be known until runtime. Some areas where prototyping proves useful are,&lt;br /&gt;
# when the classes to instantiate are specified at run-time, for example, by dynamic loading; or&lt;br /&gt;
# to avoid building a class hierarchy of factories that parallels the class hierarchy of products; or&lt;br /&gt;
# when instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state.&lt;br /&gt;
&lt;br /&gt;
One important aspect of the prototype method is that an object should be able to close itself in order to facilitate copying of the object. So when a clone of an object is obtained, that object can be used to represent more objects of similar type. Thus, the user need not remember more object types and the Concrete classes are hidden from the user. &lt;br /&gt;
Some of the advantages of Prototyping are,&lt;br /&gt;
# Adding and removing products at runtime - this allows the client to create any of the objects of the concrete classes at runtime by just using one prototype. Provides a much greater flexibility. &lt;br /&gt;
# Reduced Subclassing - This reduces the total number of subclasses that need to be created as the prototype method can simply call clone instead of asking a factory method to return an object. So, no creator class hierarchy is required, thus bettering Factory method in that aspect. &lt;br /&gt;
# applications can be configured dynamically.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71192</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71192"/>
		<updated>2012-11-20T10:49:08Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Factory Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here in this example, the MotifWidgetFactory has its own implementation of the createScrollBar and createWindow functions that instantiate MotifWindow and MotifScrollBar. This allows any number of newer types of objects to be created by just extending the abstract class and implementing the desired features. The clients call these operations to obtain the widget instances, but they'll never know which concrete classes have been used to create them. All the operations that are done by the client is done using the Abstract factory interface. &lt;br /&gt;
&lt;br /&gt;
Abstract factory pattern helps in achieving the following, &lt;br /&gt;
# a system should be independent of how its products are created, composed, and represented.&lt;br /&gt;
# a system should be configured with one of multiple families of products.&lt;br /&gt;
# a family of related product objects is designed to be used together, and you need to enforce this constraint.&lt;br /&gt;
# you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Factory Method == &lt;br /&gt;
&lt;br /&gt;
In factory method, a class defines interface for creating an object but lets the subclasses to decide which class to instantiate. Factory methods are used in the following situations. &lt;br /&gt;
# a class can't anticipate the class of objects it must create.&lt;br /&gt;
# a class wants its subclasses to specify the objects it creates.&lt;br /&gt;
# classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.&lt;br /&gt;
&lt;br /&gt;
In this method, there exists an Abstract Creator class, that is implemented by a ConcreteCreator class. The problem occurs when the ConcreteCreator has to create an object of Product class, but doesn't know the exact type of product is required by the object of ConcreteCreator. Such situations occur when there is no proper relation between the Product and Creator. So, it will not be possible to say that a particular type of Creator always requires a particular type of Product. So a method in ConcreteCreator is used to create an object of the required type and is therefore called a Factory method. &lt;br /&gt;
&lt;br /&gt;
The major difference between Builder pattern and Factory method is that, like Abstract factory there is no step by step process for the creation of an object. Factory method also provides a good way to connect parallel class hierarchies by allowing clients to access the factory methods for creating objects. A major advantage of using this methods is that, the factory methods can be as parameterized methods thus allowing to create a variety of different types of object as required by the Creator.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71191</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71191"/>
		<updated>2012-11-20T10:41:26Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here in this example, the MotifWidgetFactory has its own implementation of the createScrollBar and createWindow functions that instantiate MotifWindow and MotifScrollBar. This allows any number of newer types of objects to be created by just extending the abstract class and implementing the desired features. The clients call these operations to obtain the widget instances, but they'll never know which concrete classes have been used to create them. All the operations that are done by the client is done using the Abstract factory interface. &lt;br /&gt;
&lt;br /&gt;
Abstract factory pattern helps in achieving the following, &lt;br /&gt;
# a system should be independent of how its products are created, composed, and represented.&lt;br /&gt;
# a system should be configured with one of multiple families of products.&lt;br /&gt;
# a family of related product objects is designed to be used together, and you need to enforce this constraint.&lt;br /&gt;
# you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Factory Method == &lt;br /&gt;
&lt;br /&gt;
In factory method, a class defines interface for creating an object but lets the subclasses to decide which class to instantiate. Factory methods are used in the following situations. &lt;br /&gt;
# a class can't anticipate the class of objects it must create.&lt;br /&gt;
# a class wants its subclasses to specify the objects it creates.&lt;br /&gt;
# classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.&lt;br /&gt;
&lt;br /&gt;
In this method, there exists an Abstract Creator class, that is implemented by a ConcreteCreator class. The problem occurs when the ConcreteCreator has to create an object of Product class, but doesn't know the exact type of product is required by the object of ConcreteCreator. Such situations occur when there is no proper relation between the Product and Creator. So, it will not be possible to say that a particular type of Creator always requires a particular type of Product. So a method in ConcreteCreator is used to create an object of the required type and is therefore called a Factory method. &lt;br /&gt;
&lt;br /&gt;
The major difference between Builder pattern and Factory method is that&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71190</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71190"/>
		<updated>2012-11-20T09:35:42Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here in this example, the MotifWidgetFactory has its own implementation of the createScrollBar and createWindow functions that instantiate MotifWindow and MotifScrollBar. This allows any number of newer types of objects to be created by just extending the abstract class and implementing the desired features. The clients call these operations to obtain the widget instances, but they'll never know which concrete classes have been used to create them. All the operations that are done by the client is done using the Abstract factory interface. &lt;br /&gt;
&lt;br /&gt;
Abstract factory pattern helps in achieving the following, &lt;br /&gt;
# a system should be independent of how its products are created, composed, and represented.&lt;br /&gt;
# a system should be configured with one of multiple families of products.&lt;br /&gt;
# a family of related product objects is designed to be used together, and you need to enforce this constraint.&lt;br /&gt;
# you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71189</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71189"/>
		<updated>2012-11-20T09:35:07Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract.PNG]]&lt;br /&gt;
&lt;br /&gt;
Here in this example, the MotifWidgetFactory has its own implementation of the createScrollBar and createWindow functions that instantiate MotifWindow and MotifScrollBar. This allows any number of newer types of objects to be created by just extending the abstract class and implementing the desired features. The clients call these operations to obtain the widget instances, but they'll never know which concrete classes have been used to create them. All the operations that are done by the client is done using the Abstract factory interface. &lt;br /&gt;
&lt;br /&gt;
Abstract factory pattern helps in achieving the following, &lt;br /&gt;
* a system should be independent of how its products are created, composed, and represented.&lt;br /&gt;
* a system should be configured with one of multiple families of products.&lt;br /&gt;
* a family of related product objects is designed to be used together, and you need to enforce this&lt;br /&gt;
constraint.&lt;br /&gt;
* you want to provide a class library of products, and you want to reveal just their interfaces, not&lt;br /&gt;
their implementations&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71188</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71188"/>
		<updated>2012-11-20T08:53:15Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Abstract.PNG&amp;diff=71187</id>
		<title>File:Abstract.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Abstract.PNG&amp;diff=71187"/>
		<updated>2012-11-20T08:52:36Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71186</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71186"/>
		<updated>2012-11-20T08:48:21Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Consider a case where we need to define a different look and feel for different operating systems or profiles. Hard coding them into each type can result in code duplication and also a poor quality code. This is where abstract factory pattern comes to use. A common factory class can be created for declaring an interface for creating each look and feel. Then, a concrete class can be created for each type of look and feel that we want and just implementing the required effects in the interfaces. An example of using Abstract factory to define different widget interfaces is shown here.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71185</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71185"/>
		<updated>2012-11-20T08:25:24Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71184</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71184"/>
		<updated>2012-11-20T08:24:50Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71183</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71183"/>
		<updated>2012-11-20T08:24:38Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71182</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71182"/>
		<updated>2012-11-20T08:24:06Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Abstract Factory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory Wiki&amp;lt;/ref&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71181</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w35 av</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w35_av&amp;diff=71181"/>
		<updated>2012-11-20T08:21:38Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Builder pattern and the related patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most complex tasks in creating a software is designing it to meet the needs of the user. Designing an object-oriented components of software that is reusable is hard. One must find pertinent objects, factor them into classes at the right granularity, define class interfaces and inheritance hierarchies, and establish key relationships among them. It should also be taken care that the design is specific to a problem at hand and also general enough to accommodate future changes. Knowledge of design patterns helps in such scenarios. Essentially, Design patterns describe a problem which occurs over and over again in an environment, and then describes the core of the solution to that problem, in such a way that one can use this solution a million times over, without ever doing it the same way twice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Classes of Design Patterns ==&lt;br /&gt;
&lt;br /&gt;
Design patterns are generally classified into the one of the following three categories.&lt;br /&gt;
&lt;br /&gt;
Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.&lt;br /&gt;
&lt;br /&gt;
Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.&lt;br /&gt;
&lt;br /&gt;
Behavioral Pattern, which are concerned with communication between objects.&lt;br /&gt;
&lt;br /&gt;
== Builder Pattern ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intent of Builder pattern is to separate the construction of a complex object from its representation so that the same construction process can create different representations. According to GOF [http://en.wikipedia.org/wiki/Design_Patterns[1]], the builder pattern can be applied when &amp;lt;br&amp;gt;&lt;br /&gt;
1. The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled. &amp;lt;br&amp;gt;&lt;br /&gt;
2. The construction process must allow different representations for the object that's constructed. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider an example for builder pattern. Consider a word processing software that should have the ability to convert Microsoft word's DOC to many text formats. The reader might convert *.DOC documents into plain ASCII text or into a PDF. The problem, however, is that the number of possible conversions is open-ended. So it should be easy to add a new conversion without modifying the reader.&lt;br /&gt;
&lt;br /&gt;
A solution is to configure the DOCReader class with a TextConverter object that converts DOC to another textual representation. As the DOCReader parses the DOC document, it uses the TextConverter to perform the conversion. Whenever the DOCReader recognizes an DOC token (either plain text or an RTF control word), it issues a request to the TextConverter to convert the token. TextConverter objects are responsible both for performing the data conversion and for representing the token in a particular format. Subclasses of TextConverter specialize in different conversions and formats. For example, an PlainTextConverter ignores requests to convert anything except plain text. A LaTeXConverter, on the other hand, will implement operations for all requests in order to produce a LaTeX representation that captures all the stylistic information in the text.&lt;br /&gt;
&lt;br /&gt;
Each kind of converter class takes the mechanism for creating and assembling a complex object and puts it behind an abstract interface. The converter is separate from the reader, which is responsible for parsing an DOC document. Converter class designed as discussed above basically defines the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Image_builder_av.png]]&lt;br /&gt;
&lt;br /&gt;
== Abstract Factory ==&lt;br /&gt;
&lt;br /&gt;
Abstract factory method, also known as Kit, provide an interface for creating families of related or dependent objects without specifying their concrete classes. The major difference between Abstract factory and builder pattern is that the focus with builder pattern is on 'step-by-step' object creation but with abstract factory, there is no step by step object creation. The object that is being created is usually created immediately and returned to the caller. The client software creates a concrete implementation of the abstract factory class and then uses the generic interfaces defined by the abstract factory to create the concrete objects according to the requirement.&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65479</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65479"/>
		<updated>2012-09-21T21:16:15Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Not Scalable */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages''' - based on the [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch3_3h_ss wiki page] from previous year &lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/C%2B%2B C++ an extension of C&amp;lt;/ref&amp;gt;. They are described below &amp;lt;ref&amp;gt;http://en.cppreference.com/w/cpp/language/types List of C++ data types&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Wide_character Wide Character in C++ &amp;lt;/ref&amp;gt;&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type &lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html Java data types&amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned&amp;lt;ref&amp;gt;http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html Java Primitive datatypes &amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below&amp;lt;ref&amp;gt;http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx C# data types &amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum &amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html Integer in Ruby &amp;lt;/ref&amp;gt;&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word&amp;lt;ref&amp;gt; http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_fixnum.html Fixnum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html Bignum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html String &amp;lt;/ref&amp;gt;&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html Float &amp;lt;/ref&amp;gt;&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html TrueClass &amp;lt;/ref&amp;gt;&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html FalseClass&amp;lt;/ref&amp;gt;&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side&amp;lt;ref&amp;gt;http://chaoticjava.com/posts/autoboxing-tips/ Autoboxing in Java&amp;lt;/ref&amp;gt;. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects&amp;lt;ref&amp;gt;http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue autoboxing performance issues&amp;lt;/ref&amp;gt;. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue this]. Also, the discussion in this [http://stackoverflow.com/questions/8001988/where-and-when-the-use-of-primitive-data-types-in-java-is-effectively-appropriat page] describes just how the use of wrapper classes in Java takes up more memory during run time than when using primitive objects. It also provides sample programs to see this difference in our systems. &lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables, which is hard to do&amp;lt;ref&amp;gt;http://wiki.answers.com/Q/What_are_the_advantages_of_arrays_in_java arrays more scalable than primitive types&amp;lt;/ref&amp;gt;. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs).&lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
In languages that do not support pointers, such collection objects also do not restrict the user from having a fixed number of entries&amp;lt;ref&amp;gt; http://stackoverflow.com/questions/4842883/are-there-reasons-to-prefer-arrays-over-arraylists ArrayLists better than Arrays &amp;lt;/ref&amp;gt;. The number of entries in such a list can vary dynamically. Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential&amp;lt;ref&amp;gt;http://stackoverflow.com/questions/2509025/when-to-use-primitive-and-when-reference-types-in-java When and when not to use primitives&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65478</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65478"/>
		<updated>2012-09-21T20:45:59Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Utility Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages''' - based on the [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch3_3h_ss wiki page] from previous year &lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/C%2B%2B C++ an extension of C&amp;lt;/ref&amp;gt;. They are described below &amp;lt;ref&amp;gt;http://en.cppreference.com/w/cpp/language/types List of C++ data types&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Wide_character Wide Character in C++ &amp;lt;/ref&amp;gt;&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type &lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html Java data types&amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned&amp;lt;ref&amp;gt;http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html Java Primitive datatypes &amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below&amp;lt;ref&amp;gt;http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx C# data types &amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum &amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html Integer in Ruby &amp;lt;/ref&amp;gt;&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word&amp;lt;ref&amp;gt; http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_fixnum.html Fixnum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html Bignum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html String &amp;lt;/ref&amp;gt;&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html Float &amp;lt;/ref&amp;gt;&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html TrueClass &amp;lt;/ref&amp;gt;&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html FalseClass&amp;lt;/ref&amp;gt;&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side&amp;lt;ref&amp;gt;http://chaoticjava.com/posts/autoboxing-tips/ Autoboxing in Java&amp;lt;/ref&amp;gt;. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects&amp;lt;ref&amp;gt;http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue autoboxing performance issues&amp;lt;/ref&amp;gt;. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue this]. Also, the discussion in this [http://stackoverflow.com/questions/8001988/where-and-when-the-use-of-primitive-data-types-in-java-is-effectively-appropriat page] describes just how the use of wrapper classes in Java takes up more memory during run time than when using primitive objects. It also provides sample programs to see this difference in our systems. &lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables, which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs).&lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
In languages that do not support pointers, such collection objects also do not restrict the user from having a fixed number of entries&amp;lt;ref&amp;gt; http://stackoverflow.com/questions/4842883/are-there-reasons-to-prefer-arrays-over-arraylists ArrayLists better than Arrays &amp;lt;/ref&amp;gt;. The number of entries in such a list can vary dynamically. Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them.&lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential&amp;lt;ref&amp;gt;http://stackoverflow.com/questions/2509025/when-to-use-primitive-and-when-reference-types-in-java When and when not to use primitives&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65321</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65321"/>
		<updated>2012-09-20T01:52:40Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Not Scalable */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages''' - based on the [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch3_3h_ss wiki page] from previous year &lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/C%2B%2B C++ an extension of C&amp;lt;/ref&amp;gt;. They are described below &amp;lt;ref&amp;gt;http://en.cppreference.com/w/cpp/language/types List of C++ data types&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Wide_character Wide Character in C++ &amp;lt;/ref&amp;gt;&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type &lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html Java data types&amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned&amp;lt;ref&amp;gt;http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html Java Primitive datatypes &amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below&amp;lt;ref&amp;gt;http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx C# data types &amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum &amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html Integer in Ruby &amp;lt;/ref&amp;gt;&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word&amp;lt;ref&amp;gt; http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_fixnum.html Fixnum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html Bignum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html String &amp;lt;/ref&amp;gt;&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html Float &amp;lt;/ref&amp;gt;&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html TrueClass &amp;lt;/ref&amp;gt;&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html FalseClass&amp;lt;/ref&amp;gt;&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side&amp;lt;ref&amp;gt;http://chaoticjava.com/posts/autoboxing-tips/ Autoboxing in Java&amp;lt;/ref&amp;gt;. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects&amp;lt;ref&amp;gt;http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue autoboxing performance issues&amp;lt;/ref&amp;gt;. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue this]. Also, the discussion in this [http://stackoverflow.com/questions/8001988/where-and-when-the-use-of-primitive-data-types-in-java-is-effectively-appropriat page] describes just how the use of wrapper classes in Java takes up more memory during run time than when using primitive objects. It also provides sample programs to see this difference in our systems. &lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables, which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs).&lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential&amp;lt;ref&amp;gt;http://stackoverflow.com/questions/2509025/when-to-use-primitive-and-when-reference-types-in-java When and when not to use primitives&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65320</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=65320"/>
		<updated>2012-09-20T01:42:25Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages''' - based on the [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch3_3h_ss wiki page] from previous year &lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/C%2B%2B C++ an extension of C&amp;lt;/ref&amp;gt;. They are described below &amp;lt;ref&amp;gt;http://en.cppreference.com/w/cpp/language/types List of C++ data types&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Wide_character Wide Character in C++ &amp;lt;/ref&amp;gt;&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type &lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html Java data types&amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned&amp;lt;ref&amp;gt;http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html Java Primitive datatypes &amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below&amp;lt;ref&amp;gt;http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx C# data types &amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum &amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html Integer in Ruby &amp;lt;/ref&amp;gt;&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word&amp;lt;ref&amp;gt; http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_fixnum.html Fixnum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html Bignum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html String &amp;lt;/ref&amp;gt;&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html Float &amp;lt;/ref&amp;gt;&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html TrueClass &amp;lt;/ref&amp;gt;&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html FalseClass&amp;lt;/ref&amp;gt;&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side&amp;lt;ref&amp;gt;http://chaoticjava.com/posts/autoboxing-tips/ Autoboxing in Java&amp;lt;/ref&amp;gt;. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects&amp;lt;ref&amp;gt;http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue autoboxing performance issues&amp;lt;/ref&amp;gt;. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue this]. Also, the discussion in this [http://stackoverflow.com/questions/8001988/where-and-when-the-use-of-primitive-data-types-in-java-is-effectively-appropriat page] describes just how the use of wrapper classes in Java takes up more memory during run time than when using primitive objects. It also provides sample programs to see this difference in our systems. &lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential&amp;lt;ref&amp;gt;http://stackoverflow.com/questions/2509025/when-to-use-primitive-and-when-reference-types-in-java When and when not to use primitives&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64123</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64123"/>
		<updated>2012-09-13T21:34:46Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages'''&lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C&amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/C%2B%2B C++ an extension of C&amp;lt;/ref&amp;gt;. They are described below &amp;lt;ref&amp;gt;http://en.cppreference.com/w/cpp/language/types List of C++ data types&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters &amp;lt;ref&amp;gt;http://en.wikipedia.org/wiki/Wide_character Wide Character in C++ &amp;lt;/ref&amp;gt;&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type &lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows&amp;lt;ref&amp;gt;http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html Java data types&amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned&amp;lt;ref&amp;gt;http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html Java Primitive datatypes &amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below&amp;lt;ref&amp;gt;http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx C# data types &amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum &amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html Integer in Ruby &amp;lt;/ref&amp;gt;&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word&amp;lt;ref&amp;gt; http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_fixnum.html Fixnum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html Bignum&amp;lt;/ref&amp;gt; &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html String &amp;lt;/ref&amp;gt;&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html Float &amp;lt;/ref&amp;gt;&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html TrueClass &amp;lt;/ref&amp;gt;&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html FalseClass&amp;lt;/ref&amp;gt;&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side&amp;lt;ref&amp;gt;http://chaoticjava.com/posts/autoboxing-tips/ Autoboxing in Java&amp;lt;/ref&amp;gt;. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects&amp;lt;ref&amp;gt;http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue autoboxing performance issues&amp;lt;/ref&amp;gt;. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue this]. Also, the discussion in this [http://stackoverflow.com/questions/8001988/where-and-when-the-use-of-primitive-data-types-in-java-is-effectively-appropriat page] describes just how the use of wrapper classes in Java takes up more memory during run time than when using primitive objects. It also provides sample programs to see this difference in our systems. &lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential&amp;lt;ref&amp;gt;http://stackoverflow.com/questions/2509025/when-to-use-primitive-and-when-reference-types-in-java When and when not to use primitives&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64098</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64098"/>
		<updated>2012-09-13T20:57:51Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages'''&lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side[http://chaoticjava.com/posts/autoboxing-tips/]. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
=== Ease of use ===&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential.  &lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64091</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64091"/>
		<updated>2012-09-13T20:52:41Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Primitive objects in object-oriented languages'''&lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.&lt;br /&gt;
&lt;br /&gt;
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.&lt;br /&gt;
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc. &lt;br /&gt;
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.&lt;br /&gt;
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.&lt;br /&gt;
* Strings - Strings represent the sequences of characters or simply any text, e.g. &amp;quot;Hello!&amp;quot;, &amp;quot;9 am to 6 pm&amp;quot;, etc. &lt;br /&gt;
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.&lt;br /&gt;
&lt;br /&gt;
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
&lt;br /&gt;
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).&lt;br /&gt;
&lt;br /&gt;
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.&lt;br /&gt;
&lt;br /&gt;
== Primitive objects in different OO languages  ==&lt;br /&gt;
&lt;br /&gt;
=== C++===&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
=== Java ===&lt;br /&gt;
There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Besides these 8 primitive data types java provides support to character strings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Also, for each of these primitive types, Java provides [http://en.wikipedia.org/wiki/Primitive_wrapper_class wrapper classes] to create primitive objects which wrap the primitive data values. A wrapper  not only contains the primitive data value, but it also defines properties and methods that can be used to manipulate that data. In Java, the primitive values are not implicitly converted to primitive objects. Instead, methods are provided for doing explicit conversion.&lt;br /&gt;
The primitive objects are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack heap] in memory while the variables containing primitive values are stored on [http://www.maxi-pedia.com/what+is+heap+and+stack stack].&amp;lt;ref&amp;gt;http://www.informit.com/articles/article.aspx?p=31755&amp;amp;seqNum=8 Stack and Heap memory&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class!! Size&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean || 1-bit&lt;br /&gt;
|-&lt;br /&gt;
| char || Character || 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| byte || Byte || 8-bit&lt;br /&gt;
|-&lt;br /&gt;
| short || Short || 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| int || Integer || 32-bit&lt;br /&gt;
|-&lt;br /&gt;
| long || Long || 64-bit&lt;br /&gt;
|-&lt;br /&gt;
| float || Float || 32-bit&lt;br /&gt;
|-&lt;br /&gt;
| double || Double || 64-bit&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 20;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I+II);            &lt;br /&gt;
    System.out.println(I.equals(II));    &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    30&lt;br /&gt;
    false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find out if these wrapper classes are primitive or not, we can use the isPrimitive() method.&lt;br /&gt;
&lt;br /&gt;
    System.out.println(INTEGER.TYPE.isPrimitive());&lt;br /&gt;
    System.out.println(BOOLEAN.TYPE.isPrimitive());&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    true&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Java, the comparison operations work in the same way on the primitive objects as well as any other class objects but different on the primitive types. The == operator when used on objects checks whether they refer to the same object but when used on variables of primitive types checks whether they contain the same value.&amp;lt;ref&amp;gt;http://leepoint.net/notes-java/data/expressions/22compareobjects.html Comparisons in Java&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
    int i = 10;&lt;br /&gt;
    int ii = 10;&lt;br /&gt;
    Integer I = new Integer(i);&lt;br /&gt;
    Integer II = new Integer(ii);&lt;br /&gt;
    System.out.println(I==II);            &lt;br /&gt;
    System.out.println(i==ii);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    false&lt;br /&gt;
    true&lt;br /&gt;
&lt;br /&gt;
===C# ===&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29 C#] is a [http://en.wikipedia.org/wiki/Strong_typing strongly typed] language, where it is necessary to declare the data type of a variable and also be aware of the data type conversion. C# provides a significant number of primitive data types.&amp;lt;ref&amp;gt;http://condor.depaul.edu/sjost/ndp/notes/cs1/CSDatatypes.htm C# Primitive Datatypes&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;http://www.java2s.com/Tutorial/CSharp/0040__Data-Type/PrimitivesinC.htm Primitives in C#&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type. For example:&lt;br /&gt;
 &lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        int x = 7;&lt;br /&gt;
        object o = x;&lt;br /&gt;
        System.Console.WriteLine(o.ToString());&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Some data types (e.g. Decimal and String) can appear like primitives at first sight, but are actually not. So it is important to exercise caution before making such assumptions. To test whether a particular type is a primitive or not you can use the property Type.IsPrimitive.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
    if (t.IsPrimitive)    // where t is the type&lt;br /&gt;
    {&lt;br /&gt;
        // Is Primitive&lt;br /&gt;
    } else if (t == typeof(Decimal))&lt;br /&gt;
    {&lt;br /&gt;
        // Is Decimal&lt;br /&gt;
    } else if (t == typeof(String))&lt;br /&gt;
    {&lt;br /&gt;
        // Is String&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        // Other type&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
===JavaScript===&lt;br /&gt;
&lt;br /&gt;
There are 5 primitive data types in [http://en.wikipedia.org/wiki/JavaScript JavaScript]: string, number, boolean, null and undefined. &amp;lt;ref&amp;gt;http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html JavaScript Data Types and Variables&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For string, number and boolean values, there are corresponding classes just like in Java to create primitive objects which wrap the primitive values. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|-&lt;br /&gt;
! Primitive Type !! Wrapper Class&lt;br /&gt;
|-&lt;br /&gt;
| string || String&lt;br /&gt;
|-&lt;br /&gt;
| number|| Number&lt;br /&gt;
|-&lt;br /&gt;
| boolean || Boolean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In JavaScript, the primitive value is implicitly converted to a primitive object whenever someone tries to access a property or invoke a method on the primitive value and the primitive object is used in place of the primitive value. Since the object contains properties and methods, the use of primitive value as an object succeeds. After the property is accessed or the method is processed, the primitive object is no longer needed and hence discarded. The same is true for the other primitive types and their corresponding primitive objects.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    var upperCaseString = &amp;quot;APPLE&amp;quot;;&lt;br /&gt;
    var lowerCaseString = upperCaseString.toLowerCase();  // assigns string &amp;quot;apple&amp;quot; to lowerCaseString &lt;br /&gt;
    var s = &amp;quot;Hello&amp;quot;&lt;br /&gt;
    var len = s.length;                                   // assigns value 5 to len&lt;br /&gt;
&lt;br /&gt;
===Ruby ===&lt;br /&gt;
Since [http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 Ruby] is a [http://www.jvoegele.com/software/langcomp.html pure object oriented] language, everything in Ruby is an object. Hence, all primitive types such as integers, floating point numbers, strings, are objects of a built-in class.&amp;lt;ref&amp;gt;http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Classes in Ruby&amp;lt;/ref&amp;gt; Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All integers are primitive objects of either class [http://corelib.rubyonrails.org/classes/Fixnum.html Fixnum] or [http://corelib.rubyonrails.org/classes/Bignum.html Bignum]. A numeric literal with a decimal point and/or an exponent is a primitive object of [http://corelib.rubyonrails.org/classes/Float.html Float]. Single quoted literals and double quoted literals are primitive objects of [http://corelib.rubyonrails.org/classes/String.html String].&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
    puts 10.class&lt;br /&gt;
    puts 7.45.class&lt;br /&gt;
    puts 'hi'.class&lt;br /&gt;
    puts &amp;quot;hello&amp;quot;.class&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
    Fixnum&lt;br /&gt;
    Float&lt;br /&gt;
    String&lt;br /&gt;
    String&lt;br /&gt;
&lt;br /&gt;
This indicates that 10 is converted into an object of type Fixnum, 7.45 is converted into an object of type Float, 'hi' and &amp;quot;hello&amp;quot; are both converted into an object of type String.&lt;br /&gt;
&lt;br /&gt;
Since all primitive types in Ruby are objects, we should be able to call methods of the Object class on them. Let us demonstrate the same for integer and float using the following example:&lt;br /&gt;
&lt;br /&gt;
    a=10&lt;br /&gt;
    puts a.to_f  &lt;br /&gt;
    b=20.5&lt;br /&gt;
    puts b.to_i&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
    10.0&lt;br /&gt;
    20&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side[http://chaoticjava.com/posts/autoboxing-tips/]. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
=== Ease of use ===&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential.  &lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64027</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64027"/>
		<updated>2012-09-13T08:57:21Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Better Speed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those data types that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. They are basic or in-built types that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages provide more support for them by supporting most basic operations. In dynamically typed languages like Ruby, these data types are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Java provides wrapper classes for these primitive types and objects of those classes form primitive objects. For example, for the primitive data type ''int'', the Integer class acts as a wrapper class that provides a lot of utility methods like &amp;lt;code&amp;gt;parseInt()&amp;lt;/code&amp;gt; and constants like &amp;lt;code&amp;gt;MAX_VALUE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MIN_VALUE&amp;lt;/code&amp;gt; that can be used on an Integer object. The other wrapper classes that Java provides for these primitive classes are Integer, Double, Float, Character, Boolean, Long and Short.&lt;br /&gt;
&lt;br /&gt;
 int i = Integer.parseInt(&amp;quot;50&amp;quot;);&lt;br /&gt;
 System.out.println(i);&lt;br /&gt;
 System.out.println(Integer.MAX_VALUE);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 50&lt;br /&gt;
 2147483647&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Efficiency ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side[http://chaoticjava.com/posts/autoboxing-tips/]. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it.&lt;br /&gt;
&lt;br /&gt;
=== Ease of use ===&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential.  &lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64026</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64026"/>
		<updated>2012-09-13T08:56:56Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Advantages of using primitive data types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those data types that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. They are basic or in-built types that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages provide more support for them by supporting most basic operations. In dynamically typed languages like Ruby, these data types are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Java provides wrapper classes for these primitive types and objects of those classes form primitive objects. For example, for the primitive data type ''int'', the Integer class acts as a wrapper class that provides a lot of utility methods like &amp;lt;code&amp;gt;parseInt()&amp;lt;/code&amp;gt; and constants like &amp;lt;code&amp;gt;MAX_VALUE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MIN_VALUE&amp;lt;/code&amp;gt; that can be used on an Integer object. The other wrapper classes that Java provides for these primitive classes are Integer, Double, Float, Character, Boolean, Long and Short.&lt;br /&gt;
&lt;br /&gt;
 int i = Integer.parseInt(&amp;quot;50&amp;quot;);&lt;br /&gt;
 System.out.println(i);&lt;br /&gt;
 System.out.println(Integer.MAX_VALUE);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 50&lt;br /&gt;
 2147483647&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Better Speed ===&lt;br /&gt;
Use of primitive data types takes less time to execute than a similar program that executes using object types. This is mainly because, when using object types, a lot of function calls are done implicitly to get the variables necessary for the operation. Consider the following example,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Integer a = new Integer(20);&lt;br /&gt;
Integer b = new Integer(30);&lt;br /&gt;
Integer c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;code&amp;gt;a+b&amp;lt;/code&amp;gt; is executed, the line implicitly changes to &amp;lt;code&amp;gt;c.valueOf(a.intValue() + b.intValue())&amp;lt;/code&amp;gt; on the right hand side[http://chaoticjava.com/posts/autoboxing-tips/]. This increases the number of function calls and so takes up more time to execute. This is the case for all objects. This delay is not present when primitive data types are used as the actual data is fetched from memory instead of calling another function to retrieve it. &lt;br /&gt;
&lt;br /&gt;
=== Ease of use ===&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop. Using objects in this place would make the program difficult to understand and tedious for the programmer.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential.  &lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63995</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63995"/>
		<updated>2012-09-13T07:59:09Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Disadvantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those data types that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. They are basic or in-built types that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages provide more support for them by supporting most basic operations. In dynamically typed languages like Ruby, these data types are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Java provides wrapper classes for these primitive types and objects of those classes form primitive objects. For example, for the primitive data type ''int'', the Integer class acts as a wrapper class that provides a lot of utility methods like &amp;lt;code&amp;gt;parseInt()&amp;lt;/code&amp;gt; and constants like &amp;lt;code&amp;gt;MAX_VALUE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MIN_VALUE&amp;lt;/code&amp;gt; that can be used on an Integer object. The other wrapper classes that Java provides for these primitive classes are Integer, Double, Float, Character, Boolean, Long and Short.&lt;br /&gt;
&lt;br /&gt;
 int i = Integer.parseInt(&amp;quot;50&amp;quot;);&lt;br /&gt;
 System.out.println(i);&lt;br /&gt;
 System.out.println(Integer.MAX_VALUE);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 50&lt;br /&gt;
 2147483647&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Ease of use ===&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
=== Lack of inheritance capability ===&lt;br /&gt;
The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
=== Not Scalable ===&lt;br /&gt;
Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
=== Utility Functions === &lt;br /&gt;
The presence of utility functions for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
=== Null Values === &lt;br /&gt;
Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential.  &lt;br /&gt;
&lt;br /&gt;
=== Unexpected results due to method overriding === &lt;br /&gt;
There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63992</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63992"/>
		<updated>2012-09-13T07:56:39Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Disadvantages of using primitive data types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those data types that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. They are basic or in-built types that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages provide more support for them by supporting most basic operations. In dynamically typed languages like Ruby, these data types are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Java provides wrapper classes for these primitive types and objects of those classes form primitive objects. For example, for the primitive data type ''int'', the Integer class acts as a wrapper class that provides a lot of utility methods like &amp;lt;code&amp;gt;parseInt()&amp;lt;/code&amp;gt; and constants like &amp;lt;code&amp;gt;MAX_VALUE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MIN_VALUE&amp;lt;/code&amp;gt; that can be used on an Integer object. The other wrapper classes that Java provides for these primitive classes are Integer, Double, Float, Character, Boolean, Long and Short.&lt;br /&gt;
&lt;br /&gt;
 int i = Integer.parseInt(&amp;quot;50&amp;quot;);&lt;br /&gt;
 System.out.println(i);&lt;br /&gt;
 System.out.println(Integer.MAX_VALUE);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 50&lt;br /&gt;
 2147483647&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
==Advantages of using primitive data types==&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
=== Ease of use ===&lt;br /&gt;
Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
=== Simplicity ===&lt;br /&gt;
Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
1. As a counter in a loop.&lt;br /&gt;
 &lt;br /&gt;
 (int i=0;i&amp;lt;10;i++)&lt;br /&gt;
&lt;br /&gt;
2. In conditional statements.&lt;br /&gt;
&lt;br /&gt;
 if(x &amp;gt; max)&lt;br /&gt;
     max = x;&lt;br /&gt;
&lt;br /&gt;
== Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
* '''Lack of inheritance capability: '''The primitive data types in languages such as Java cannot be inherited to create further subtypes as the wrapper classes like Integer, Float, etc are all final. Some applications that use OO languages might require more functionality than what is provided by the primitive datatype. For example, in Java, some of the composite data type like ArrayList, can be extended to add new functions like &amp;lt;code&amp;gt;sum&amp;lt;/code&amp;gt;,etc to be used in the application. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MyArrayList&amp;lt;E&amp;gt; extends ArrayList&amp;lt;e&amp;gt; {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a lot of customization options that help write more cleaner code. As an exception, the language SmallTalk allows even the basic primitive types to be inherited and modify the operations that can be performed on them.&lt;br /&gt;
&lt;br /&gt;
* Using primitive datatypes is '''not scalable '''enough for real time applications. For example, a real time application would like to work with a large number of similar or varied type of data. To use primitive types for this scenario would involve creating a lot of variables and maintaining the state of all these variables which is hard to do. Composite objects like arrays or lists can provide easier representation and management of data. For example, to represent a list of variables,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
char a[5] = {'c','a','d','f',h'}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Representing data in this way, allows easy access of the data as a[0], a[1], etc. This type of access by using a single variable to refer to multiple variables and memory locations allows performing similar operations on all the variables together (using loops or similar constructs). &lt;br /&gt;
&lt;br /&gt;
* '''The presence of utility functions '''for composite objects allows a lot of operations to be performed on the data. For example in Java, the ArrayLists class allows any type of data to be stored in them and provides a lot of utility functions. Operations like searching within the list can be performed by simply calling a utility function available, where as the user would have had to write explicit functions had primitive types been used. The generic classes in Java donot allow primitive datatypes to be used as parameters. So, to use an ArrayList of integers in Java, we should use the wrapper class of int (Integer) instead. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ArrayList&amp;lt;Integer&amp;gt; list = new ArrayList&amp;lt;Integer&amp;gt;();&lt;br /&gt;
list.add(5); // Though '5' is given as a primitive type, java performs Autoboxing to promote it to Integer Object.&lt;br /&gt;
list.add(4);&lt;br /&gt;
list.add(3);&lt;br /&gt;
list.add(2);&lt;br /&gt;
list.add(1);&lt;br /&gt;
System.out.println(list.contains(5));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
Performing aggregate operations on a bunch of values is also much easier when composite objects are used. For example, Usage of the Collections framework present in Java allows to perform a lot of operations like sorting the values present in the collection. As the sort operations that are pre-implemented in the Collection framework are in-built java functions, they are extremely fast (order of nlog n). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Collections.sort(list);&lt;br /&gt;
System.out.println(list);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 [1, 2, 3, 4, 5]&lt;br /&gt;
&lt;br /&gt;
Exceptions to this are languages like Ruby, which treat all the basic types as objects and provide utility functions for all of them. &lt;br /&gt;
&lt;br /&gt;
* Primitive data types do not allow to hold '''null values'''. So they cannot be used when a check for null value is essential.  &lt;br /&gt;
&lt;br /&gt;
* '''Unexpected results due to method overriding: '''There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html this], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3h_rr&amp;diff=63708</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3h rr</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3h_rr&amp;diff=63708"/>
		<updated>2012-09-12T15:31:56Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Primitive Data Types in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''3h. Primitive objects.  At the beginning of Lecture 11, we discovered that Fixnums and Bignums are handled differently behind the scenes in Ruby.  Other languages, like Java, have made similar distinctions.  By contrast, languages such as C# and Eiffel try to hide these implementation differences from users.  Answer two questions: (1) How have different o-o languages implemented primitive objects?  E.g., how are they represented in memory, how are they tested for, do comparisons do anything different than for class objects, etc.  (2) What are the advantages and disadvantages of treating primitives differently from class objects in source code?''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Programming languages, whether statically or dynamically typed, have support for certain in-built data types. These data types, known as primitive types, are the basic representation of information in programs and have certain fixed attributes for a specific language[http://en.wikipedia.org/wiki/Primitive_data_type]. Statically typed languages such as C++, Java, Perl etc. support primitive data types, whereas with dynamically typed languages such as Ruby, Smalltalk, Lisp etc. they are actually in the form of primitive objects.  These primitive types are used to store the basic types of information that a computer can store and manipulate, and can also be used as building blocks for creating more complex data types. &lt;br /&gt;
This article explains the way different primitive types are implemented in certain object oriented languages. An analysis of the benefits and drawbacks of such types and the methods used to operate on them is also presented. &lt;br /&gt;
&lt;br /&gt;
== Primitive Types ==&lt;br /&gt;
The primitive types commonly included in most programming languages are:&lt;br /&gt;
* Boolean&lt;br /&gt;
* Character&lt;br /&gt;
* Integer&lt;br /&gt;
* Floating-point number&lt;br /&gt;
* Fixed-point number&lt;br /&gt;
* Reference&lt;br /&gt;
&lt;br /&gt;
=== Boolean ===&lt;br /&gt;
A Boolean is a primitive data type used to store one of two logical types: true or false.  Boolean data types are most commonly used as input paramters to a conditional statement (such as an ‘if’ statement), or as the output of a comparison between two comparable data types.  Booleans can be implemented in languages as either a discrete logical type, or implicitly as a numerical type.  In many languages, booleans can be implicitly converted to and from integer types.  &lt;br /&gt;
&lt;br /&gt;
=== Character ===&lt;br /&gt;
A character is a data type that represents an element of a written language, such as a letter, number, or symbol.  A character can also represent a control character, such as a carriage return or newline, which does not have a written meaning but controls how other characters are stored or displayed.   Characters are commonly stored as integers, and encoded using a character map.  &lt;br /&gt;
&lt;br /&gt;
=== Integer ===&lt;br /&gt;
An integer is a data type that represents one element of a finite subset of mathematical integers.  Integer, or Integral, data types can be either unsigned (able to store only positive whole numbers) or signed (able to store either positive or negative whole numbers).  The range of values that can be represented by an integer depends on the number of bits used to store the integer, whether or not it is a signed integer, and the encoding scheme (if it is signed).  Typically, an integer has a minimum and maximum value, and can store any integer in the range between those values.  The minimum value for unsigned integers is typically 0, and the maximum value is typically determined by the amount of memory used to store the integer.  For example, a un unsigned 8-bit number can store 2^8 (or 256) possible integral values; and would typically store any value from 0 to 255.  More generally, an n-bit unsigned integer can store from 0 to (2^n)-1.  For signed integers, modern computers use the Two’s Complement encoding scheme.  This allows for a range of −2^(n−1) through 2^(n−1)−1.  For example, an 8-bit signed integer could store any whole number in the range from -128 through +127.&lt;br /&gt;
&lt;br /&gt;
=== Floating-Point Number ===&lt;br /&gt;
A floating point number is a data type used to represent real numbers in a large range with varying degrees of precision.  In this representation, numbers are represented with a variable number of significant digits, and a variable number of exponential digits.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Fixed-Point number ===&lt;br /&gt;
A fixed-point number is a data type used to represent real numbers.  Fixed-point numbers are called fixed-point because they have a set number of digits before and after a decimal mark.  In this regard, fixed-point numbers are represented as an integer, but are scaled by a predetermined factor.  &lt;br /&gt;
&lt;br /&gt;
Fixed-point numbers are commonly used in microprocessors that do not have a floating-point unit, or in systems in which computational efficiency is critical.  Fixed-point numbers can be treated as integers by an arithmetic logic unit (ALU) and scaled after a result is obtained, which can significantly lower the amount of time needed for a processor to obtain the result for some algorithms. &lt;br /&gt;
&lt;br /&gt;
Implementing algorithms using fixed-point arithmetic requires great care, because of the potential for information loss.  Fixed-point arithmetic operations -- multiplication in particular, has the potential to cause overflow.  Algorithms must be written with care to ensure that each term of an equation has a similar range and that the result will not cause an overflow.&lt;br /&gt;
&lt;br /&gt;
=== Reference ===&lt;br /&gt;
&lt;br /&gt;
A Reference is a data type that enables a program to access another item in memory.  A reference differs from other primitive data types in that it does not store data itself; instead it stores a value referring to another data object.  References are commonly used to refer to objects of large non-primitive data types.  References commonly store the physical memory address of the data that they are referring to.  Accessing the data referred to by a Reference is called dereferencing.&lt;br /&gt;
&lt;br /&gt;
== Primitive Data Types in C++ ==&lt;br /&gt;
&lt;br /&gt;
C++ is a statically-typed object oriented language.  C++ is based on the C programming language, which is procedural, and adds support for object-oriented code.  &lt;br /&gt;
&lt;br /&gt;
These data types are defined in C++: [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php] &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| void &lt;br /&gt;
| N/A &lt;br /&gt;
| the void data type is used to explicitly identify that a data has no type &lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| 32 bits&lt;br /&gt;
| simple numerical type&lt;br /&gt;
| See [[http://www.jk-technology.com/c/inttypes.html]]&lt;br /&gt;
|-&lt;br /&gt;
| float &lt;br /&gt;
| 32 bits &lt;br /&gt;
| single-precision IEEE 754 floating point &lt;br /&gt;
| See [[http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]]&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| 64 bits &lt;br /&gt;
| double-precision IEEE 754 floating point&lt;br /&gt;
| See [[http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]]&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| 1 bit &lt;br /&gt;
| boolean &lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| 8 bits &lt;br /&gt;
| a char is a single 8-bit character encoded using ASCII &lt;br /&gt;
| Ascii character 0x00 through ascii character 0xFF&lt;br /&gt;
|}&lt;br /&gt;
C++ supports Pointers for all of the types listed in the table above, as well as more complex data types (such as structs).  A Pointer in C++ is a data type that stores the physical address of some other data.  Pointers are created in C++ by using the * operator.  For example, a *Double[] is a pointer to an array of double-precision floating point numbers.  C++ Also supports function pointers -- pointers that reference the beginning address of a function in memory.  They are commonly used to implement callback functions [http://newty.de/fpt/intro.html#what]&lt;br /&gt;
&lt;br /&gt;
== Primitive Data Types in Java == &lt;br /&gt;
&lt;br /&gt;
Java is a statically-typed object oriented programming language.  Primitive types are defined in the language, and conversion between them must be explicitly performed.  Primitive data types are created using a keyword, which is also the name of the data type.  These data types are defined in Java: [http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
|byte&lt;br /&gt;
|8 bits &lt;br /&gt;
|signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
|16 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| 64 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| 32 bits &lt;br /&gt;
| single-precision IEEE 754 floating point &lt;br /&gt;
| See [[http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]]&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| 64 bits &lt;br /&gt;
| double-precision IEEE 754 floating point&lt;br /&gt;
| See [[http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]]&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| 1 bit &lt;br /&gt;
| boolean &lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| 16 bits &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Java also defines a String class, which is used to create objects of many chars.  The String class provides functionality commonly implemented using arrays of chars in other languages, such as C. &lt;br /&gt;
&lt;br /&gt;
Java also defines the 'unsigned' keyword, which can be used to as a modifier to any of the integral types listed in the table above.  If the 'unsigned' keyword is used, the integral type will be unsigned instead of signed, and its range will change correspondingly. &lt;br /&gt;
&lt;br /&gt;
Java is capable of using any two objects of the same primitive data type for comparison.  Java defines a class for each data type, which have the same name but a capitalized first letter (e.g. Float instead of float).  These classes, called wrapper classes provide a series of methods that can manipulate their associated primitive data type, as well as convert to and from other data types.&lt;br /&gt;
&lt;br /&gt;
== Primitive Data Types in C# == &lt;br /&gt;
&lt;br /&gt;
C# is a statically-typed object oriented programming language.  Primitive types are defined in the language, and conversion between them must be explicitly performed.  Primitive data types are created using a keyword, which is also the name of the data type.  C# has all of the data types that are available in Java, as well as some additional ones.  &lt;br /&gt;
&lt;br /&gt;
Similar to Java, C# defines a String class which is used to create objects of many chars.  These data types are defined in C#: [http://msdn.microsoft.com/en-us/library/ms228360%28v=vs.80%29.aspx]&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
|byte &lt;br /&gt;
| Byte &lt;br /&gt;
| 8 bits &lt;br /&gt;
|signed two's complement integer &lt;br /&gt;
| -128 to 127 &lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| SByte &lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Int16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| unsigned integer &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| UInt32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| unsigned integer &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| Int64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| UInt64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| unsigned integer &lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Float &lt;br /&gt;
| 32 bits &lt;br /&gt;
| single-precision IEEE 754 floating point &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double &lt;br /&gt;
| 64 bits &lt;br /&gt;
| double-precision IEEE 754 floating point&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean &lt;br /&gt;
| 1 bit &lt;br /&gt;
| boolean &lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| Char &lt;br /&gt;
| 16 bits &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| Object &lt;br /&gt;
| N/A &lt;br /&gt;
| Object is the base type of all other types&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| String &lt;br /&gt;
| N/A &lt;br /&gt;
| String is the base type for a sequence of chars&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| Decimal &lt;br /&gt;
| 128 &lt;br /&gt;
| Decimal is an integral type that can represent a decimal number with 29 significant digits &lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Like Java, each primitive data type in C# also has a class associated with it that.  These classes serve a similar purpose to their associated ones in Java.  They are used for comparison of objects, as well as conversion between other similar types.&lt;br /&gt;
&lt;br /&gt;
== Primitive Objects in Ruby ==&lt;br /&gt;
Ruby is a pure object oriented language as compared to languages such as Java or C#, which use a more hybrid approach. In Ruby, all data types are represented as Objects. There are some [http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html inbuilt classes] that are provided to users in Ruby. However, only some of them are a basic building block for forming other types. This subset shown below gives us a list of primitive objects that can be used for data representation and manipulation:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| Singleton instance &amp;quot;true&amp;quot; allowed&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| Singleton instance &amp;quot;false&amp;quot; allowed&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| Integer [http://www.ruby-doc.org/core/Integer.html]&lt;br /&gt;
| Abstract class that forms the basis for Fixnum and Bignum&lt;br /&gt;
| See Fixnum and Bignum&lt;br /&gt;
|-&lt;br /&gt;
| Fixnum [http://www.ruby-doc.org/core-1.8.7/Fixnum.html]&lt;br /&gt;
| Integer representations that fit in native machine word&lt;br /&gt;
| Machine architecture dependent. 2^30-1 to -2^30 on 32-bit machines.&lt;br /&gt;
|-&lt;br /&gt;
| Bignum [http://www.ruby-doc.org/core/Bignum.html]&lt;br /&gt;
| Integer representations that do not fit in Fixnum width&lt;br /&gt;
| Machine architecture dependent. Values above Fixnum range.&lt;br /&gt;
|-&lt;br /&gt;
| Float [http://www.ruby-doc.org/core/Float.html]&lt;br /&gt;
| Real numbers using double precision representation&lt;br /&gt;
| Value after decimal point can be formatted&lt;br /&gt;
|-&lt;br /&gt;
| String [http://corelib.rubyonrails.org/classes/String.html]&lt;br /&gt;
| Contains sequence of characters&lt;br /&gt;
| No physical limit, but can be decided by machine architecture&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
One interesting observation from the above table is that Ruby does not have a Boolean class; instead it has a separate TrueClass and FalseClass [http://www.skorks.com/2009/09/true-false-and-nil-objects-in-ruby].&lt;br /&gt;
&lt;br /&gt;
  puts true.class &lt;br /&gt;
  =&amp;gt; TrueClass&lt;br /&gt;
  puts false.class&lt;br /&gt;
  =&amp;gt; FalseClass&lt;br /&gt;
&lt;br /&gt;
Although types such as Array, Hash are also in-built types, they can be further composed of elements that are internally represented in one of the primitive types. Hence, they will not be treated by us as primitive objects, in the traditional definition of the term.&lt;br /&gt;
Each of the primitive objects listed above also provide certain convenience methods that are applicable for the underlying type.&lt;br /&gt;
For example, the Fixnum, Bignum and Float types provide support for arithmetic operations such as addition (+), subtraction(--), multiplication(*) and so on.&lt;br /&gt;
As with all other classes in Ruby, users can add functionality to existing primitive objects by reopening classes. The amount of memory required to implement the primitive objects in Ruby is machine dependent in some cases.&lt;br /&gt;
&lt;br /&gt;
== Merit Analysis of Primitive Types ==&lt;br /&gt;
This section deals with a brief analysis of the relative merits and demerits of primitive data types. While we focus on Java or Ruby for this purpose, most of these points are applicable across all object oriented languages.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
Primitive types in object oriented languages have certain advantages over their class object counterparts. &lt;br /&gt;
* Simplicity: Primitive types/objects provide users a simple mechanism of manipulating data without relying on additional objects to achieve the same functionality. Operations on primitive types are more intuitive.&lt;br /&gt;
* Efficiency: This statement is applicable if the underlying primitive object definition is not modified (a feature that languages such as Ruby provide to users). As the representation in memory is designed to be make most efficient use of the underlying datatype, use of primitives can provide a benefit to the user, over the use of class objects to store the same data. &lt;br /&gt;
  Eg. Java provides wrappers [http://www.glenmccl.com/tip_016.htm] for certain primitive types. There is a certain performance and space cost associated with these. &lt;br /&gt;
  So, to maximize efficiency, direct use of the primitive types would provide the most benefit.&lt;br /&gt;
* Ability to use inbuilt methods: Depending on the primitive type, languages such as Ruby provide methods that can be used specifically to probe or manipulate objects. &lt;br /&gt;
  Eg. [http://corelib.rubyonrails.org/classes/String.html String] primitive object provides convenience methods such as upcase to convert the entire string to upper case, or capitalize, which converts only the first character to upper case.&lt;br /&gt;
* Ease of testing for comparison: With primitive types, the equality testing operators such as == can be used. These essentially compare the values stored in the primitive types. Regular objects also offer the eql? method for testing equality. However, the following are not equivalent:&lt;br /&gt;
  a=10&lt;br /&gt;
  =&amp;gt; 10&lt;br /&gt;
  a==10&lt;br /&gt;
  =&amp;gt; true&lt;br /&gt;
  a==10.0&lt;br /&gt;
  =&amp;gt; true&lt;br /&gt;
  a.eql?(10.0)&lt;br /&gt;
  =&amp;gt; false&lt;br /&gt;
The reason the .eql? fails is that this operator tests for value and type being the same. 10 is type Fixnum and 10.0 is type Float. &lt;br /&gt;
The eql? can be overridden by == for primitive objects if you wish to compare only the values, but that can have a negative impact on performance [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html].&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
* Lack of inheritance capability: The primitive data types in languages such as Java cannot be inherited to create further subtypes.&lt;br /&gt;
* Unexpected results due to method overriding: There are certain examples such as [http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html], which show that overriding inbuilt methods such as == and eql? can lead to unexpected results.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Object oriented languages have varying levels of support for primitive data types and objects. Whether they are beneficial or not depends on the application to a great deal. If handled correctly, they can make object oriented programs more efficient. However, the user needs to be aware of the underlying representation of these types to handle any unexpected results.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
# http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
# http://www.jk-technology.com/c/inttypes.html&lt;br /&gt;
# http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html&lt;br /&gt;
# http://newty.de/fpt/intro.html&lt;br /&gt;
# http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
# http://msdn.microsoft.com/en-us/library/ms228360%28v=vs.80%29.aspx&lt;br /&gt;
# http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
# http://blog.vishnuiyengar.com/2009/09/primitive-obsession-in-ruby-aka-not.html&lt;br /&gt;
# http://www.glenmccl.com/tip_016.htm&lt;br /&gt;
# http://www.skorks.com/2009/09/ruby-equality-and-object-comparison/&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63687</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63687"/>
		<updated>2012-09-12T07:20:20Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Primitive data types in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those data types that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. They are basic or in-built types that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages provide more support for them by supporting most basic operations. In dynamically typed languages like Ruby, these data types are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so. One of the major differences in Java from the other languages is that,the size of variables of these primitive types do not vary from one system to another, ie, it is not machine/architecture dependent. Also, Java does not allow numeric values to be stored unsigned[http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Java_Primitive_Types.html]. &lt;br /&gt;
&lt;br /&gt;
Java provides wrapper classes for these primitive types and objects of those classes form primitive objects. For example, for the primitive data type ''int'', the Integer class acts as a wrapper class that provides a lot of utility methods like &amp;lt;code&amp;gt;parseInt()&amp;lt;/code&amp;gt; and constants like &amp;lt;code&amp;gt;MAX_VALUE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MIN_VALUE&amp;lt;/code&amp;gt; that can be used on an Integer object. The other wrapper classes that Java provides for these primitive classes are Integer, Double, Float, Character, Boolean, Long and Short.&lt;br /&gt;
&lt;br /&gt;
 int i = Integer.parseInt(&amp;quot;50&amp;quot;);&lt;br /&gt;
 System.out.println(i);&lt;br /&gt;
 System.out.println(Integer.MAX_VALUE);&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 50&lt;br /&gt;
 2147483647&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
*Simplicity: Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
* Most of the object oriented programming languages do not allow the behavior or capabilities of primitive data types to be modified by programs.For example, the primitive data types in languages such as Java cannot be inherited to create further subtypes. An exception to this includes Smlltalk. It allows all data types to be extended within a program. It allows the programmer to modify the operations that can be performed on them and also to redefine the built in operations.&lt;br /&gt;
* Most of the object oriented languages have certain utility functions associated with non primitive data types that eases their use as compared to primitive data types that do not have such functions. This is not the case in pure objected oriented languages like Ruby, which provide a utility functions to primitive types as well. &lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63370</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63370"/>
		<updated>2012-09-10T18:52:31Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those data types that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. They are basic or in-built types that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages provide more support for them by supporting most basic operations. In dynamically typed languages like Ruby, these data types are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also allows ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages of using primitive data types are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming than programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
*Simplicity: Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
* Most of the object oriented programming languages do not allow the behavior or capabilities of primitive data types to be modified by programs.For example, the primitive data types in languages such as Java cannot be inherited to create further subtypes. An exception to this includes Smlltalk. It allows all data types to be extended within a program. It allows the programmer to modify the operations that can be performed on them and also to redefine the built in operations.&lt;br /&gt;
* Most of the object oriented languages have certain utility functions associated with non primitive data types that eases their use as compared to primitive data types that do not have such functions. This is not the case in pure objected oriented languages like Ruby, which provide a utility functions to primitive types as well. &lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63262</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63262"/>
		<updated>2012-09-09T23:50:58Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
*Simplicity: Working with primitive data types is more intuitive.&lt;br /&gt;
*certain functions like equality operation can be easily implemented on the primitive data types.&lt;br /&gt;
 For example, when we use the '=='&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
* Most of the object oriented programming languages do not allow the behavior or capabilities of primitive data types to be modified by programs.For example, the primitive data types in languages such as Java cannot be inherited to create further subtypes. An exception to this includes Smlltalk. It allows all data types to be extended within a program. It allows the programmer to modify the operations that can be performed on them and also to redefine the built in operations.&lt;br /&gt;
* Most of the object oriented languages have certain utility functions associated with non primitive data types that eases their use as compared to primitive data types that do not have such functions. An exception to this is Ruby. It has utility functions associated with all the data types.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63261</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63261"/>
		<updated>2012-09-09T23:48:55Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
*Simplicity: Working with primitive data types is more intuitive.&lt;br /&gt;
*certain functions like equality operation can be easily implemented on the primitive data types.&lt;br /&gt;
 For example, when we use the '=='&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
* Most of the object oriented programming languages do not allow the behavior or capabilities of primitive data types to be modified by programs.For example, the primitive data types in languages such as Java cannot be inherited to create further subtypes. An exception to this includes Smlltalk. It allows all data types to be extended within a program. It allows the programmer to modify the operations that can be performed on them and also to redefine the built in operations.&lt;br /&gt;
* Most of the object oriented languages have certain utility functions associated with non primitive data types that eases their use as compared to primitive data types that do not have such functions. An exception to this is Ruby. It has utility functions associated with all the data types.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63259</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63259"/>
		<updated>2012-09-09T23:45:46Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Primitive data types/objects in Ruby */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| ± 2^30 (for 32-bit systems)&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] &lt;br /&gt;
| values &amp;gt; 2^30 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308 (for 32-bit systems)&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
*Simplicity: Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
* Most of the object oriented programming languages do not allow the behavior or capabilities of primitive data types to be modified by programs.For example, the primitive data types in languages such as Java cannot be inherited to create further subtypes. An exception to this includes Smlltalk. It allows all data types to be extended within a program. It allows the programmer to modify the operations that can be performed on them and also to redefine the built in operations.&lt;br /&gt;
* Most of the object oriented languages have certain utility functions associated with non primitive data types that eases their use as compared to primitive data types that do not have such functions. An exception to this is Ruby. It has utility functions associated with all the data types.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
* Most of the object oriented languages have certain utility functions associated with non primitive data types that eases their use as compared to primitive data types that do not have such functions. An exception to this is Ruby. It has utility functions associated with all the data types.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63255</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63255"/>
		<updated>2012-09-09T23:38:32Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html] (for 32-bit systems)&lt;br /&gt;
| ± 2^30&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] (for 32-bit systems)&lt;br /&gt;
| values &amp;gt; 2^30&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
*Simplicity: Working with primitive data types is more intuitive.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
#http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf&lt;br /&gt;
#http://en.wikipedia.org/wiki/Primitive_data_type&lt;br /&gt;
#http://en.wikipedia.org/wiki/Fixed-point_arithmetic&lt;br /&gt;
#http://en.wikipedia.org/wiki/C%2B%2B&lt;br /&gt;
#http://en.cppreference.com/w/cpp/language/types&lt;br /&gt;
#http://en.wikipedia.org/wiki/Wide_character&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx&lt;br /&gt;
#http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php&lt;br /&gt;
#http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx&lt;br /&gt;
#http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html&lt;br /&gt;
#http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html&lt;br /&gt;
#http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63252</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63252"/>
		<updated>2012-09-09T23:30:42Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html] (for 32-bit systems)&lt;br /&gt;
| ± 2^30&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] (for 32-bit systems)&lt;br /&gt;
| values &amp;gt; 2^30&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Primitive objects that are provided in object oriented programming languages have their own advantages and disadvantages. Though using primitive data types in most languages reduces the degree of customization possible, they provide a better performance and ease of use to compensate. The extent to which a primitive data type can be used efficiently depends on the application and the programming language used for the application.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63246</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63246"/>
		<updated>2012-09-09T23:05:13Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html] (for 32-bit systems)&lt;br /&gt;
| ± 2^30&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] (for 32-bit systems)&lt;br /&gt;
| values &amp;gt; 2^30&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63243</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63243"/>
		<updated>2012-09-09T23:00:07Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html] (for 32-bit systems)&lt;br /&gt;
| ± 2^30&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] (for 32-bit systems)&lt;br /&gt;
| values &amp;gt; 2^30&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63242</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63242"/>
		<updated>2012-09-09T22:59:40Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types[http://ece.uprm.edu/~ahchinaei/courses/2010jan/icom4036/slides/11icom4036DataTypes1.pdf]. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
Some of the common data types that are present in most programming languages are &lt;br /&gt;
*'''Integer''' - used to hold whole numbers. Can be signed or unsigned and include various types like &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;, etc. &lt;br /&gt;
*'''Character''' - used to hold single character, digit or symbol or a sequence of any combination of them that is stored in numeric coding. Usually stored in ASCII encoding. '&lt;br /&gt;
*'''Floating-point''' - used to represent real numbers with limited precision. They usually comprise of an exponent part and a fractional part. Can be signed or unsigned . &lt;br /&gt;
*'''Fixed-point''' - similar to floating-point, but has fixed number of digits after the decimal point [http://en.wikipedia.org/wiki/Fixed-point_arithmetic]. They are used in processors or representing base 2 and base 10 fractional values where there is no Floating point unit. &lt;br /&gt;
*'''Boolean''' - used to represent logical values used for comparisons. Typically hold either of 2 values - true/false. Can also be represented as integers. Can be stored in a single bit, but typically stored as a byte.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html] (for 32-bit systems)&lt;br /&gt;
| ± 2^30&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] (for 32-bit systems)&lt;br /&gt;
| values &amp;gt; 2^30&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
In this section we discuss the various advantages and disadvanges of using the primitive data types over the corresponding object types.&lt;br /&gt;
&lt;br /&gt;
== Advantages==&lt;br /&gt;
The various advantages that use of primitive data type offers are as follows:&lt;br /&gt;
*Ease of use: Using primitive data types is much more efficient way of programming then programming using objects. For example, in Java when we use boxing in a loop it causes certain performance issues and is inefficient compared to using the primitive types directly. For more details and a sample program see [http://today.java.net/pub/a/today/2005/03/24/autoboxing.html#performance%5Fissue].&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63217</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63217"/>
		<updated>2012-09-09T22:10:10Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Primitive data types/objects in Ruby */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html] (for 32-bit systems)&lt;br /&gt;
| ± 2^30&lt;br /&gt;
|- &lt;br /&gt;
| BigNum&lt;br /&gt;
| store Integer values larger than FixNum[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_bignum.html] (for 32-bit systems)&lt;br /&gt;
| values &amp;gt; 2^30&lt;br /&gt;
|-&lt;br /&gt;
| String&lt;br /&gt;
| sequence of characters/bytes [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html]&lt;br /&gt;
| Does not exist. &lt;br /&gt;
|-&lt;br /&gt;
| Float&lt;br /&gt;
| real numbers with double precision floating point precision[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_float.html]&lt;br /&gt;
| ± 1.7976 * 10^308&lt;br /&gt;
|-&lt;br /&gt;
| TrueClass&lt;br /&gt;
| represents logical ''true'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_trueclass.html]&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| FalseClass&lt;br /&gt;
| represents logical ''false'' value[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_falseclass.html]&lt;br /&gt;
| false&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are a various other inbuilt classes that are provided by Ruby. Those classes can be constructed by combining one or more of the above given primitive classes. As these are existing classes, there are a lot of helper methods that allow easy calculations and operations on the objects of these classes. Some of these classes also have inbuilt iterator methods that allow the values to be modified automatically for using in loops. As with many other programming languages, some of these objects take up different size (and hence range) on different architectures. These existing classes are also editable and allows to override or add new functionality to them for custom use in the application.&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63208</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63208"/>
		<updated>2012-09-09T21:37:04Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Primitive data types/objects in Ruby */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Primitive datatypes are those that are not defined in terms of other data types. It is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
C# is a statically-typed object oriented programming language. C# provides all the data types that are available in Java, and adds support for unsigned numerals and a new 128-bit high-precision floating-point type. All primitive data types in C# are objects in the System namespace.&lt;br /&gt;
The various primitive data types in C# are defined below:[http://msdn.microsoft.com/en-us/library/ms228360(v=vs.80).aspx]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! .NET Class &lt;br /&gt;
! width=&amp;quot;50&amp;quot; | Size &lt;br /&gt;
! Description &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| byte &lt;br /&gt;
| System.Byte&lt;br /&gt;
| 8 bits &lt;br /&gt;
| 8-bit unsigned integral type.&lt;br /&gt;
| 0 to 255&lt;br /&gt;
|-&lt;br /&gt;
| sbyte &lt;br /&gt;
| System.SByte&lt;br /&gt;
| 8 bits&lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| System.Int16&lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit signed integral type.&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
|-&lt;br /&gt;
| ushort &lt;br /&gt;
| System.UInt16 &lt;br /&gt;
| 16 bits &lt;br /&gt;
| 16-bit unsigned integral type. &lt;br /&gt;
| 0 to 65,535&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Int32 &lt;br /&gt;
| 32 bits &lt;br /&gt;
| signed two's complement integer &lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| uint &lt;br /&gt;
| System.Int32&lt;br /&gt;
| 32 bits &lt;br /&gt;
| 32-bit signed integral type. &lt;br /&gt;
| 0 to 4,294,967,295&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| System.Int64  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit signed integral type. &lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
|-&lt;br /&gt;
| ulong &lt;br /&gt;
| System.UIint64 &lt;br /&gt;
| 64 bits &lt;br /&gt;
| 64-bit unsigned integral type.&lt;br /&gt;
| 0 to 18,446,744,073,709,551,615&lt;br /&gt;
|- &lt;br /&gt;
| float &lt;br /&gt;
| System.Single &lt;br /&gt;
| 32 bits &lt;br /&gt;
| Single-precision floating-point type. &lt;br /&gt;
| -3.402823e38 to 3.02823e38&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| System.Double  &lt;br /&gt;
| 64 bits &lt;br /&gt;
| Double-precision floating-point type.&lt;br /&gt;
| -1.79769313486232e308 to 1.79769313486232e308&lt;br /&gt;
|- &lt;br /&gt;
| bool &lt;br /&gt;
| System.Boolean  &lt;br /&gt;
| 1 bit &lt;br /&gt;
| Logical Boolean type&lt;br /&gt;
| false, true&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| System.Char  &lt;br /&gt;
| 16 bits &lt;br /&gt;
| A 16-bit Unicode character. &lt;br /&gt;
| Unicode character \u0000 through unicode character \uffff&lt;br /&gt;
|-&lt;br /&gt;
| object &lt;br /&gt;
| System.Object  &lt;br /&gt;
| N/A &lt;br /&gt;
| Ultimate base type of all other types.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| string &lt;br /&gt;
| System.String&lt;br /&gt;
| N/A &lt;br /&gt;
| A sequence of Unicode characters.&lt;br /&gt;
| N/A &lt;br /&gt;
|-&lt;br /&gt;
| decimal &lt;br /&gt;
| System.Decimal  &lt;br /&gt;
| 128 &lt;br /&gt;
| Precise decimal with 28 significant digits.&lt;br /&gt;
| ±1.0 × 10e−28 to ±7.9 × 10e28&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
Ruby is a multi-paradigm programming language. It is dynamically typed, and allows to be programmed procedural, object-oriented or functional[http://www.cse.iitb.ac.in/~cs701/old/beamer/Closures.pdf]. As it is also a ''pure'' object oriented programming language, even the basic inbuilt types like integer and string and even constants are represented as objects. There are a lot of inbuilt classes that are provided by Ruby[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html]. These classes differ in some extent to their counterparts in other languages. Having all the basic types as classes allows a lot of methods to be executed on them that reduces the amount of code that needs to be newly written. Some of the basic classes are:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;| Name &lt;br /&gt;
! Description&lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| Integer&lt;br /&gt;
| base class for FixNum and BigNum [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html&lt;br /&gt;
| depends on FixNum and BigNum&lt;br /&gt;
|-&lt;br /&gt;
| FixNum&lt;br /&gt;
| store integer values that fit in a native machine word [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_integer.html]&lt;br /&gt;
| -2^30&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63192</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63192"/>
		<updated>2012-09-09T20:56:29Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: /* Primitive data types in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
A primitive data type is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is a statically typed, objected oriented programming language. It is widely used on a lot of hardware and software platforms. As C++ just adds object oriented features and a few other enhancements to C, the primitive data types that it provides are same as those provided by C[http://en.wikipedia.org/wiki/C%2B%2B]. They are described below [http://en.cppreference.com/w/cpp/language/types].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Name &lt;br /&gt;
! Description &lt;br /&gt;
! Size &lt;br /&gt;
! Range&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| Basic numerical data. Can have modifiers that vary size and range.&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| Can hold one character of data like an alphabet, number, or symbol represented in ASCII&lt;br /&gt;
| 1 byte&lt;br /&gt;
| -128 to 127&lt;br /&gt;
|-&lt;br /&gt;
| wchar_t&lt;br /&gt;
| used for storing compiler-defined wide characters and unicode characters [http://en.wikipedia.org/wiki/Wide_character]&lt;br /&gt;
| compiler defined&lt;br /&gt;
| compiler defined&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| single precision floating-point&lt;br /&gt;
| 4 bytes&lt;br /&gt;
| ± 3.402,823,4 * 10^38&lt;br /&gt;
|-&lt;br /&gt;
| double&lt;br /&gt;
| double precision floating-point&lt;br /&gt;
| 8 bytes&lt;br /&gt;
| +/–1.7 * 10^308 [http://msdn.microsoft.com/en-us/library/e02ya398(v=vs.80).aspx]&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| represents logical values&lt;br /&gt;
| 1 byte&lt;br /&gt;
| true/false&lt;br /&gt;
|-&lt;br /&gt;
| void&lt;br /&gt;
| generic identifier that does not identify type [http://sparkcharts.sparknotes.com/cs/cplusplus/section2.php]&lt;br /&gt;
| Does not exist&lt;br /&gt;
| Does not exist&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
C++ allows variables of any of these data types to be created and also supports using these data types to construct complex data types like structures and classes. C++ also provides ''pointers'' that can be used to store the address of a variable of any simple or complex data type.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
There is a certain group of data types that is used very frequently by the programmer. These types are included in the Java language as the primitive data types.These data types have a fixed size which does not change from one system to another and adds to the portability feature of java. There are 8 primitive data types defined in java which are as follows:[http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html]&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; style=&amp;quot;border-spacing: 0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot;|Name&lt;br /&gt;
! Description &lt;br /&gt;
! Size(in bits)&lt;br /&gt;
! Range&lt;br /&gt;
! Usage&lt;br /&gt;
! Default Value&lt;br /&gt;
|-&lt;br /&gt;
| byte&lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 8 bits&lt;br /&gt;
| -128 to 127 &lt;br /&gt;
| This datatype can be used in arrays where there is a space constraint to save memory.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| short &lt;br /&gt;
| Signed two's complement integer &lt;br /&gt;
| 16 bits&lt;br /&gt;
| -32,768 to 32,767&lt;br /&gt;
| This datatype can also be used to save memory in large arrrays.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| int &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 32 bits&lt;br /&gt;
| -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
| This datatype is generally the default datatype for all the numbers we use in our program.&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| long &lt;br /&gt;
| signed two's complement integer&lt;br /&gt;
| 64 bits&lt;br /&gt;
| -9,223,372,036,854,775,808 to 9,223,373,036,854,775,807&lt;br /&gt;
| This type is used when we require a value that is outside the range of values provided by int.&lt;br /&gt;
| 0L&lt;br /&gt;
|- &lt;br /&gt;
|float &lt;br /&gt;
| Single-precision IEEE 754 floating point&lt;br /&gt;
| 32 bits&lt;br /&gt;
| 32-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| Use this datatype to save memory in large arrays.&lt;br /&gt;
| 0.0f&lt;br /&gt;
|-&lt;br /&gt;
| double &lt;br /&gt;
| Double-precision 64-bit IEEE 754 floating point&lt;br /&gt;
| 64 bits&lt;br /&gt;
| 64-bit IEEE 754 floating-point numbers.&lt;br /&gt;
| This data type is generally the default for decimal values.&lt;br /&gt;
| 0.0d&lt;br /&gt;
|- &lt;br /&gt;
| boolean &lt;br /&gt;
| Boolean&lt;br /&gt;
| 1- bit&lt;br /&gt;
| false, true&lt;br /&gt;
| Use this data type for flags that track a true or false condition.&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| char &lt;br /&gt;
| a char is a single 16-bit character encoded using Unicode&lt;br /&gt;
| 16 bit&lt;br /&gt;
| Unicode character \u0000(0) through unicode character \uffff(65,535)&lt;br /&gt;
| This type is used to define single characters.&lt;br /&gt;
| '\u0000'&lt;br /&gt;
|}&lt;br /&gt;
Besides these 8 primitive data types java provides support to characterstrings through Java.lang.String class. String is not a primitive datatype but its usage and functionality makes us think of it being so.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=63180</id>
		<title>CSC/ECE 517 Fall 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=63180"/>
		<updated>2012-09-09T20:13:34Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE 517 Fall 2012/ch1 n xx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w1 rk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w20 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w6 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w7 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w8 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w10 pk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w14 gv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w17 ir]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w22 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 aa]]&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63179</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w21 aa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63179"/>
		<updated>2012-09-09T20:09:50Z</updated>

		<summary type="html">&lt;p&gt;Achandr6: Created page with &amp;quot;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;  == Introduction == A primitive data type is a basic or in-built type that a programming language provides for its users. These data types can be...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;''' Primitive Objects '''&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
A primitive data type is a basic or in-built type that a programming language provides for its users. These data types can be used for building other complex and composite data types [http://en.wikipedia.org/wiki/Primitive_data_type]. In most languages, primitive types usually consist of basic value types for representing the data to be stored. As these data types are built-in, the compilers for these languages usually provide inbuilt support for these data types and so would support most basic operations. In dynamically typed languages like Ruby, these are represented as objects and are referred to as primitive objects. This article discusses the various primitive data types/objects that are present in various objected oriented programming languages and their benefits.&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C++ ==&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in Java ==&lt;br /&gt;
&lt;br /&gt;
== Primitive data types in C# ==&lt;br /&gt;
&lt;br /&gt;
== Primitive data types/objects in Ruby ==&lt;br /&gt;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Achandr6</name></author>
	</entry>
</feed>