<?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=Agarg5</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=Agarg5"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Agarg5"/>
	<updated>2026-06-05T05:34:29Z</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_2w-1w65_am&amp;diff=70340</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70340"/>
		<updated>2012-11-18T20:50:53Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Env Dump and Session Dump */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This is a wiki article for the material presented in the Coursera SaaS video series, [https://www.youtube.com/watch?v=Ee5vfe0mLb8 3.13 Debugging by Dr. Armando Fox and Dr. David Patterson]. We aim to cover all the material presented in the video with definitions and examples&lt;br /&gt;
===Why debugging in Rails can be tricky?===&lt;br /&gt;
*We are used to printing the error on the terminal in most applications(Example: [http://www.cplusplus.com/reference/clibrary/cstdio/stderr/ STDERR]). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
*Errors early in flow might manifest itself late.&lt;br /&gt;
Consider the following hierarchy seen in a Rails application:&lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; Model -&amp;gt; View -&amp;gt; Renderer&lt;br /&gt;
 &lt;br /&gt;
Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
&lt;br /&gt;
*Errors can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging based on the mode of operation, that is development mode or production mode:&lt;br /&gt;
 &lt;br /&gt;
'''Printing to terminal:'''This is useful for developers, when they are writing code they can print errors to the terminal and then examine them. We cannot use this approach in production mode.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Logging:''' This is a more general approach to debugging which can be used in both modes. The logged entries are permanent record of what the application is doing. The recorded errors are saved in a log file and can be referenced later.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Interactive Debugging:''' Using this tool you can stop the application in its tracks and inspect the state of the variables or other parameters to locate the error.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a summary of the various approaches and the modes in which they can be used: &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Approach !! Development !! Production&lt;br /&gt;
|-&lt;br /&gt;
| Printing to Terminal || ✓ || &lt;br /&gt;
|-&lt;br /&gt;
| Logging || ✓ || ✓&lt;br /&gt;
|-&lt;br /&gt;
| Interactive Debugging || ✓ || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
Steps to follow when faced with an error can be concisely represented by RASP according to Dr. Fox.&lt;br /&gt;
===What is RASP?===&lt;br /&gt;
RASP is an acronym which briefs the steps which a developer could follow if she were facing an error message. It stands for:&lt;br /&gt;
#'''Read''' the error message.&lt;br /&gt;
#'''Ask''' your colleague  &lt;br /&gt;
#'''Search''' using [http://stackoverflow.com/ Stack Overflow] or any other search engine.&lt;br /&gt;
#'''Post''' on [http://stackoverflow.com/ Stack Overflow] or class forum&lt;br /&gt;
&lt;br /&gt;
Reading the error message carefully is the first step in debugging. The error messages in Rails are incredibly detailed and it gives us a lot of information, reading it carefully can help us locate the file and line in which you are facing the error. But what if the line looks alright to you?&amp;lt;br&amp;gt;&lt;br /&gt;
The next step is to ask a colleague an informed question. In case you are doing pair programming, this is a good step to take. The question has to be of the form &amp;quot;I am trying to do this and I expected to get this but I got this other thing instead of foo.&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
If the previous steps fail then searching using stack overflow or Google is next, especially if its an error which is particular to a version of gems or OS.&amp;lt;br&amp;gt;&lt;br /&gt;
In case you don't find a solution to your problem the final step is to get minimal but complete information which reproduces the error message which you are experiencing and post it.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example question and solution from stack overflow:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Ques.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As we can see the question follows the guidelines explained above. It gives minimal but complete information about the error. It does not give the entire description of the error. It is important to post minimal information so that the person who answers the question can understand your problem quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Ans.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The answer is posted within an hour of posting the question. This shows that posting on stack overflow is a fast way of getting expert help with debugging.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
Rails usually provides a very verbose description of error messages. Dr. Fox tells us that error messages are our friends, they try to not only show us what went wrong but a great deal of detail of where it went wrong. Let us look at an example error message.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
An error message was deliberately caused by entering a route which wouldn't work. The application which we are using is the backchannel application and we are trying to find a post with id=20 (it doesn't exist). This causes rails to throw the following error  message.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;'''ActiveRecord::RecordNotFound in PostsController#show'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;Couldn't find Post with id=20&amp;lt;br&amp;gt;&lt;br /&gt;
 Rails.root: C:/Users/BruceWayne/Downloads/BackChannelApplication&amp;lt;br&amp;gt;&lt;br /&gt;
 Application Trace | Framework Trace | Full Trace&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''What is the error message trying to tell us?'''&amp;lt;br&amp;gt;&lt;br /&gt;
It tells us that ActiveRecord raised the error, and the error was raised in the show method of the Posts Controller. Rails tried to find a post with id=20 but it failed.&lt;br /&gt;
===Application Trace===&lt;br /&gt;
The application trace will give us the file, line number and the method in which the error was thrown. For the above example the application trace will look like this:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;app/controllers/posts_controller.rb:17:in `show'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also get the application trace manually at any point through the following command:&lt;br /&gt;
 begin&lt;br /&gt;
  raise object.inspect&lt;br /&gt;
 rescue&lt;br /&gt;
  Rails.logger.warn $!.backtrace.to_yaml&lt;br /&gt;
 end&lt;br /&gt;
This will cause a deliberate error along with an application trace of how you got there.&lt;br /&gt;
&lt;br /&gt;
===Stack Trace===&lt;br /&gt;
Full stack trace shows us the entire stack trace of right when the application started until the problem is encountered. Usually stack traces are very lengthy but they can be very useful to solve problems. Here is a partial stack trace from the back channel application error which we saw before:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:341:in `find_one'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:107:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 C:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 app/controllers/posts_controller.rb:17:in `show'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see the stack trace right from where the Rails application started, we can see the calls to activerecord. It is unlikely that there would be a problem in those files. As we continue looking into the stack trace we see the find method, we can click on the link in the trace and it will take us to the line in which the error was found. Most often the first few lines of the stack trace will give us the cause behind the error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stack trace can be logged using the following lines of code:&lt;br /&gt;
 begin&lt;br /&gt;
  raise&lt;br /&gt;
 rescue =&amp;gt; e&lt;br /&gt;
  logger.error e.message&lt;br /&gt;
  e.backtrace.each { |line| logger.error line }&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
Session dump gives all the information of the user's session. This is useful if the error which needs to be fixed is particular to a user or a group of users.&lt;br /&gt;
 &amp;lt;code&amp;gt;_csrf_token: &amp;quot;LiTiqHSVFOr8uT0+pFJhNCFjUc3YikuJy6F77QG+O1Y=&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 comment_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 post_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 session_id: &amp;quot;c562769a55b39620228ce6064aaa1637&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 user: #&amp;lt;User id: 4, name: &amp;quot;seriously&amp;quot;, username: &amp;quot;seriously&amp;quot;, email: &amp;quot;seriously@seriously.com&amp;quot;,&amp;lt;br&amp;gt; encrypted_password: &amp;quot;cb32e64bd4cb11c7424ea4ea75731450e99ed120d4bab155a42...&amp;quot;, salt: &amp;quot;DlLGMQzwgU&amp;quot;, is_admin: nil,&amp;lt;br&amp;gt; created_at: &amp;quot;2012-11-18 01:08:35&amp;quot;, updated_at: &amp;quot;2012-11-18 01:08:35&amp;quot;&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A session dump can be obtained using the following command:&lt;br /&gt;
 &amp;lt;%= debug session %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Environment dump gives details of the rails runtime environment. If the error is localized to users who use the same version of a host or a protocol, we could find that out using the environment dump.&lt;br /&gt;
 &amp;lt;code&amp;gt;GATEWAY_INTERFACE: &amp;quot;CGI/1.1&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT: &amp;quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_CHARSET: &amp;quot;ISO-8859-1,utf-8;q=0.7,*;q=0.3&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_ENCODING: &amp;quot;gzip,deflate,sdch&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_LANGUAGE: &amp;quot;en-US,en;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_ADDR: &amp;quot;127.0.0.1&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_HOST: &amp;quot;Wayne-PC&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_NAME: &amp;quot;localhost&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_PROTOCOL: &amp;quot;HTTP/1.1&amp;quot;&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===A Very Common Error Message in Ruby===&lt;br /&gt;
&amp;lt;code&amp;gt;undefined method ‘foo’ for nil:NilClass&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most often, it means that an assignment failed and we didn't check for errors.&amp;lt;br&amp;gt;&lt;br /&gt;
Example: &amp;lt;code&amp;gt;@m = Movie.find_by_id(id) #could be nil&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you try to call m.title after an assignment like the one above, it will throw this error.&lt;br /&gt;
&lt;br /&gt;
==Rails Debugger==&lt;br /&gt;
===What is a debugger?===&lt;br /&gt;
Sometimes printing errors to the console or logging is not enough to find out the root cause behind an error message. It is during these times when the debugger is a developer's best friend. The debugger helps us to step forward or backward in the code, execute or skip lines of code, examine the state of a variable or a parameter which has been passed. This will help the developer pinpoint to the actual source of the problem and fix it.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''How to install the debugger?'''&amp;lt;br&amp;gt;&lt;br /&gt;
In Rails, ruby-debug is a gem. We can install it like any other gem. To use the gem in a Rails application we need to add the following line: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;require &amp;quot;ruby-debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
in the &amp;lt;code&amp;gt;config/environments/development.rb&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Ruby 1.9, you can use this command to install a compatible version of the debugger gem:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;gem install debugger&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Running the debugger&amp;lt;br&amp;gt;'''&lt;br /&gt;
To use the debugger in the rails application we need to start the server with the &amp;lt;code&amp;gt;--debugger&amp;lt;/code&amp;gt; option. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$ rails server --debugger&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we don't do this we would encounter an error like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;***** Debugger requested, but was not available: Start server with --debugger to enable *****&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can invoke the debugger from any method by using the &amp;lt;code&amp;gt;debugger&amp;lt;/code&amp;gt; keyword in the method.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;
  def new&lt;br /&gt;
    debugger&lt;br /&gt;
    @post = Post.new&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Once the debugger method is called a debugger shell is started inside the terminal window where the application server was launched, and the cursor will be placed at ruby-debug’s prompt &amp;lt;code&amp;gt;(rdb:n)&amp;lt;/code&amp;gt; where n is the thread number. The prompt will show the next line of code which is waiting to run.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Rails is a relatively new platform for development, it is continually evolving which effectively means debugging is harder. However by leveraging the knowledge of people who have encountered similar errors before we can resolve a subset of the problems, the ones particular to versions of ruby and other gems. We have tools like debugger and application trace to help us solve problems which are specific to our application. To know more about using the debugger, please refer to the Further Reading section of the article.&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
# [http://guides.rubyonrails.org/debugging_rails_applications.html Rails Guide - Debugging Rails Applications]&lt;br /&gt;
# [http://www.sitepoint.com/debug-rails-app-ruby-debug/ Debug your rails app with ruby-debug]&lt;br /&gt;
# [http://rubyforge.org/projects/ruby-debug/ Ruby Forge - Documentation for ruby-debug]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# https://www.youtube.com/watch?v=Ee5vfe0mLb8&lt;br /&gt;
# http://railstips.org/blog/archives/2011/08/31/stupid-simple-debugging/&lt;br /&gt;
# http://guides.rubyonrails.org/debugging_rails_applications.html&lt;br /&gt;
# http://railscasts.com/episodes/54-debugging-with-ruby-debug&lt;br /&gt;
# http://bashdb.sourceforge.net/ruby-debug.html&lt;br /&gt;
# http://cheat.errtheblog.com/s/rdebug/&lt;br /&gt;
# http://railscasts.com/episodes/24-the-stack-trace&lt;br /&gt;
# http://www.scribd.com/doc/86869289/3/Rails-Cookery-3&lt;br /&gt;
# http://www.ruby-forum.com/topic/67687&lt;br /&gt;
# http://stackoverflow.com/questions/8408936/rake-dbmigrate-error&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70338</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70338"/>
		<updated>2012-11-18T20:45:54Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Stack Trace */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This is a wiki article for the material presented in the Coursera SaaS video series, [https://www.youtube.com/watch?v=Ee5vfe0mLb8 3.13 Debugging by Dr. Armando Fox and Dr. David Patterson]. We aim to cover all the material presented in the video with definitions and examples&lt;br /&gt;
===Why debugging in Rails can be tricky?===&lt;br /&gt;
*We are used to printing the error on the terminal in most applications(Example: [http://www.cplusplus.com/reference/clibrary/cstdio/stderr/ STDERR]). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
*Errors early in flow might manifest itself late.&lt;br /&gt;
Consider the following hierarchy seen in a Rails application:&lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; Model -&amp;gt; View -&amp;gt; Renderer&lt;br /&gt;
 &lt;br /&gt;
Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
&lt;br /&gt;
*Errors can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging based on the mode of operation, that is development mode or production mode:&lt;br /&gt;
 &lt;br /&gt;
'''Printing to terminal:'''This is useful for developers, when they are writing code they can print errors to the terminal and then examine them. We cannot use this approach in production mode.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Logging:''' This is a more general approach to debugging which can be used in both modes. The logged entries are permanent record of what the application is doing. The recorded errors are saved in a log file and can be referenced later.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Interactive Debugging:''' Using this tool you can stop the application in its tracks and inspect the state of the variables or other parameters to locate the error.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a summary of the various approaches and the modes in which they can be used: &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Approach !! Development !! Production&lt;br /&gt;
|-&lt;br /&gt;
| Printing to Terminal || ✓ || &lt;br /&gt;
|-&lt;br /&gt;
| Logging || ✓ || ✓&lt;br /&gt;
|-&lt;br /&gt;
| Interactive Debugging || ✓ || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
Steps to follow when faced with an error can be concisely represented by RASP according to Dr. Fox.&lt;br /&gt;
===What is RASP?===&lt;br /&gt;
RASP is an acronym which briefs the steps which a developer could follow if she were facing an error message. It stands for:&lt;br /&gt;
#'''Read''' the error message.&lt;br /&gt;
#'''Ask''' your colleague  &lt;br /&gt;
#'''Search''' using [http://stackoverflow.com/ Stack Overflow] or any other search engine.&lt;br /&gt;
#'''Post''' on [http://stackoverflow.com/ Stack Overflow] or class forum&lt;br /&gt;
&lt;br /&gt;
Reading the error message carefully is the first step in debugging. The error messages in Rails are incredibly detailed and it gives us a lot of information, reading it carefully can help us locate the file and line in which you are facing the error. But what if the line looks alright to you?&amp;lt;br&amp;gt;&lt;br /&gt;
The next step is to ask a colleague an informed question. In case you are doing pair programming, this is a good step to take. The question has to be of the form &amp;quot;I am trying to do this and I expected to get this but I got this other thing instead of foo.&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
If the previous steps fail then searching using stack overflow or Google is next, especially if its an error which is particular to a version of gems or OS.&amp;lt;br&amp;gt;&lt;br /&gt;
In case you don't find a solution to your problem the final step is to get minimal but complete information which reproduces the error message which you are experiencing and post it.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example question and solution from stack overflow:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Ques.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As we can see the question follows the guidelines explained above. It gives minimal but complete information about the error. It does not give the entire description of the error. It is important to post minimal information so that the person who answers the question can understand your problem quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Ans.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The answer is posted within an hour of posting the question. This shows that posting on stack overflow is a fast way of getting expert help with debugging.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
Rails usually provides a very verbose description of error messages. Dr. Fox tells us that error messages are our friends, they try to not only show us what went wrong but a great deal of detail of where it went wrong. Let us look at an example error message.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
An error message was deliberately caused by entering a route which wouldn't work. The application which we are using is the backchannel application and we are trying to find a post with id=20 (it doesn't exist). This causes rails to throw the following error  message.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;'''ActiveRecord::RecordNotFound in PostsController#show'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;Couldn't find Post with id=20&amp;lt;br&amp;gt;&lt;br /&gt;
 Rails.root: C:/Users/BruceWayne/Downloads/BackChannelApplication&amp;lt;br&amp;gt;&lt;br /&gt;
 Application Trace | Framework Trace | Full Trace&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''What is the error message trying to tell us?'''&amp;lt;br&amp;gt;&lt;br /&gt;
It tells us that ActiveRecord raised the error, and the error was raised in the show method of the Posts Controller. Rails tried to find a post with id=20 but it failed.&lt;br /&gt;
===Application Trace===&lt;br /&gt;
The application trace will give us the file, line number and the method in which the error was thrown. For the above example the application trace will look like this:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;app/controllers/posts_controller.rb:17:in `show'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also get the application trace manually at any point through the following command:&lt;br /&gt;
 begin&lt;br /&gt;
  raise object.inspect&lt;br /&gt;
 rescue&lt;br /&gt;
  Rails.logger.warn $!.backtrace.to_yaml&lt;br /&gt;
 end&lt;br /&gt;
This will cause a deliberate error along with an application trace of how you got there.&lt;br /&gt;
&lt;br /&gt;
===Stack Trace===&lt;br /&gt;
Full stack trace shows us the entire stack trace of right when the application started until the problem is encountered. Usually stack traces are very lengthy but they can be very useful to solve problems. Here is a partial stack trace from the back channel application error which we saw before:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:341:in `find_one'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:107:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 C:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 app/controllers/posts_controller.rb:17:in `show'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see the stack trace right from where the Rails application started, we can see the calls to activerecord. It is unlikely that there would be a problem in those files. As we continue looking into the stack trace we see the find method, we can click on the link in the trace and it will take us to the line in which the error was found. Most often the first few lines of the stack trace will give us the cause behind the error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stack trace can be logged using the following lines of code:&lt;br /&gt;
 begin&lt;br /&gt;
  raise&lt;br /&gt;
 rescue =&amp;gt; e&lt;br /&gt;
  logger.error e.message&lt;br /&gt;
  e.backtrace.each { |line| logger.error line }&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
Session dump gives all the information of the user's session. This is useful if the error which needs to be fixed is particular to a user or a group of users.&lt;br /&gt;
 &amp;lt;code&amp;gt;_csrf_token: &amp;quot;LiTiqHSVFOr8uT0+pFJhNCFjUc3YikuJy6F77QG+O1Y=&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 comment_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 post_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 session_id: &amp;quot;c562769a55b39620228ce6064aaa1637&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 user: #&amp;lt;User id: 4, name: &amp;quot;seriously&amp;quot;, username: &amp;quot;seriously&amp;quot;, email: &amp;quot;seriously@seriously.com&amp;quot;,&amp;lt;br&amp;gt; encrypted_password: &amp;quot;cb32e64bd4cb11c7424ea4ea75731450e99ed120d4bab155a42...&amp;quot;, salt: &amp;quot;DlLGMQzwgU&amp;quot;, is_admin: nil,&amp;lt;br&amp;gt; created_at: &amp;quot;2012-11-18 01:08:35&amp;quot;, updated_at: &amp;quot;2012-11-18 01:08:35&amp;quot;&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Environment dump gives details of the rails runtime environment. If the error is localized to users who use the same version of a host or a protocol, we could find that out using the environment dump.&lt;br /&gt;
 &amp;lt;code&amp;gt;GATEWAY_INTERFACE: &amp;quot;CGI/1.1&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT: &amp;quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_CHARSET: &amp;quot;ISO-8859-1,utf-8;q=0.7,*;q=0.3&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_ENCODING: &amp;quot;gzip,deflate,sdch&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_LANGUAGE: &amp;quot;en-US,en;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_ADDR: &amp;quot;127.0.0.1&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_HOST: &amp;quot;Wayne-PC&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_NAME: &amp;quot;localhost&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_PROTOCOL: &amp;quot;HTTP/1.1&amp;quot;&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===A Very Common Error Message in Ruby===&lt;br /&gt;
&amp;lt;code&amp;gt;undefined method ‘foo’ for nil:NilClass&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most often, it means that an assignment failed and we didn't check for errors.&amp;lt;br&amp;gt;&lt;br /&gt;
Example: &amp;lt;code&amp;gt;@m = Movie.find_by_id(id) #could be nil&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you try to call m.title after an assignment like the one above, it will throw this error.&lt;br /&gt;
&lt;br /&gt;
==Rails Debugger==&lt;br /&gt;
===What is a debugger?===&lt;br /&gt;
Sometimes printing errors to the console or logging is not enough to find out the root cause behind an error message. It is during these times when the debugger is a developer's best friend. The debugger helps us to step forward or backward in the code, execute or skip lines of code, examine the state of a variable or a parameter which has been passed. This will help the developer pinpoint to the actual source of the problem and fix it.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''How to install the debugger?'''&amp;lt;br&amp;gt;&lt;br /&gt;
In Rails, ruby-debug is a gem. We can install it like any other gem. To use the gem in a Rails application we need to add the following line: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;require &amp;quot;ruby-debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
in the &amp;lt;code&amp;gt;config/environments/development.rb&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Ruby 1.9, you can use this command to install a compatible version of the debugger gem:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;gem install debugger&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Running the debugger&amp;lt;br&amp;gt;'''&lt;br /&gt;
To use the debugger in the rails application we need to start the server with the &amp;lt;code&amp;gt;--debugger&amp;lt;/code&amp;gt; option. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$ rails server --debugger&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we don't do this we would encounter an error like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;***** Debugger requested, but was not available: Start server with --debugger to enable *****&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can invoke the debugger from any method by using the &amp;lt;code&amp;gt;debugger&amp;lt;/code&amp;gt; keyword in the method.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;
  def new&lt;br /&gt;
    debugger&lt;br /&gt;
    @post = Post.new&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Once the debugger method is called a debugger shell is started inside the terminal window where the application server was launched, and the cursor will be placed at ruby-debug’s prompt &amp;lt;code&amp;gt;(rdb:n)&amp;lt;/code&amp;gt; where n is the thread number. The prompt will show the next line of code which is waiting to run.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Rails is a relatively new platform for development, it is continually evolving which effectively means debugging is harder. However by leveraging the knowledge of people who have encountered similar errors before we can resolve a subset of the problems, the ones particular to versions of ruby and other gems. We have tools like debugger and application trace to help us solve problems which are specific to our application. To know more about using the debugger, please refer to the Further Reading section of the article.&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
# [http://guides.rubyonrails.org/debugging_rails_applications.html Rails Guide - Debugging Rails Applications]&lt;br /&gt;
# [http://www.sitepoint.com/debug-rails-app-ruby-debug/ Debug your rails app with ruby-debug]&lt;br /&gt;
# [http://rubyforge.org/projects/ruby-debug/ Ruby Forge - Documentation for ruby-debug]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# https://www.youtube.com/watch?v=Ee5vfe0mLb8&lt;br /&gt;
# http://railstips.org/blog/archives/2011/08/31/stupid-simple-debugging/&lt;br /&gt;
# http://guides.rubyonrails.org/debugging_rails_applications.html&lt;br /&gt;
# http://railscasts.com/episodes/54-debugging-with-ruby-debug&lt;br /&gt;
# http://bashdb.sourceforge.net/ruby-debug.html&lt;br /&gt;
# http://cheat.errtheblog.com/s/rdebug/&lt;br /&gt;
# http://railscasts.com/episodes/24-the-stack-trace&lt;br /&gt;
# http://www.scribd.com/doc/86869289/3/Rails-Cookery-3&lt;br /&gt;
# http://www.ruby-forum.com/topic/67687&lt;br /&gt;
# http://stackoverflow.com/questions/8408936/rake-dbmigrate-error&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70336</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70336"/>
		<updated>2012-11-18T20:43:36Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Application Trace */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This is a wiki article for the material presented in the Coursera SaaS video series, [https://www.youtube.com/watch?v=Ee5vfe0mLb8 3.13 Debugging by Dr. Armando Fox and Dr. David Patterson]. We aim to cover all the material presented in the video with definitions and examples&lt;br /&gt;
===Why debugging in Rails can be tricky?===&lt;br /&gt;
*We are used to printing the error on the terminal in most applications(Example: [http://www.cplusplus.com/reference/clibrary/cstdio/stderr/ STDERR]). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
*Errors early in flow might manifest itself late.&lt;br /&gt;
Consider the following hierarchy seen in a Rails application:&lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; Model -&amp;gt; View -&amp;gt; Renderer&lt;br /&gt;
 &lt;br /&gt;
Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
&lt;br /&gt;
*Errors can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging based on the mode of operation, that is development mode or production mode:&lt;br /&gt;
 &lt;br /&gt;
'''Printing to terminal:'''This is useful for developers, when they are writing code they can print errors to the terminal and then examine them. We cannot use this approach in production mode.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Logging:''' This is a more general approach to debugging which can be used in both modes. The logged entries are permanent record of what the application is doing. The recorded errors are saved in a log file and can be referenced later.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Interactive Debugging:''' Using this tool you can stop the application in its tracks and inspect the state of the variables or other parameters to locate the error.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a summary of the various approaches and the modes in which they can be used: &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Approach !! Development !! Production&lt;br /&gt;
|-&lt;br /&gt;
| Printing to Terminal || ✓ || &lt;br /&gt;
|-&lt;br /&gt;
| Logging || ✓ || ✓&lt;br /&gt;
|-&lt;br /&gt;
| Interactive Debugging || ✓ || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
Steps to follow when faced with an error can be concisely represented by RASP according to Dr. Fox.&lt;br /&gt;
===What is RASP?===&lt;br /&gt;
RASP is an acronym which briefs the steps which a developer could follow if she were facing an error message. It stands for:&lt;br /&gt;
#'''Read''' the error message.&lt;br /&gt;
#'''Ask''' your colleague  &lt;br /&gt;
#'''Search''' using [http://stackoverflow.com/ Stack Overflow] or any other search engine.&lt;br /&gt;
#'''Post''' on [http://stackoverflow.com/ Stack Overflow] or class forum&lt;br /&gt;
&lt;br /&gt;
Reading the error message carefully is the first step in debugging. The error messages in Rails are incredibly detailed and it gives us a lot of information, reading it carefully can help us locate the file and line in which you are facing the error. But what if the line looks alright to you?&amp;lt;br&amp;gt;&lt;br /&gt;
The next step is to ask a colleague an informed question. In case you are doing pair programming, this is a good step to take. The question has to be of the form &amp;quot;I am trying to do this and I expected to get this but I got this other thing instead of foo.&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
If the previous steps fail then searching using stack overflow or Google is next, especially if its an error which is particular to a version of gems or OS.&amp;lt;br&amp;gt;&lt;br /&gt;
In case you don't find a solution to your problem the final step is to get minimal but complete information which reproduces the error message which you are experiencing and post it.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example question and solution from stack overflow:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Ques.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As we can see the question follows the guidelines explained above. It gives minimal but complete information about the error. It does not give the entire description of the error. It is important to post minimal information so that the person who answers the question can understand your problem quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Ans.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The answer is posted within an hour of posting the question. This shows that posting on stack overflow is a fast way of getting expert help with debugging.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
Rails usually provides a very verbose description of error messages. Dr. Fox tells us that error messages are our friends, they try to not only show us what went wrong but a great deal of detail of where it went wrong. Let us look at an example error message.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
An error message was deliberately caused by entering a route which wouldn't work. The application which we are using is the backchannel application and we are trying to find a post with id=20 (it doesn't exist). This causes rails to throw the following error  message.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;'''ActiveRecord::RecordNotFound in PostsController#show'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;Couldn't find Post with id=20&amp;lt;br&amp;gt;&lt;br /&gt;
 Rails.root: C:/Users/BruceWayne/Downloads/BackChannelApplication&amp;lt;br&amp;gt;&lt;br /&gt;
 Application Trace | Framework Trace | Full Trace&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''What is the error message trying to tell us?'''&amp;lt;br&amp;gt;&lt;br /&gt;
It tells us that ActiveRecord raised the error, and the error was raised in the show method of the Posts Controller. Rails tried to find a post with id=20 but it failed.&lt;br /&gt;
===Application Trace===&lt;br /&gt;
The application trace will give us the file, line number and the method in which the error was thrown. For the above example the application trace will look like this:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;app/controllers/posts_controller.rb:17:in `show'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also get the application trace manually at any point through the following command:&lt;br /&gt;
 begin&lt;br /&gt;
  raise object.inspect&lt;br /&gt;
 rescue&lt;br /&gt;
  Rails.logger.warn $!.backtrace.to_yaml&lt;br /&gt;
 end&lt;br /&gt;
This will cause a deliberate error along with an application trace of how you got there.&lt;br /&gt;
&lt;br /&gt;
===Stack Trace===&lt;br /&gt;
Full stack trace shows us the entire stack trace of right when the application started until the problem is encountered. Usually stack traces are very lengthy but they can be very useful to solve problems. Here is a partial stack trace from the back channel application error which we saw before:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:341:in `find_one'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:107:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 C:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 app/controllers/posts_controller.rb:17:in `show'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see the stack trace right from where the Rails application started, we can see the calls to activerecord. It is unlikely that there would be a problem in those files. As we continue looking into the stack trace we see the find method, we can click on the link in the trace and it will take us to the line in which the error was found. Most often the first few lines of the stack trace will give us the cause behind the error.&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
Session dump gives all the information of the user's session. This is useful if the error which needs to be fixed is particular to a user or a group of users.&lt;br /&gt;
 &amp;lt;code&amp;gt;_csrf_token: &amp;quot;LiTiqHSVFOr8uT0+pFJhNCFjUc3YikuJy6F77QG+O1Y=&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 comment_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 post_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 session_id: &amp;quot;c562769a55b39620228ce6064aaa1637&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 user: #&amp;lt;User id: 4, name: &amp;quot;seriously&amp;quot;, username: &amp;quot;seriously&amp;quot;, email: &amp;quot;seriously@seriously.com&amp;quot;,&amp;lt;br&amp;gt; encrypted_password: &amp;quot;cb32e64bd4cb11c7424ea4ea75731450e99ed120d4bab155a42...&amp;quot;, salt: &amp;quot;DlLGMQzwgU&amp;quot;, is_admin: nil,&amp;lt;br&amp;gt; created_at: &amp;quot;2012-11-18 01:08:35&amp;quot;, updated_at: &amp;quot;2012-11-18 01:08:35&amp;quot;&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Environment dump gives details of the rails runtime environment. If the error is localized to users who use the same version of a host or a protocol, we could find that out using the environment dump.&lt;br /&gt;
 &amp;lt;code&amp;gt;GATEWAY_INTERFACE: &amp;quot;CGI/1.1&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT: &amp;quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_CHARSET: &amp;quot;ISO-8859-1,utf-8;q=0.7,*;q=0.3&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_ENCODING: &amp;quot;gzip,deflate,sdch&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_LANGUAGE: &amp;quot;en-US,en;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_ADDR: &amp;quot;127.0.0.1&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_HOST: &amp;quot;Wayne-PC&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_NAME: &amp;quot;localhost&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_PROTOCOL: &amp;quot;HTTP/1.1&amp;quot;&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===A Very Common Error Message in Ruby===&lt;br /&gt;
&amp;lt;code&amp;gt;undefined method ‘foo’ for nil:NilClass&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most often, it means that an assignment failed and we didn't check for errors.&amp;lt;br&amp;gt;&lt;br /&gt;
Example: &amp;lt;code&amp;gt;@m = Movie.find_by_id(id) #could be nil&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you try to call m.title after an assignment like the one above, it will throw this error.&lt;br /&gt;
&lt;br /&gt;
==Rails Debugger==&lt;br /&gt;
===What is a debugger?===&lt;br /&gt;
Sometimes printing errors to the console or logging is not enough to find out the root cause behind an error message. It is during these times when the debugger is a developer's best friend. The debugger helps us to step forward or backward in the code, execute or skip lines of code, examine the state of a variable or a parameter which has been passed. This will help the developer pinpoint to the actual source of the problem and fix it.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''How to install the debugger?'''&amp;lt;br&amp;gt;&lt;br /&gt;
In Rails, ruby-debug is a gem. We can install it like any other gem. To use the gem in a Rails application we need to add the following line: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;require &amp;quot;ruby-debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
in the &amp;lt;code&amp;gt;config/environments/development.rb&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Ruby 1.9, you can use this command to install a compatible version of the debugger gem:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;gem install debugger&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Running the debugger&amp;lt;br&amp;gt;'''&lt;br /&gt;
To use the debugger in the rails application we need to start the server with the &amp;lt;code&amp;gt;--debugger&amp;lt;/code&amp;gt; option. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$ rails server --debugger&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we don't do this we would encounter an error like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;***** Debugger requested, but was not available: Start server with --debugger to enable *****&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can invoke the debugger from any method by using the &amp;lt;code&amp;gt;debugger&amp;lt;/code&amp;gt; keyword in the method.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;
  def new&lt;br /&gt;
    debugger&lt;br /&gt;
    @post = Post.new&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Once the debugger method is called a debugger shell is started inside the terminal window where the application server was launched, and the cursor will be placed at ruby-debug’s prompt &amp;lt;code&amp;gt;(rdb:n)&amp;lt;/code&amp;gt; where n is the thread number. The prompt will show the next line of code which is waiting to run.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Rails is a relatively new platform for development, it is continually evolving which effectively means debugging is harder. However by leveraging the knowledge of people who have encountered similar errors before we can resolve a subset of the problems, the ones particular to versions of ruby and other gems. We have tools like debugger and application trace to help us solve problems which are specific to our application. To know more about using the debugger, please refer to the Further Reading section of the article.&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
# [http://guides.rubyonrails.org/debugging_rails_applications.html Rails Guide - Debugging Rails Applications]&lt;br /&gt;
# [http://www.sitepoint.com/debug-rails-app-ruby-debug/ Debug your rails app with ruby-debug]&lt;br /&gt;
# [http://rubyforge.org/projects/ruby-debug/ Ruby Forge - Documentation for ruby-debug]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# https://www.youtube.com/watch?v=Ee5vfe0mLb8&lt;br /&gt;
# http://railstips.org/blog/archives/2011/08/31/stupid-simple-debugging/&lt;br /&gt;
# http://guides.rubyonrails.org/debugging_rails_applications.html&lt;br /&gt;
# http://railscasts.com/episodes/54-debugging-with-ruby-debug&lt;br /&gt;
# http://bashdb.sourceforge.net/ruby-debug.html&lt;br /&gt;
# http://cheat.errtheblog.com/s/rdebug/&lt;br /&gt;
# http://railscasts.com/episodes/24-the-stack-trace&lt;br /&gt;
# http://www.scribd.com/doc/86869289/3/Rails-Cookery-3&lt;br /&gt;
# http://www.ruby-forum.com/topic/67687&lt;br /&gt;
# http://stackoverflow.com/questions/8408936/rake-dbmigrate-error&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70334</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70334"/>
		<updated>2012-11-18T20:43:06Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Application Trace */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This is a wiki article for the material presented in the Coursera SaaS video series, [https://www.youtube.com/watch?v=Ee5vfe0mLb8 3.13 Debugging by Dr. Armando Fox and Dr. David Patterson]. We aim to cover all the material presented in the video with definitions and examples&lt;br /&gt;
===Why debugging in Rails can be tricky?===&lt;br /&gt;
*We are used to printing the error on the terminal in most applications(Example: [http://www.cplusplus.com/reference/clibrary/cstdio/stderr/ STDERR]). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
*Errors early in flow might manifest itself late.&lt;br /&gt;
Consider the following hierarchy seen in a Rails application:&lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; Model -&amp;gt; View -&amp;gt; Renderer&lt;br /&gt;
 &lt;br /&gt;
Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
&lt;br /&gt;
*Errors can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging based on the mode of operation, that is development mode or production mode:&lt;br /&gt;
 &lt;br /&gt;
'''Printing to terminal:'''This is useful for developers, when they are writing code they can print errors to the terminal and then examine them. We cannot use this approach in production mode.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Logging:''' This is a more general approach to debugging which can be used in both modes. The logged entries are permanent record of what the application is doing. The recorded errors are saved in a log file and can be referenced later.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Interactive Debugging:''' Using this tool you can stop the application in its tracks and inspect the state of the variables or other parameters to locate the error.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a summary of the various approaches and the modes in which they can be used: &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Approach !! Development !! Production&lt;br /&gt;
|-&lt;br /&gt;
| Printing to Terminal || ✓ || &lt;br /&gt;
|-&lt;br /&gt;
| Logging || ✓ || ✓&lt;br /&gt;
|-&lt;br /&gt;
| Interactive Debugging || ✓ || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
Steps to follow when faced with an error can be concisely represented by RASP according to Dr. Fox.&lt;br /&gt;
===What is RASP?===&lt;br /&gt;
RASP is an acronym which briefs the steps which a developer could follow if she were facing an error message. It stands for:&lt;br /&gt;
#'''Read''' the error message.&lt;br /&gt;
#'''Ask''' your colleague  &lt;br /&gt;
#'''Search''' using [http://stackoverflow.com/ Stack Overflow] or any other search engine.&lt;br /&gt;
#'''Post''' on [http://stackoverflow.com/ Stack Overflow] or class forum&lt;br /&gt;
&lt;br /&gt;
Reading the error message carefully is the first step in debugging. The error messages in Rails are incredibly detailed and it gives us a lot of information, reading it carefully can help us locate the file and line in which you are facing the error. But what if the line looks alright to you?&amp;lt;br&amp;gt;&lt;br /&gt;
The next step is to ask a colleague an informed question. In case you are doing pair programming, this is a good step to take. The question has to be of the form &amp;quot;I am trying to do this and I expected to get this but I got this other thing instead of foo.&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
If the previous steps fail then searching using stack overflow or Google is next, especially if its an error which is particular to a version of gems or OS.&amp;lt;br&amp;gt;&lt;br /&gt;
In case you don't find a solution to your problem the final step is to get minimal but complete information which reproduces the error message which you are experiencing and post it.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example question and solution from stack overflow:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Ques.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As we can see the question follows the guidelines explained above. It gives minimal but complete information about the error. It does not give the entire description of the error. It is important to post minimal information so that the person who answers the question can understand your problem quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Ans.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The answer is posted within an hour of posting the question. This shows that posting on stack overflow is a fast way of getting expert help with debugging.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
Rails usually provides a very verbose description of error messages. Dr. Fox tells us that error messages are our friends, they try to not only show us what went wrong but a great deal of detail of where it went wrong. Let us look at an example error message.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
An error message was deliberately caused by entering a route which wouldn't work. The application which we are using is the backchannel application and we are trying to find a post with id=20 (it doesn't exist). This causes rails to throw the following error  message.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;'''ActiveRecord::RecordNotFound in PostsController#show'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;Couldn't find Post with id=20&amp;lt;br&amp;gt;&lt;br /&gt;
 Rails.root: C:/Users/BruceWayne/Downloads/BackChannelApplication&amp;lt;br&amp;gt;&lt;br /&gt;
 Application Trace | Framework Trace | Full Trace&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''What is the error message trying to tell us?'''&amp;lt;br&amp;gt;&lt;br /&gt;
It tells us that ActiveRecord raised the error, and the error was raised in the show method of the Posts Controller. Rails tried to find a post with id=20 but it failed.&lt;br /&gt;
===Application Trace===&lt;br /&gt;
The application trace will give us the file, line number and the method in which the error was thrown. For the above example the application trace will look like this:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;app/controllers/posts_controller.rb:17:in `show'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also get the application trace manually at any point through the following command:&lt;br /&gt;
 begin&lt;br /&gt;
  raise object.inspect&lt;br /&gt;
rescue&lt;br /&gt;
  Rails.logger.warn $!.backtrace.to_yaml&lt;br /&gt;
end&lt;br /&gt;
This will cause a deliberate error along with an application trace of how you got there.&lt;br /&gt;
&lt;br /&gt;
===Stack Trace===&lt;br /&gt;
Full stack trace shows us the entire stack trace of right when the application started until the problem is encountered. Usually stack traces are very lengthy but they can be very useful to solve problems. Here is a partial stack trace from the back channel application error which we saw before:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:341:in `find_one'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:107:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 C:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 app/controllers/posts_controller.rb:17:in `show'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see the stack trace right from where the Rails application started, we can see the calls to activerecord. It is unlikely that there would be a problem in those files. As we continue looking into the stack trace we see the find method, we can click on the link in the trace and it will take us to the line in which the error was found. Most often the first few lines of the stack trace will give us the cause behind the error.&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
Session dump gives all the information of the user's session. This is useful if the error which needs to be fixed is particular to a user or a group of users.&lt;br /&gt;
 &amp;lt;code&amp;gt;_csrf_token: &amp;quot;LiTiqHSVFOr8uT0+pFJhNCFjUc3YikuJy6F77QG+O1Y=&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 comment_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 post_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 session_id: &amp;quot;c562769a55b39620228ce6064aaa1637&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 user: #&amp;lt;User id: 4, name: &amp;quot;seriously&amp;quot;, username: &amp;quot;seriously&amp;quot;, email: &amp;quot;seriously@seriously.com&amp;quot;,&amp;lt;br&amp;gt; encrypted_password: &amp;quot;cb32e64bd4cb11c7424ea4ea75731450e99ed120d4bab155a42...&amp;quot;, salt: &amp;quot;DlLGMQzwgU&amp;quot;, is_admin: nil,&amp;lt;br&amp;gt; created_at: &amp;quot;2012-11-18 01:08:35&amp;quot;, updated_at: &amp;quot;2012-11-18 01:08:35&amp;quot;&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Environment dump gives details of the rails runtime environment. If the error is localized to users who use the same version of a host or a protocol, we could find that out using the environment dump.&lt;br /&gt;
 &amp;lt;code&amp;gt;GATEWAY_INTERFACE: &amp;quot;CGI/1.1&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT: &amp;quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_CHARSET: &amp;quot;ISO-8859-1,utf-8;q=0.7,*;q=0.3&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_ENCODING: &amp;quot;gzip,deflate,sdch&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_LANGUAGE: &amp;quot;en-US,en;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_ADDR: &amp;quot;127.0.0.1&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_HOST: &amp;quot;Wayne-PC&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_NAME: &amp;quot;localhost&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_PROTOCOL: &amp;quot;HTTP/1.1&amp;quot;&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===A Very Common Error Message in Ruby===&lt;br /&gt;
&amp;lt;code&amp;gt;undefined method ‘foo’ for nil:NilClass&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most often, it means that an assignment failed and we didn't check for errors.&amp;lt;br&amp;gt;&lt;br /&gt;
Example: &amp;lt;code&amp;gt;@m = Movie.find_by_id(id) #could be nil&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you try to call m.title after an assignment like the one above, it will throw this error.&lt;br /&gt;
&lt;br /&gt;
==Rails Debugger==&lt;br /&gt;
===What is a debugger?===&lt;br /&gt;
Sometimes printing errors to the console or logging is not enough to find out the root cause behind an error message. It is during these times when the debugger is a developer's best friend. The debugger helps us to step forward or backward in the code, execute or skip lines of code, examine the state of a variable or a parameter which has been passed. This will help the developer pinpoint to the actual source of the problem and fix it.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''How to install the debugger?'''&amp;lt;br&amp;gt;&lt;br /&gt;
In Rails, ruby-debug is a gem. We can install it like any other gem. To use the gem in a Rails application we need to add the following line: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;require &amp;quot;ruby-debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
in the &amp;lt;code&amp;gt;config/environments/development.rb&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Ruby 1.9, you can use this command to install a compatible version of the debugger gem:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;gem install debugger&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Running the debugger&amp;lt;br&amp;gt;'''&lt;br /&gt;
To use the debugger in the rails application we need to start the server with the &amp;lt;code&amp;gt;--debugger&amp;lt;/code&amp;gt; option. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$ rails server --debugger&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we don't do this we would encounter an error like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;***** Debugger requested, but was not available: Start server with --debugger to enable *****&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can invoke the debugger from any method by using the &amp;lt;code&amp;gt;debugger&amp;lt;/code&amp;gt; keyword in the method.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;
  def new&lt;br /&gt;
    debugger&lt;br /&gt;
    @post = Post.new&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Once the debugger method is called a debugger shell is started inside the terminal window where the application server was launched, and the cursor will be placed at ruby-debug’s prompt &amp;lt;code&amp;gt;(rdb:n)&amp;lt;/code&amp;gt; where n is the thread number. The prompt will show the next line of code which is waiting to run.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Rails is a relatively new platform for development, it is continually evolving which effectively means debugging is harder. However by leveraging the knowledge of people who have encountered similar errors before we can resolve a subset of the problems, the ones particular to versions of ruby and other gems. We have tools like debugger and application trace to help us solve problems which are specific to our application. To know more about using the debugger, please refer to the Further Reading section of the article.&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
# [http://guides.rubyonrails.org/debugging_rails_applications.html Rails Guide - Debugging Rails Applications]&lt;br /&gt;
# [http://www.sitepoint.com/debug-rails-app-ruby-debug/ Debug your rails app with ruby-debug]&lt;br /&gt;
# [http://rubyforge.org/projects/ruby-debug/ Ruby Forge - Documentation for ruby-debug]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# https://www.youtube.com/watch?v=Ee5vfe0mLb8&lt;br /&gt;
# http://railstips.org/blog/archives/2011/08/31/stupid-simple-debugging/&lt;br /&gt;
# http://guides.rubyonrails.org/debugging_rails_applications.html&lt;br /&gt;
# http://railscasts.com/episodes/54-debugging-with-ruby-debug&lt;br /&gt;
# http://bashdb.sourceforge.net/ruby-debug.html&lt;br /&gt;
# http://cheat.errtheblog.com/s/rdebug/&lt;br /&gt;
# http://railscasts.com/episodes/24-the-stack-trace&lt;br /&gt;
# http://www.scribd.com/doc/86869289/3/Rails-Cookery-3&lt;br /&gt;
# http://www.ruby-forum.com/topic/67687&lt;br /&gt;
# http://stackoverflow.com/questions/8408936/rake-dbmigrate-error&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70333</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=70333"/>
		<updated>2012-11-18T20:38:48Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Application Trace */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This is a wiki article for the material presented in the Coursera SaaS video series, [https://www.youtube.com/watch?v=Ee5vfe0mLb8 3.13 Debugging by Dr. Armando Fox and Dr. David Patterson]. We aim to cover all the material presented in the video with definitions and examples&lt;br /&gt;
===Why debugging in Rails can be tricky?===&lt;br /&gt;
*We are used to printing the error on the terminal in most applications(Example: [http://www.cplusplus.com/reference/clibrary/cstdio/stderr/ STDERR]). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
*Errors early in flow might manifest itself late.&lt;br /&gt;
Consider the following hierarchy seen in a Rails application:&lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; Model -&amp;gt; View -&amp;gt; Renderer&lt;br /&gt;
 &lt;br /&gt;
Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
&lt;br /&gt;
*Errors can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging based on the mode of operation, that is development mode or production mode:&lt;br /&gt;
 &lt;br /&gt;
'''Printing to terminal:'''This is useful for developers, when they are writing code they can print errors to the terminal and then examine them. We cannot use this approach in production mode.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Logging:''' This is a more general approach to debugging which can be used in both modes. The logged entries are permanent record of what the application is doing. The recorded errors are saved in a log file and can be referenced later.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Interactive Debugging:''' Using this tool you can stop the application in its tracks and inspect the state of the variables or other parameters to locate the error.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a summary of the various approaches and the modes in which they can be used: &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Approach !! Development !! Production&lt;br /&gt;
|-&lt;br /&gt;
| Printing to Terminal || ✓ || &lt;br /&gt;
|-&lt;br /&gt;
| Logging || ✓ || ✓&lt;br /&gt;
|-&lt;br /&gt;
| Interactive Debugging || ✓ || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
Steps to follow when faced with an error can be concisely represented by RASP according to Dr. Fox.&lt;br /&gt;
===What is RASP?===&lt;br /&gt;
RASP is an acronym which briefs the steps which a developer could follow if she were facing an error message. It stands for:&lt;br /&gt;
#'''Read''' the error message.&lt;br /&gt;
#'''Ask''' your colleague  &lt;br /&gt;
#'''Search''' using [http://stackoverflow.com/ Stack Overflow] or any other search engine.&lt;br /&gt;
#'''Post''' on [http://stackoverflow.com/ Stack Overflow] or class forum&lt;br /&gt;
&lt;br /&gt;
Reading the error message carefully is the first step in debugging. The error messages in Rails are incredibly detailed and it gives us a lot of information, reading it carefully can help us locate the file and line in which you are facing the error. But what if the line looks alright to you?&amp;lt;br&amp;gt;&lt;br /&gt;
The next step is to ask a colleague an informed question. In case you are doing pair programming, this is a good step to take. The question has to be of the form &amp;quot;I am trying to do this and I expected to get this but I got this other thing instead of foo.&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
If the previous steps fail then searching using stack overflow or Google is next, especially if its an error which is particular to a version of gems or OS.&amp;lt;br&amp;gt;&lt;br /&gt;
In case you don't find a solution to your problem the final step is to get minimal but complete information which reproduces the error message which you are experiencing and post it.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an example question and solution from stack overflow:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Ques.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As we can see the question follows the guidelines explained above. It gives minimal but complete information about the error. It does not give the entire description of the error. It is important to post minimal information so that the person who answers the question can understand your problem quickly.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Ans.png]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The answer is posted within an hour of posting the question. This shows that posting on stack overflow is a fast way of getting expert help with debugging.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
Rails usually provides a very verbose description of error messages. Dr. Fox tells us that error messages are our friends, they try to not only show us what went wrong but a great deal of detail of where it went wrong. Let us look at an example error message.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
An error message was deliberately caused by entering a route which wouldn't work. The application which we are using is the backchannel application and we are trying to find a post with id=20 (it doesn't exist). This causes rails to throw the following error  message.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;'''ActiveRecord::RecordNotFound in PostsController#show'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;Couldn't find Post with id=20&amp;lt;br&amp;gt;&lt;br /&gt;
 Rails.root: C:/Users/BruceWayne/Downloads/BackChannelApplication&amp;lt;br&amp;gt;&lt;br /&gt;
 Application Trace | Framework Trace | Full Trace&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''What is the error message trying to tell us?'''&amp;lt;br&amp;gt;&lt;br /&gt;
It tells us that ActiveRecord raised the error, and the error was raised in the show method of the Posts Controller. Rails tried to find a post with id=20 but it failed.&lt;br /&gt;
===Application Trace===&lt;br /&gt;
The application trace will give us the file, line number and the method in which the error was thrown. For the above example the application trace will look like this:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;app/controllers/posts_controller.rb:17:in `show'&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also get the application trace manually at any point through the following command:&lt;br /&gt;
 raise object.inspect&lt;br /&gt;
This will cause a deliberate error along with an application trace of how you got there.&lt;br /&gt;
&lt;br /&gt;
===Stack Trace===&lt;br /&gt;
Full stack trace shows us the entire stack trace of right when the application started until the problem is encountered. Usually stack traces are very lengthy but they can be very useful to solve problems. Here is a partial stack trace from the back channel application error which we saw before:&amp;lt;br&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:341:in `find_one'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'&amp;lt;br&amp;gt;&lt;br /&gt;
 activerecord (3.2.8) lib/active_record/relation/finder_methods.rb:107:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 C:in `find'&amp;lt;br&amp;gt;&lt;br /&gt;
 app/controllers/posts_controller.rb:17:in `show'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'&amp;lt;br&amp;gt;&lt;br /&gt;
 actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can see the stack trace right from where the Rails application started, we can see the calls to activerecord. It is unlikely that there would be a problem in those files. As we continue looking into the stack trace we see the find method, we can click on the link in the trace and it will take us to the line in which the error was found. Most often the first few lines of the stack trace will give us the cause behind the error.&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
Session dump gives all the information of the user's session. This is useful if the error which needs to be fixed is particular to a user or a group of users.&lt;br /&gt;
 &amp;lt;code&amp;gt;_csrf_token: &amp;quot;LiTiqHSVFOr8uT0+pFJhNCFjUc3YikuJy6F77QG+O1Y=&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 comment_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 post_id: 1&amp;lt;br&amp;gt;&lt;br /&gt;
 session_id: &amp;quot;c562769a55b39620228ce6064aaa1637&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 user: #&amp;lt;User id: 4, name: &amp;quot;seriously&amp;quot;, username: &amp;quot;seriously&amp;quot;, email: &amp;quot;seriously@seriously.com&amp;quot;,&amp;lt;br&amp;gt; encrypted_password: &amp;quot;cb32e64bd4cb11c7424ea4ea75731450e99ed120d4bab155a42...&amp;quot;, salt: &amp;quot;DlLGMQzwgU&amp;quot;, is_admin: nil,&amp;lt;br&amp;gt; created_at: &amp;quot;2012-11-18 01:08:35&amp;quot;, updated_at: &amp;quot;2012-11-18 01:08:35&amp;quot;&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Environment dump gives details of the rails runtime environment. If the error is localized to users who use the same version of a host or a protocol, we could find that out using the environment dump.&lt;br /&gt;
 &amp;lt;code&amp;gt;GATEWAY_INTERFACE: &amp;quot;CGI/1.1&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT: &amp;quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_CHARSET: &amp;quot;ISO-8859-1,utf-8;q=0.7,*;q=0.3&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_ENCODING: &amp;quot;gzip,deflate,sdch&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 HTTP_ACCEPT_LANGUAGE: &amp;quot;en-US,en;q=0.8&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_ADDR: &amp;quot;127.0.0.1&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 REMOTE_HOST: &amp;quot;Wayne-PC&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_NAME: &amp;quot;localhost&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
 SERVER_PROTOCOL: &amp;quot;HTTP/1.1&amp;quot;&amp;lt;br&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===A Very Common Error Message in Ruby===&lt;br /&gt;
&amp;lt;code&amp;gt;undefined method ‘foo’ for nil:NilClass&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most often, it means that an assignment failed and we didn't check for errors.&amp;lt;br&amp;gt;&lt;br /&gt;
Example: &amp;lt;code&amp;gt;@m = Movie.find_by_id(id) #could be nil&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you try to call m.title after an assignment like the one above, it will throw this error.&lt;br /&gt;
&lt;br /&gt;
==Rails Debugger==&lt;br /&gt;
===What is a debugger?===&lt;br /&gt;
Sometimes printing errors to the console or logging is not enough to find out the root cause behind an error message. It is during these times when the debugger is a developer's best friend. The debugger helps us to step forward or backward in the code, execute or skip lines of code, examine the state of a variable or a parameter which has been passed. This will help the developer pinpoint to the actual source of the problem and fix it.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''How to install the debugger?'''&amp;lt;br&amp;gt;&lt;br /&gt;
In Rails, ruby-debug is a gem. We can install it like any other gem. To use the gem in a Rails application we need to add the following line: &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;require &amp;quot;ruby-debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
in the &amp;lt;code&amp;gt;config/environments/development.rb&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Ruby 1.9, you can use this command to install a compatible version of the debugger gem:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;gem install debugger&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''Running the debugger&amp;lt;br&amp;gt;'''&lt;br /&gt;
To use the debugger in the rails application we need to start the server with the &amp;lt;code&amp;gt;--debugger&amp;lt;/code&amp;gt; option. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$ rails server --debugger&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we don't do this we would encounter an error like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;***** Debugger requested, but was not available: Start server with --debugger to enable *****&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can invoke the debugger from any method by using the &amp;lt;code&amp;gt;debugger&amp;lt;/code&amp;gt; keyword in the method.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;
  def new&lt;br /&gt;
    debugger&lt;br /&gt;
    @post = Post.new&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Once the debugger method is called a debugger shell is started inside the terminal window where the application server was launched, and the cursor will be placed at ruby-debug’s prompt &amp;lt;code&amp;gt;(rdb:n)&amp;lt;/code&amp;gt; where n is the thread number. The prompt will show the next line of code which is waiting to run.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Rails is a relatively new platform for development, it is continually evolving which effectively means debugging is harder. However by leveraging the knowledge of people who have encountered similar errors before we can resolve a subset of the problems, the ones particular to versions of ruby and other gems. We have tools like debugger and application trace to help us solve problems which are specific to our application. To know more about using the debugger, please refer to the Further Reading section of the article.&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
# [http://guides.rubyonrails.org/debugging_rails_applications.html Rails Guide - Debugging Rails Applications]&lt;br /&gt;
# [http://www.sitepoint.com/debug-rails-app-ruby-debug/ Debug your rails app with ruby-debug]&lt;br /&gt;
# [http://rubyforge.org/projects/ruby-debug/ Ruby Forge - Documentation for ruby-debug]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
# https://www.youtube.com/watch?v=Ee5vfe0mLb8&lt;br /&gt;
# http://railstips.org/blog/archives/2011/08/31/stupid-simple-debugging/&lt;br /&gt;
# http://guides.rubyonrails.org/debugging_rails_applications.html&lt;br /&gt;
# http://railscasts.com/episodes/54-debugging-with-ruby-debug&lt;br /&gt;
# http://bashdb.sourceforge.net/ruby-debug.html&lt;br /&gt;
# http://cheat.errtheblog.com/s/rdebug/&lt;br /&gt;
# http://railscasts.com/episodes/24-the-stack-trace&lt;br /&gt;
# http://www.scribd.com/doc/86869289/3/Rails-Cookery-3&lt;br /&gt;
# http://www.ruby-forum.com/topic/67687&lt;br /&gt;
# http://stackoverflow.com/questions/8408936/rake-dbmigrate-error&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69776</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69776"/>
		<updated>2012-11-17T04:49:33Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Tips to deal with an error===&lt;br /&gt;
i) Read the error message carefully.&lt;br /&gt;
&lt;br /&gt;
ii) Ask your colleague an informed question in case you are doing pair programming. &lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;br /&gt;
https://www.youtube.com/watch?v=Ee5vfe0mLb8&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69775</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69775"/>
		<updated>2012-11-17T04:48:27Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Tips to deal with an error */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Tips to deal with an error===&lt;br /&gt;
i) Read the error message carefully.&lt;br /&gt;
&lt;br /&gt;
ii) Ask your colleague an informed question in case you are doing pair programming. &lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69774</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69774"/>
		<updated>2012-11-17T04:48:10Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Tips to deal with an error */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Tips to deal with an error===&lt;br /&gt;
i) Read the error message carefully.&lt;br /&gt;
&lt;br /&gt;
ii)Ask your colleague an informed question in case you are doing pair programming. &lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69773</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69773"/>
		<updated>2012-11-17T04:47:33Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Debugging in SaaS/Rails can be tricky */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Tips to deal with an error===&lt;br /&gt;
i) Read the error message carefully.&lt;br /&gt;
ii)Ask your colleague an informed question in case you are doing pair programming. &lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69772</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69772"/>
		<updated>2012-11-17T04:45:13Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Debugging in SaaS/Rails can be tricky */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.\n&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Tips to deal with an error===&lt;br /&gt;
i) Read the error message carefully.&lt;br /&gt;
ii)Ask your colleague an informed question in case you are doing pair programming. &lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69769</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69769"/>
		<updated>2012-11-17T04:37:22Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Steps of RASP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Tips to deal with an error===&lt;br /&gt;
i) Read the error message carefully.&lt;br /&gt;
ii)Ask your colleague an informed question in case you are doing pair programming. &lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69768</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69768"/>
		<updated>2012-11-17T04:28:05Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Definitions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69767</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69767"/>
		<updated>2012-11-17T04:26:05Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 3)Interactive Debugging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69766</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69766"/>
		<updated>2012-11-17T04:25:52Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 2)Logging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
&lt;br /&gt;
===3)Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69765</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69765"/>
		<updated>2012-11-17T04:25:40Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 1)Printing to terminal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
&lt;br /&gt;
===2)Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
===3)Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69764</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69764"/>
		<updated>2012-11-17T04:25:26Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Debugging in SaaS/Rails can be tricky */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
&lt;br /&gt;
===1)Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
===2)Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
===3)Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69763</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69763"/>
		<updated>2012-11-17T04:22:37Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Debugging in SaaS/Rails can be tricky */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the mode of operation.&lt;br /&gt;
===1)Printing to terminal===&lt;br /&gt;
In development mode the user is the master and he can easily debug using this approach. This is not possible in production mode though.&lt;br /&gt;
===2)Logging===&lt;br /&gt;
This is a more general approach. The logged entries are permanent record of what your application is doing. The recorded errors can also be used to be referenced later. This approach can be used both in the development mode as well as the production mode.&lt;br /&gt;
===3)Interactive Debugging===&lt;br /&gt;
In this approach you can stop the application in its track and inspect the variables or other parameters to locate the error.&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69760</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69760"/>
		<updated>2012-11-17T03:58:46Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Debugging in SaaS/Rails can be tricky */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
 Consider the following hierarchy: &lt;br /&gt;
 URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
 Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might     have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the type of user.&lt;br /&gt;
''1) What                Dev?        Prod?&lt;br /&gt;
Printing to terminal        Y       &lt;br /&gt;
Logging            Y        Y&lt;br /&gt;
Interactive Debugging    Y&lt;br /&gt;
&lt;br /&gt;
You can do anything you want in development mode. Print errors to the terminal, which will go by very quickly and it’ll be hard to read. Writing to log file works both in development mode and production mode. Interactive debugger stops the app in its tracks and inspects the state of the variables and then continue.''&lt;br /&gt;
&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69759</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69759"/>
		<updated>2012-11-17T03:57:53Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Debugging in SaaS/Rails can be tricky===&lt;br /&gt;
1) Some people are used to printing the error on the terminal(ex. Standard error). This may not be possible for a web application since its primary form of input and output is through HTTP requests and responses.&lt;br /&gt;
2)Errors early in flow might manifest itself late.&lt;br /&gt;
 For example,&lt;br /&gt;
Consider the following hierarchy: &lt;br /&gt;
URI -&amp;gt; Route -&amp;gt; Controller -&amp;gt; model -&amp;gt; view -&amp;gt; renderer&lt;br /&gt;
Here, something that goes wrong in the controller might not manifest itself until the renderer. The root cause of the error might have happened a long time ago.&lt;br /&gt;
3) Error can be hard to localize/reproduce if it affects only some users or routes.&lt;br /&gt;
&lt;br /&gt;
There are several approaches that can be used for debugging on Saas depending on the type of user.&lt;br /&gt;
''1) What                Dev?        Prod?&lt;br /&gt;
Printing to terminal        Y       &lt;br /&gt;
Logging            Y        Y&lt;br /&gt;
Interactive Debugging    Y&lt;br /&gt;
&lt;br /&gt;
You can do anything you want in development mode. Print errors to the terminal, which will go by very quickly and it’ll be hard to read. Writing to log file works both in development mode and production mode. Interactive debugger stops the app in its tracks and inspects the state of the variables and then continue.''&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69756</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w-1w65 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w-1w65_am&amp;diff=69756"/>
		<updated>2012-11-17T03:32:57Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* RASP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
===Why debugging in SaaS/Rails is hard?===&lt;br /&gt;
===Definitions===&lt;br /&gt;
&lt;br /&gt;
==RASP==&lt;br /&gt;
&lt;br /&gt;
===Steps of RASP===&lt;br /&gt;
i) Read the error message. Really read it.&lt;br /&gt;
The error message is trying to tell you something so read it.&lt;br /&gt;
&lt;br /&gt;
ii) Ask colleague&lt;br /&gt;
Ask your colleague an informed question in case you are doing pair programming. I am trying to do this and I expected it to do this but I got this other thing instead of foo.&lt;br /&gt;
&lt;br /&gt;
iii) Search using StackOverflow or Google&lt;br /&gt;
Especially if its an error which is particular to a version of gems or OS&lt;br /&gt;
&lt;br /&gt;
iv) Post on StackOverflow or class forum&lt;br /&gt;
Get minimal but complete information which reproduces the error message which you are experiencing and post it.&lt;br /&gt;
&lt;br /&gt;
==Understanding Error Messages in Rails==&lt;br /&gt;
&lt;br /&gt;
===Application Trace===&lt;br /&gt;
===Back Trace===&lt;br /&gt;
===Full Trace===&lt;br /&gt;
===Env Dump and Session Dump===&lt;br /&gt;
===Most Common Error Messages in Ruby===&lt;br /&gt;
&lt;br /&gt;
==Interactive Debugger==&lt;br /&gt;
===What is an interactive debugger?===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
==Further Reading==&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64086</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=64086"/>
		<updated>2012-09-13T20:48:41Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Ruby */&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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64084</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=64084"/>
		<updated>2012-09-13T20:45:10Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Ruby */&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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64078</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=64078"/>
		<updated>2012-09-13T20:41:50Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
{| 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;
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;
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; &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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64076</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=64076"/>
		<updated>2012-09-13T20:40:41Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
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;
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;
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;
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; &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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64073</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=64073"/>
		<updated>2012-09-13T20:39:21Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: &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 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;
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;
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;
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; &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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64070</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=64070"/>
		<updated>2012-09-13T20:35:57Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* JavaScript */&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 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;
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;
== 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;
[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;
== Primitive data types in 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;
== 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;
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; &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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64069</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=64069"/>
		<updated>2012-09-13T20:34:39Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: &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 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;
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;
== 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;
[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;
== 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;
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; &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;
#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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=64065</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=64065"/>
		<updated>2012-09-13T20:28:45Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: &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;
&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63960</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=63960"/>
		<updated>2012-09-13T06:01:05Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Do not have utility functions associated with them */&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 of using primitive data types==&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
&lt;br /&gt;
=== Primitive objects cannot be extended === &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 Smalltalk. 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;
&lt;br /&gt;
=== Primitive objects do not have utility functions associated with them===&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.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
The complex data types like arrays have functions associated with them.&lt;br /&gt;
&lt;br /&gt;
 array.length();&lt;br /&gt;
&lt;br /&gt;
However, 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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63958</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=63958"/>
		<updated>2012-09-13T06:00:24Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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 of using primitive data types==&lt;br /&gt;
The various disadvantages of using the primitive data types are as follows:&lt;br /&gt;
&lt;br /&gt;
=== Primitive objects cannot be extended === &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 Smalltalk. 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;
&lt;br /&gt;
=== Do not have utility functions associated with them===&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.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
The complex data types like arrays have functions associated with them.&lt;br /&gt;
&lt;br /&gt;
 array.length();&lt;br /&gt;
&lt;br /&gt;
However, 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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63955</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=63955"/>
		<updated>2012-09-13T05:56:08Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Simplicity */&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 of using primitive data types==&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63946</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=63946"/>
		<updated>2012-09-13T05:44:48Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: &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;
==Disadvantages of using primitive data types==&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63945</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=63945"/>
		<updated>2012-09-13T05:43:10Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: &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 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;
===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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63944</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=63944"/>
		<updated>2012-09-13T05:41:29Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: &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 ===&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;
===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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63263</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=63263"/>
		<updated>2012-09-09T23:55:33Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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]&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;
&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63260</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=63260"/>
		<updated>2012-09-09T23:48:32Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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]&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;
* 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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63258</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=63258"/>
		<updated>2012-09-09T23:44:01Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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 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;
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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63257</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=63257"/>
		<updated>2012-09-09T23:43:14Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
*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;
&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63256</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=63256"/>
		<updated>2012-09-09T23:41:02Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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 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;
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;
&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63254</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=63254"/>
		<updated>2012-09-09T23:36:55Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
*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;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63253</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=63253"/>
		<updated>2012-09-09T23:36:33Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
*Simplicity: Working with primitive data types is more intuitive.&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63241</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=63241"/>
		<updated>2012-09-09T22:59:02Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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. 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;
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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63239</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=63239"/>
		<updated>2012-09-09T22:57:40Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* Advantages and 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 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;
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;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63207</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=63207"/>
		<updated>2012-09-09T21:36:32Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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. 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;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63200</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=63200"/>
		<updated>2012-09-09T21:27:25Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
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;
&lt;br /&gt;
== Advantages and Disadvantages ==&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;/div&gt;</summary>
		<author><name>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3h_rr&amp;diff=63195</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=63195"/>
		<updated>2012-09-09T20:58:51Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
|-&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63188</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=63188"/>
		<updated>2012-09-09T20:52:24Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
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;
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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63185</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=63185"/>
		<updated>2012-09-09T20:50:04Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
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;
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.See [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&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. See [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63183</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=63183"/>
		<updated>2012-09-09T20:42:49Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
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;
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;
|-&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;
|-&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;
|-&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;
|-&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;
|- &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.See [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&lt;br /&gt;
| Use this datatype to save memory in large arrays.&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. See [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&lt;br /&gt;
| This data type is generally the default for decimal values.&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;
|-&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;
|}&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>Agarg5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w21_aa&amp;diff=63182</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=63182"/>
		<updated>2012-09-09T20:42:09Z</updated>

		<summary type="html">&lt;p&gt;Agarg5: /* 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;
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;
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;
|-&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;
|-&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;
|-&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;
|-&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;
|- &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.See http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&lt;br /&gt;
| Use this datatype to save memory in large arrays.&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. See [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&lt;br /&gt;
| This data type is generally the default for decimal values.&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;
|-&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;
|}&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>Agarg5</name></author>
	</entry>
</feed>