<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Imperative Design</title>
	<atom:link href="http://imperativedesign.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://imperativedesign.net</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 10 May 2012 18:40:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Thefoottraveler</title>
		<link>http://imperativedesign.net/portfolio/projects-in-progress/thefoottraveler/</link>
		<comments>http://imperativedesign.net/portfolio/projects-in-progress/thefoottraveler/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 21:53:21 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Projects In Progress]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/?p=1175</guid>
		<description><![CDATA[Beautiful Website In The Works This E commerce store is taking our clients business from brick and mortar to online and worldwide. This site is built upon the robust Magento platform. Allowing for stabilizability, amazon like reviews and ratings features &#8230; <a href="http://imperativedesign.net/portfolio/projects-in-progress/thefoottraveler/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/08/HomeIp.png" alt="The Foot Traveler" title="The Foot Traveler" width="640" height="662" class="alignnone size-full wp-image-1176" />
<br />
<br />
<h2>Beautiful Website In The Works</h2>
<p>This E commerce store is taking our clients business from brick and mortar to online and worldwide.
This site is built upon the robust <strong>Magento platform</strong>. Allowing for stabilizability, amazon like reviews and 
ratings features among many other features. In addition to being built on Magento this project also boasts custom <strong>WordPress Integration</strong> 
allowing for social media marketing as well as some <strong>SEO boosting</strong> benefits.</p>
]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/portfolio/projects-in-progress/thefoottraveler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SmartPath Financial</title>
		<link>http://imperativedesign.net/portfolio/smartpath-financial/</link>
		<comments>http://imperativedesign.net/portfolio/smartpath-financial/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 21:43:59 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/?p=1171</guid>
		<description><![CDATA[SmartPath Financial is a financial coaching company that helps you get out of debt, manage your finances, and move forward with your finances instead of backwards. Our Involvement: This beautiful site was a PSD to WordPress conversion. During this process &#8230; <a href="http://imperativedesign.net/portfolio/smartpath-financial/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/08/smartpath.png" alt="smartpath financial" title="smartpath financial" width="640" height="632" class="alignnone size-full wp-image-1172" />
<br />
<br />
<p>SmartPath Financial is a financial coaching company that helps you get out of debt, manage your finances, and 
move forward with your finances instead of backwards.</p>
<br />
<br />
<h2>Our Involvement:</h2>
<p>This beautiful site was a PSD to WordPress conversion. During this process we created the theme from scratch
enhanced the site with custom jQuery animation and added to the Graphics and aesthetics. Check it out.</p>
<br />
<br />
<a href="http://www.smartpathfinancial.com">SmartPath Financial</a>
<br />]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/portfolio/smartpath-financial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solutions Realty Network</title>
		<link>http://imperativedesign.net/portfolio/projects-in-progress/solutions-realty-network/</link>
		<comments>http://imperativedesign.net/portfolio/projects-in-progress/solutions-realty-network/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 14:51:31 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Projects In Progress]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/?p=1148</guid>
		<description><![CDATA[Solutions Realty Network is a property management company based out of Tyrone GA. Imperative Design is spearheading a complete redesign of their site and taking the rains for their SEO campaign. Stay tuned for the after picture.]]></description>
			<content:encoded><![CDATA[<img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/08/srn.jpg" alt="Solutions Realty Network" title="Solutions Realty Network" width="640" height="644" class="alignnone size-full wp-image-1166" />
<br />
<br />
<p>Solutions Realty Network is a property management company based out of Tyrone GA. 
Imperative Design is spearheading a complete redesign of their site and taking the rains for
their SEO campaign. Stay tuned for the after picture.</p>

]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/portfolio/projects-in-progress/solutions-realty-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dartnell Academy</title>
		<link>http://imperativedesign.net/portfolio/projects-in-progress/dartnell/</link>
		<comments>http://imperativedesign.net/portfolio/projects-in-progress/dartnell/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 14:50:35 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Projects In Progress]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/?p=1146</guid>
		<description><![CDATA[Dartnell Academy is a really interesting company. They are a real estate company that arms you with all of the information needed to make a decision, without ever even setting foot on the property. In addition, you dont have to &#8230; <a href="http://imperativedesign.net/portfolio/projects-in-progress/dartnell/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/08/Dartnell-Investment-Academy.jpg" alt="Dartnell Investment Academy" title="Dartnell Investment Academy" width="640" height="659" class="alignnone size-full wp-image-1160" />
<br />
<p>Dartnell Academy is a really interesting company. They are a real estate company that arms you with all
of the information needed to make a decision, without ever even setting foot on the property. In addition,
you dont have to be a real estate pro to work with them. If you are a first time home buyer or even
someone looking to become a more serious real estate investor, Dartnell offers a robust coaching
program to train you to be your own real estate guide. They take the average Joe&#8217;s and make them
Donald Trump&#8217;s.</p>
<br />
<a href="http://www.dartnellacademy.com" target="_blank">Dartnell Academy Website</a>
<br />
<br />
<hr />
<br />
<h2>My Involvement:</h2>
<p>Imperative has an on going relationship with Dartnell where we are taking their website and helping
to bring it to the next level. We are doing this by <em>reworking their <strong>WordPress Templates</strong></em>
, <em>adding in custom <strong>jQuery</strong></em>, and <em>integrating custom <strong>API&#8217;s</strong></em> to help them power their business.
<br />
Imperative Design is currently spearheading Dartnell Academy&#8217;s web presence and we are currently creating a new website from scratch, powered of course by WordPress.
</p>
]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/portfolio/projects-in-progress/dartnell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>European Hardwood Floors</title>
		<link>http://imperativedesign.net/portfolio/european-hardwood-floors/</link>
		<comments>http://imperativedesign.net/portfolio/european-hardwood-floors/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 22:12:49 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/?p=810</guid>
		<description><![CDATA[European Hardwood Floors European Hardwood Floors is one of Georgia&#8217;s premier flooring companies that offers a wide range of services. Whether you are looking for a refinishing for your current floor or new installation they do it all. They serve &#8230; <a href="http://imperativedesign.net/portfolio/european-hardwood-floors/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/01/logo.png"><img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/01/logo-150x150.png" alt="European Hardwood Floors" title="European Hardwood Floors" width="150" height="150" class="alignleft size-thumbnail wp-image-811" /></a><h2>European Hardwood Floors</h2>
<p>European Hardwood Floors is one of Georgia&#8217;s premier flooring companies that offers a wide range of services. Whether you are looking for a refinishing for your current floor or new installation they do it all. 
They serve Atlanta, Gwinnett, Buford, Fulton, and all of the surrounding areas.
<span id="more-810"></span>
<div id="site"><a href = "http://www.europeanhardwoodfloors.com" target="_blank" rel="no-follow">Visit European Hardwood Floors</a><br />
</div><!-- #site -->
</p>
<div class="clear">&nbsp;</div>
<br />
]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/portfolio/european-hardwood-floors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duluth Diner</title>
		<link>http://imperativedesign.net/portfolio/duluth-diner/</link>
		<comments>http://imperativedesign.net/portfolio/duluth-diner/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 22:03:17 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/?p=805</guid>
		<description><![CDATA[Duluth DinerCheck our this great restaurant with great food. Beautiful WordPress site with custom plugins and custom JavaScript. Site:Duluth Diner]]></description>
			<content:encoded><![CDATA[<a href="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/01/ST.jpg"><img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2011/01/ST.jpg" alt="Duluth Diner" title="Duluth Diner" width="125" height="125" class="alignleft size-full wp-image-806" /></a><h2>Duluth Diner</h2><p>Check our this great restaurant with great food.</p>

<p>Beautiful WordPress site with custom plugins and custom JavaScript.
<br />
Site:<a href="http://www.duluthdiner.com" target="_blank" rel="no-follow">Duluth Diner</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/portfolio/duluth-diner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax.. From Basic to Bold-Day One</title>
		<link>http://imperativedesign.net/javascript/ajax-for-beginners/</link>
		<comments>http://imperativedesign.net/javascript/ajax-for-beginners/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 22:40:29 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/javascript/ajax-for-beginners</guid>
		<description><![CDATA[AJAX&#8230;From Basic To Bold What is AJAX? How does it work? Is it difficult to learn? These are some of the more common questions associated with it. AJAX is a group of technologies working together to deliver an integrated experience. &#8230; <a href="http://imperativedesign.net/javascript/ajax-for-beginners/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<br /><font color="333333"><b><h1>AJAX&#8230;From Basic To Bold</h1></b></font>
<hr />
<br />
<a href="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2010/12/iStock_000016143437Large.jpg"><img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2010/12/iStock_000016143437Large.jpg" alt="" title="iStock_000016143437Large" width="150" height="151" class="alignnone size-full wp-image-1040" /></a>
<br />
<br />What is AJAX?  How does it work?  Is it difficult to learn?  These are some of the more common questions associated with it.<br/>
<br />
AJAX is a group of technologies working together to deliver an 
integrated experience.  It is comprised of JavaScript and XML and relies
also on a server side file.  It is used to asynchronously place requests 
to the server and update the client at the same time. <br />
<br />What that means in layman&#8217;s terms is that it is a web page that acts like a desktop page.  It receives information and then updates it behind the scenes without the process ever being seen by the user. 
<br />
<br />
<h2>Need an example?</h2>
<hr />
<br />
 Think Mapquest.  In the not so old days, when you wanted to zoom in on a map you would click the clunky plus sign and it would reload the map.  You had to stop and wait and you actually saw the resource (the map) being loaded.  Today, with the advent of AJAX, take another look at Google Maps. Now, when you click the zoom icon it does so almost instantaneously, as if it were a desktop app.  The credit for this improvement goes to AJAX.  In the next few paragraphs we are going to dive into the specifics of how it works.<br />
<br />The heart of any AJAX app is the <u>request object</u>.  Here are some common methods that it can work with:
<br />
<br />
<ul class="blog_list">
<li>abort</li>

<li>getAllResponseHeaders</li>

<li>getResponseHeader</li>

<li>Open</li>

<li>Send</li>
<br />
</ul>Some common properties of the request object are:
<br />
<br />
<ul class="blog_list">
<li><font color="669999"><span class="blue_highlight">onreadystatechange</span></font>: contains the name of the event handler (function to call) when the value of <u>readyState </u>property changes.</li>

<li>readyState: State of the request ( read only and status code )</li>

<li>responseText: Body of the response. Returned as a string</li>

<li>responseXML: Body of the response in XML format.</li>

<li>status / Status (ie): HTTP Status code returned by a request</li>

<li>statusText: response status text<br /></li></ul><br />

<h2>Making the request object:</h2>
<hr />
<br />
JavaScipt is an object oriented language.  As such it would be beneficial for the reader to know about OOP and how to work with objects.  I have a series 
on C++ that would be helpful or you could check out Nettuts&#8217;s JavaScript
series.  <br /><br />In order to make the request object you must find out 
which client (browser) is making the request.  This is done by using the 
window object and a simple &#8220;if&#8221; statement.  <br /><br />Once the browser is identified and the object is created the next step is to open it.  This is done with the open method and its prototype is as follows:
<br />
<br /><font color="#cc0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; open(&#8220;method&#8221;, &#8220;URL&#8221;[, asyncFlag [, "userName" [, "password"]]])</font><br/>
<br />
<ul class="blog_list"><li>method: Get, Post, PUT, HEAD, or PROPFIND</li><li>URL: is the URL</li><li>asyncFlag: whether or not the call is async. The default is true.</li><li>username: s/e<br /></li><li>password: s/e</li></ol>
<br />

<h2> Handling The Data That Is Returned</h2>
<hr />
<br />
Once the connection has been opened, a callback function is fired.  This 
function is meant to fire when data begins to download or after data has
been downloaded.  The request object will call the callback function. 
This is done by assigning the callback function to the 
<span class="blue_highlight">onreadystatechange</span> property of the request object like so:
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#993300">XMLHttpRequestObject.<span class="blue_highlight">onreadystatechange</span> = myCallbackFunction;</font><br />
<br />
This step can also be done using an anonymous function.<br />
<br />
<span class="blue_highlight">onreadystatechange</span> has several numeric codes that serve as status indicators. Here they are:
<br />
<br />
<ul class="blog_list">
<li>0 &#8211; unitialized</li><li>1 &#8211; loading</li><li>2 &#8211; loaded</li><li>3 &#8211; interactive</li><li>4 &#8211; complete</li></ul>
<br />
The status property also has status codes. These are normal HTTP status codes and the values are as follows:
<br />
<br />
<ul class="blog_list">
<li>200 &#8211; ok</li>
<li>210 &#8211; created</li>
<li>204 &#8211; no content</li>
<li>205 &#8211; reset content</li>
<li>206 &#8211; partial content</li>
<li>400 &#8211; bad request <br /></li>
<li>401 &#8211; unauthorized</li>
<li>403 &#8211; forbidden</li>
<li>404 &#8211; not found</li>
<li>and on and on&#8230; http://www.w3.org/Protocol/HTTP/HTRESP.html</li></ul>
<br />
Inside of your callback function you can have an &#8220;if&#8221; statement that 
checks the status code.  If the status code is 4, meaning the data download is complete, and the status property is 200, meaning that it went well, then we can proceed with the data download.  This is usually done by firing another method, the <u>send</u> method.
<br />
<br />
<h2>Conclusion:</h2> 
<hr />
<br />
You have seen the basic steps that it takes to make an AJAX connection and talk to the server.  For a quick summary here are the necessary steps.
<br />
<br /> 
<ol><li>Create the XMLHttpRequest Object.</li><li>Use the open method to configure it.</li><li>Call an anonymous function to handle the data download by connecting to <span class="blue_highlight">onreadystatechange</span></li><li>Use the send method to execute the request<br />
  </li></ol>
<big><big><small><small><br />
      </small></small></big></big>]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/javascript/ajax-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enums and Structs</title>
		<link>http://imperativedesign.net/tutorials/enumerations_and_structures-2/</link>
		<comments>http://imperativedesign.net/tutorials/enumerations_and_structures-2/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 17:58:50 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/tutorials/enumerations_and_structures-2</guid>
		<description><![CDATA[So you have seen basic data types, arrays, and even objects! You are progressing rapidly, however there are a few other data types that are important to at least be able to recognize. The two items we will discuss today &#8230; <a href="http://imperativedesign.net/tutorials/enumerations_and_structures-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you have seen basic data types, arrays, and even objects! You are progressing rapidly, however there are a few other data types that are important to at least be able to recognize. The two items we will discuss today are called Enumerations and Structures. 
<br />
<br />
An enumeration, enum for short, is a &#8220;list of named integer constants&#8221;. What does that mean? Suppose you have a list of students and you are wanting to make a seating chart. ( This is for you Mr. Carter <img src='http://imperativedesign.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) With an enumeration you can make a list of a group of students. Each name represents an integer starting at 0. This is similar to the way in which arrays are indexed. The difference is that you can use an enum element anywhere you can use an integer.</p>
<br />
<br />
<h2>Example Time:</h2>
<hr />
<br />
<h3>Prototype:</h3> 
<br />
<p>enum type-name { enumeration list } variable-list;
enum seatingChart {Jonathan, Susan, Tommy, James, Lisa} char1, chart2;
<br />
<br />
Lets take a look at what is going on here!
<br />
<br />
An enumeration called seating chart is declared with the keyword enum. Each of its elements represents an integer: (Johnathan being 0, Susan being 1, and so forth..). Two charts ( creatively labeled chart1 and chart2 ) are declared of type seatingChart. The elements that make up the enumeration are known as the enumeration list. Once the enumeration is defined you can create another instance of it using its name: seatingChart chart3; This creates another seatingChart enum. Kind of like using a class to create an object. Enum members can be used as keys for an array or anywhere else integers can be used. 
<br />
<br />
To see this more clearly examine the following example:
<br />
<br />
enum seatingChart { Paul, Mary, Tom, Jody }; sum = Mary + Tom;
<br />
cout &lt;&lt; &#8220;The value of Mary + Tom is: &#8220;&lt;&lt;sum; // 
<br />
<br />
This will return the following:
<br />
<br />
 The value of Mary + Tom is: 3 // Why? Because the enum list starts its index at 0, then Mary is 1 and Tom is 2.</p> 
<br />
<br />
<h3>Enough about Enums already&#8230;tell me about a struct?!</h3>
<hr /> 
<br />
<p>Struct stands for Structure. It is a way of grouping related data together in neat packages. This in turn allows you to refer to a collection of variables as one name. It has features that are both object oriented as well as non object oriented. Structures are very similar to classes in nature and in behavior and only differ slightly in implementation, specifically in the way they hide their data. In today&#8217;s article we will cover the non-oop features.</p> 
<br />
<p>Items in a structure are called members ( also known as fields or elements ) What is it useful for? Since you can only return one thing from a function it would be cool to be able to return a struct right? Think of how useful it would be to have a function that initialized all of your stuff in a program that worked with students&#8217; grades. You could prompt the user to input the grades, pass them to a calcGrade function and it would work its magic, repackage them into a struct, and return the struct to the rest of the program. Cool huh? </p>
<br />]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/tutorials/enumerations_and_structures-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects, Classes, and Inheritance Oh My&#8230;</title>
		<link>http://imperativedesign.net/tutorials/c_plus_plus_and_oop/</link>
		<comments>http://imperativedesign.net/tutorials/c_plus_plus_and_oop/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 03:48:24 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/tutorials/c_plus_plus_and_oop</guid>
		<description><![CDATA[Ok, so you&#8217;ve heard the terms, listened to the heated nerd debates over it, and even scratched your head a few times wondering what object oriented programing is and why you should choose to use it over what you already &#8230; <a href="http://imperativedesign.net/tutorials/c_plus_plus_and_oop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok, so you&#8217;ve heard the terms, listened to the heated nerd debates over it, and even scratched your head a few times wondering what object oriented programing is and why you should choose to use it over what you already do. This article will serve as one of many guides for beginners looking to hone their object oriented skills as it relates to C++. As a side note, this also ties closely to other languages such as Objective-C, a programing language used for iPhone development, Java, and even PHP for web development. So, without further ado, lets discuss the different components of OOP.</p>
<br />
<br />
<span id="more-785"></span>
<br />
<a href="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2010/12/blocks.jpg"><img src="http://thedevjungle.com/imperativedesign.net/wp-content/uploads/2010/12/blocks.jpg" alt="OOP and C++" title="OOP and C++" width="655" height="491" class="alignnone size-full wp-image-787" /></a>
<br />
<br />
<p>Object Oriented Programing is a way of grouping your code into reusable blueprints. These blueprints contain functions, variables, and various other tools. The manipulation of these tools is what makes your programs more powerful, easier to update, more secure, easier to work with, and best of all REUSABLE.</p> 
<br />
<p>This concept of re-usability is one of the main reasons why people love OOP. Think about the following scenario. Suppose an architect is designing a subdivision with a total of one hundred houses. Think of the time it would take and the additional money he would need to charge if he had to design a completely new blueprint for each house individually. That would take forever! Why should he have to redesign a whole blueprint because one house has an extra bathroom or a slightly different floor plan?</p> 
<br />
<p>This same concept applies to programing. Think of the real world applications you will have to develop if you go into programming. These can consist of an accounting application, or a banking application, perhaps a commerce application, or payroll software. What do all of these have in common? They each have employees, or products, or hours to keep track of. Instead of writing a new program each time, wouldn&#8217;t it be nice if we had a reusable blueprint for every payroll application, or for each program that uses products or employees? This is what classes are. They are reusable code blueprints that make our lives easier by saving us time and work.</p>
<br />
<h2>???</h2>
<hr />
<br />
<p>How do they differ from just saving my programs and reusing the entire program? Where your programs are specific in their function and nature, classes are meant to be general in nature. Instead of having to painstakingly hack away at a program that is meant to do one thing and make it do something else, you can implement a class and then make it more specific to fit your exact needs. You have been using prewritten classes all along in your programing. Each time you include iostream and use cout or when you use fstream to create a new file object you are working with classes. Another benefit of these is they have been written well once and are continually being improved upon. Thus they have been thoroughly debugged and tested.</p>
<br />
<h2>Enough theory? Lets skip to the action!</h2>
<hr />
<br />
<p>When making a class you must define it just as you would when you declare a function. You specify what functions (known as methods in OOP speak ) and what properties ( aka variables ) will be in each object. Then you <u>instantiate</u> (create an instance of ) the object. Once the object has been instantiated it will contain all of the elements that the class has and can be worked with uniformly. Hence, in terms of the previously used example, each house in the subdivision has a roof, a kitchen, a bathroom, and floors.</p>
<br />
Here&#8217;s how you create a class:
 <br />
<br />
<font color="#000099">#include &lt;iostream&gt;<br />#include &lt;string&gt;<br />using namespace std;<br /><br />class Banner<br />{<br />public: string favoriteProgram;<br />public: static int numberOfObjects;&nbsp;&nbsp;&nbsp; <br />};<br /></font><br /><font color="#000000">

<p>This code has just created a class called Banner. It will be used to display some information. It has two properties (variables): favorite program and number of objects. If you are asking where is main ( ) at then that is a good observation. Classes aren&#8217;t meant to be called directly by main. They are meant to be defined (typically in includes files) and then instantiated in your program and worked with. We will get to a full example shortly. As for the public keyword, OOP provides a way to keep your data safe. Sometimes when working with loops, functions, or just complicated code, when you get a big program going your variables might get accidentally changed or declared in the wrong places. OOP fixes this with something called <u>encapsulation</u> and <u>data hiding</u>. We will revisit this subject a little later.</p>
<br />
Here is a bit more complex code:
<br />
<br />
#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
using namespace std;<br />
<br />class Banner<br />
{<br />
public: string favoriteProgram;<br />
public: static int numberOfObjects;
<br />
};<br />
<br />
//constructor<br />
public: Banner()<br />
{<br />
numberOfObjects++;
<br />
favoriteProgram = &#8220;C++&#8221;;
<br />
}<br />
<br />
<br />
public: void Display()<br />
{<br />
cout &lt;&lt; &#8220;I love &#8221; &lt;&lt; favoriteProgram &lt;&lt; endl;<br />
<br />
}<br />
<br />
public: void howMany(){<br />
cout &lt;&lt; &#8220;nThe number of current Banner objects is: &#8220;&lt;&lt; numberOfObjects &lt;&lt;endl;
<br />
}<br />
<br />
<p>This whole section of code is what my definition of the class looks like. It has 3 methods in total (one of which is a <u>constructor</u>) and two properties (variables). A constructor is basically a function that is called whenever you create an object. Any time I create an object of type banner it looks for a function with the same name, Banner. Then it does whatever the constructor tells it to do. Typically, this setup task involves setting default values and initializing certain things. It&#8217;s like using a mainline setup in procedural C++. All of this setup code is usually just put in an includes file with a .cpp or .h extension. Then, instead of typing a whole C++ setup each time you start a fresh project, you can just grab one file off your flash drive and boom.. you have a program that&#8217;s setup.</p>
<br />
<h2>Implementation</h2>
<hr />
<br />
<p>Well its nice to see how it is setup but how does it get implemented into the main and ran? Now that you have seen the way to set it up, here is the method for working with it:
<br />
<br />
<font color="#cc0000">//When including a .h file in use the quotation marks and no angle brackets</font>
<br />
#include &#8220;setup.h&#8221;
<br />
<br />
<font color="#cc0000">//scope resolution operator allocates space for the static variable</font>
<br />
int Banner::numberOfObjects;
<br />
<br />
<font color="#cc0000">//Set a global variable to test in the program and define a function header to work with it</font>
<br />
int globalNum=5;
<br />
int SetGlobalNum();
<br />
<br />
int main () {
<br />
<br />
/*
<br />
 char name[256];
<br />
<br />
cout &lt;&lt; &#8220;Hello, World!nn&#8221;;
<br />
Banner cpp;
<br />
cpp.favoriteProgram = &#8220;C++&#8221;;
<br />
cpp.Display();
<br />
<br />
<font color="#cc0000">//create a second instance of the banner class</font>
<br />
Banner java;
<br />
java.favoriteProgram = &#8220;Java&#8221;;
<br />
 java.Display();
<br />
 java.howMany();
<br />
 java.howMany();
<br />
<br />
//cout &lt;&lt; &#8220;nnWhat is your full name name?n&#8221;;
<br />
//cin &gt;&gt;name;
<br />
//cout &lt;&lt; &#8220;You put: &#8220;&lt;&lt;name &lt;&lt;endl;
<br />
cout &lt;&lt; &#8220;nnNow using cin.getline()n&#8221;;
<br />
cout &lt;&lt; &#8220;Enter your full name again: &#8220;;
<br />
cin.getline(name,256);
<br />
 cout &lt;&lt; &#8220;You entered: &#8221; &lt;&lt;name;
<br />
 */ 
<br />
<br />
<font color="#cc0000">//Set and display the global Number</font>
<br />
 cout &lt;&lt; &#8220;nWhen declared globalNum starts at: &#8221; &lt;&lt;globalNum;
<br />
globalNum = 7;
<br />
cout &lt;&lt; &#8220;nIn Main globalNum now equals: &#8221; &lt;&lt;globalNum&lt;&lt;&#8221;nn&#8221;;
<br />
SetGlobalNum();
<br />
cout &lt;&lt; &#8220;Back in Main globalNum now equals: &#8221; &lt;&lt;globalNum;
<br />
return 0;
<br />
}
<br />
<br />
<font color="#cc0000">//Function Header</font>
<br />
int SetGlobalNum(){
<br />
int tempNum;
<br />
cout &lt;&lt; &#8220;nIn the Function:n&#8221;;
<br />
cout &lt;&lt; &#8220;Enter a new number for globalNum: &#8220;;
<br />
cin &gt;&gt; tempNum;
<br />
globalNum = tempNum;
<br />
return globalNum;
</p>
<br />
<h2>What just happened?</h2>
<hr />
<br />
<p>We included our class definition and setup that we made in the code above. Separating things makes maintenance, troubleshooting, and expansion much easier in the long run, not to mention the short run as well! We allocated space in our program for a static variable. Don&#8217;t sweat this yet. We will cover it more in depth later. It just means that when functions are called that use this variable, when the function ends, the variable keeps its value so we can reuse it later. We created a character array, printed some stuff to the console, and did some basic setup.</p>
<br />
<p>The fun stuff happens here:
<br />
<br />
Banner cpp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //This creates an instance of the Banner class called cpp
<br />
cpp.favoriteProgram = &#8220;C++&#8221;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //This then sets the property favoriteProgram to C++
<br />
cpp.Display();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //This then calls the method Display ( ) from the cpp object.</p>
<br />
<br />
<p>Any time you access a method or property of an object in C++ you use <u><i>dot syntax.</i></u> The line cpp.Display serves to distinguish Display method of cpp from the Display method of, say, a Java object or Perl object. That means you can have many different objects that behave the same way, are worked with in the same way, but are independent of each other. Each has its own data and behaviors. This is known as the objects <u>state</u>.</p> 
<br />
<p>Think of how we would have done this before with procedural programming. What would you have done if you would have had to create a program to keep track of students and their grades? Made a bunch of variables and then put them in modules and then passed a bunch of stuff around? Now, using OOP, you can just make a student class. Then make the following students, John, James, Paul, Cindy, and Susan, objects and have them do their own work, keep up with their own grades, and calculate their own grades.</p>
<br >
<br />
<h2>Where To Next?</h2>
<hr />
<br />
<p>Hopefully you have just become a little more at ease with OOP and how C++ implements it. You may have to read this once or twice to get a good grasp on it. I know it can be a bit overwhelming at first. If you have any questions as always feel free to comment or email me. In the next few tutorials we are going to be talking more about how objects and classes make things easier.</p>
<br />
<br />
<p>Next up will be <u><b>Inheritance</b></u>. This will go over the process where you take a class, for example students, and then create a subclass which is more specific and specialized. You are then able to utilize all the variables and functions (methods and properties) previously mentioned.</p> 
<br />
<br />]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/tutorials/c_plus_plus_and_oop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginning File I/O With C++</title>
		<link>http://imperativedesign.net/tutorials/beginning-file-io-with-c/</link>
		<comments>http://imperativedesign.net/tutorials/beginning-file-io-with-c/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 01:28:25 +0000</pubDate>
		<dc:creator>peb7268</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://imperativedesign.net/tutorials/c_plus_plus_and_file_io</guid>
		<description><![CDATA[File I/O has been a bit of a daunting subject for a lot of beginning programmers for a long time now. When I first began programming in PHP I know it seemed a bit foreign to me. You, however, won&#8217;t &#8230; <a href="http://imperativedesign.net/tutorials/beginning-file-io-with-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>File I/O has been a bit of a daunting subject for a lot of beginning programmers for a long time now. When I first began programming in PHP I know it seemed a bit foreign to me. 
You, however, won&#8217;t have that problem. By the end of this tutorial you will have gotten a basic understanding of what file IO is in C++ and how to work with it on a lower level. Lets jump in!!</p>
<span id="more-779"></span>
<br />
<p>In order to use file IO in C++ you must include one of several library header files and then instantiate objects from those files. For the sake of brevity and simplicity we will delve only into one of these header files: The fstream.</p>
<br />
<p>There are two basic things you can do with a file: read or write. Depending on which option you want to do you must include a particular library and then instantiate an object from that library. You can cut all that hubub out though by simply using fstream as a catchall class. It can read and write. Think of it as a master class. So here is the basic play by play of what you do to work with a file.</p>
<br />
<ul class="blog_list">
<li>Include fstream</li>
<li>Instantiate a object of the class</li>
<li>Test to see if the object was found if not provide an error message so you don&#8217;t loose your sanity and pull your hair out.</li>
<li>Read or Write ( you can append flags as well to modify the way reading or writing occur)
</li>
</ul></p>
<br />
<br />
<h2>Example Time!!</h2>
<hr />
<br />
#include <iostream>
<br />
#include <string.h>
<br />
#include <fstream>
<br />
using namespace std;
<br />
<br />
//Instantiated an object from my ofstream class
<br />
ofstream fileOut;
<br />
<br />
int main () {
<br />
<br />
<br />
//File Ouput &#8211; This method will overwrite what is in the existing file.
<br />
/* fstream fileOut(&#8220;/Users/peb7268/Desktop/demo.txt&#8221;);
<br />
if (!fileOut.fail()) {
<br />
cout &lt;&lt; &#8220;nFile found. About to commence writing.n&#8221;;
<br />
fileOut &lt;&lt;&#8221;Here is some output again!&#8221;;
<br />
} else {
<br />
cout &lt;&lt;&#8221;nError, the file not found.n&#8221;;
<br />
}
<br />
*/
<br />
<br />
<br />
/*&#8211; Setting some flags &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-*/
<br />
//File Ouput &#8211; This method will overwrite what is in the existing file.
<br />
//By specifying a formatter as a second argument you can manipulate what happens during the file conversation
<br />
ofstream fileOut(&#8220;/Users/peb7268/Desktop/demo.txt&#8221;,ios::app);
<br />
if (!fileOut.fail()) {
<br />
cout &lt;&lt; &#8220;nFile found. About to commence writing.n&#8221;;
<br />
fileOut &lt;&lt;&#8221;nThis is a linen&#8221;;
<br />
cout &lt;&lt; &#8220;nI came, I saw, I wrote!n&#8221;;
<br />
} else {
<br />
cout &lt;&lt;&#8221;nError, the file not found.n&#8221;;
<br />
}
<br />
<br />
<br />
return 0;
<br />
}
<br />
<br />
<h2>Moving on&#8230;</h2>
<hr />
<br />
<p>Reading a line of a file is not much more complicated, but reading several lines can be a bit tricky if you are a novice. To read multiple lines from a file you just use a loop and test for while not the end of the file. Use a string object to store multiple strings or a int or float for numbers.</p>
<br />
<p>Here are a few examples:
<br />
<br />
To store a line from a file (and not just one word till it hits whitespace) use your trusted friend getline( ) again. The only difference is that instead of taking the format cin.getline (aVar, maxVal) it takes a new form of getline (inFile,tempVar). To get a better idea of how this works look at the code below:
<br />
<br />
#include <iostream>
<br />
#include <string>
<br />
#include <fstream>
<br />
using namespace std;
<br />
<br />
<br />
<br />
int main () {
<br />
<br />
fstream inFile;
<br />
inFile.open(&#8220;/Users/peb7268/Desktop/demo.txt&#8221;);
<br />
//char tempVar[256];
<br />
string tempVar;
<br />
<br />
if (!inFile.fail()) {
<br />
cout &lt;&lt; &#8220;nReading File&#8230;n&#8221;;
<br />
} else {
<br />
cout&lt;&lt;&#8221;Error reading the file.&#8221;;
<br />
}
<br />
<br />
while (inFile) {
<br />
cout &lt;&lt; &#8220;n&#8221;&lt;<tempvar;>
<br />
getline(inFile,tempVar);
<br />
} 
<br />
if(inFile.eof()) { inFile.close(); }
<br />
<br />
<br />
return 0;
<br />
}
<br />
<br />
</p>
<h2>Moving on.. File IO &amp; Arrays:</h2>
<hr />
<br />
<p>Sometimes you may want to read data from a file and store it in an array so you can work with it again later. The steps for this are not super complicated. Here is the general approach you would take:</p>
<br />
</tempvar;></fstream></string></iostream></fstream></string.h></iostream>
<ul class="blog_list">
<li>Create a constant for your array size.</li>
<li>Declare a new array with the size constant</li>
<li>Open the file</li>
<li>Use a for loop and a counter to pull in the numbers to the array.</li>
</ul>
<br />
Here is how these steps look in actual code:
<br />
<br />
<font color="#000099">const int ARRAY_SIZE = 10;
<br />
int numbers[ARRAY_SIZE];
<br />
int count;
<br />
</font><font color="#000099"><iostream><string.h><fstream><iostream><string><fstream><tempvar;>
<br />
ifstream inputFile;
<br />
<br />
inputFile.open(&#8220;demo.txt&#8221;)
<br />
<br />
//Reads the elements in the numbers array into the inputFile object
<br />
for(count=0; count &lt; ARRAY_SIZE; count++)
<br />
inputFile &gt;&gt; numbers[count];
<br />
<br />
inputFile.close();
<br />
<br />
//Display the numbers
<br />
cout &lt;&lt;&#8221;The numbers are: &#8220;;
<br />
for (count=0; count &lt; ARRAY_SIZE; count++)
<br />
cout &lt;&lt; numbers[count] &lt;&lt; &#8220;n&#8221;;
<br />
cout &lt;&lt; endl;
<br />
<br />
<font color="#000000">
Writing to a file works pretty much the same way but you just use a different stream operator.
<br />
<br />
<h2>Recap</h2>
<hr />
<br />
<p>In case you don&#8217;t know what the fail() method does, it returns a boolean value indicating whether or not the function was successful. In the previous lines of code you have seen how to work with files and how to set flags when writing. You have also learned how to pull in more than one line from a file.
<br />
<br />
If some of this seems a bit foreign with all the talk of objects, classes, and functions with the same name but different ways of working, then stay tuned. The next post is on C++ and how it puts its own twist on OOP. If you have any questions, feel free to leave them in the comments section!</p>
<br />
</font></tempvar;></fstream></string></iostream></fstream></string.h></iostream></font><font color="#000000"></font>
<br />]]></content:encoded>
			<wfw:commentRss>http://imperativedesign.net/tutorials/beginning-file-io-with-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

