<?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>Digijustin &#187; Code</title>
	<atom:link href="http://digijustin.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://digijustin.com</link>
	<description>Now New and Improved</description>
	<lastBuildDate>Mon, 16 Apr 2012 21:11:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Real Time Stock Ticker for PHP</title>
		<link>http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/</link>
		<comments>http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 21:11:10 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://digijustin.com/?p=340</guid>
		<description><![CDATA[For the last week or so, I have been looking for a good real time stock ticker to put up on a client&#8217;s web site since their feed with Yahoo kept failing intermittently. About 30% of the time, it would return &#8230; <a href="http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/" data-count="vertical" data-text="Real Time Stock Ticker for PHP" data-via="digijustin" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fdigijustin.com%2F2012%2F04%2F16%2Freal-time-stock-ticker-for-php%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/'></g:plusone></div><div class='dd_button'><script type='text/javascript' src='http://platform.linkedin.com/in.js'></script><script type='IN/share' data-url='http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/' data-counter='top'></script></div></div></div><p>For the last week or so, I have been looking for a good real time stock ticker to put up on a client&#8217;s web site since their feed with Yahoo kept failing intermittently. About 30% of the time, it would return an error that read &#8220;Received Failure&#8221; which while amusing, the client didn&#8217;t want to have anything to do with it.</p>
<p>So I spent a few hours going to different sites to see if they had a feed and none would give me what I wanted. All I needed was the current price, value change, percentage change and time last updated. Seemed impossible. Then I had the idea to just scrape data from Google&#8217;s Financial site and the rest is history.</p>
<p>I found this PHP project called <a title="PHP Simple HTML DOM Parser" href="http://sourceforge.net/projects/simplehtmldom/" target="_blank">PHP Simple HTML DOM Parser</a> and used it in my code. Super simple.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'simple_html_dom.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tickerCID</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'22144'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//This is Apple (AAPL) ticker ID on Google</span>
<span style="color: #000088;">$stockSymbol</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'AAPL'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> file_get_html<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'https://www.google.com/finance?q=NASDAQ:'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$stockSymbol</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$price</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'span[id=ref_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tickerCID</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'_l]'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lasttrade</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$price</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$spanChange</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'span[id=ref_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tickerCID</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'_c]'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$change</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$spanChange</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$spanPercChange</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'span[id=ref_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tickerCID</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'_cp]'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$percChange</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$spanPercChange</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rightNowDate</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;M j&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$quoteTime</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'span[id=ref_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tickerCID</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'_ltt]'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rightNow</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rightNowDate</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$quoteTime</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span></pre></div></div>

<p>Then when I need to access that data, I just have this DIV in the body:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;stockTick&quot;&gt;
	&lt;p&gt;NASDAQ: AAPL&lt;/p&gt;
	&lt;p style=&quot;font-size:10px;&quot;&gt;$<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$lasttrade</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;nbsp;&amp;nbsp;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$change</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$percChange</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;nbsp;&amp;nbsp;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$rightNow</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
&lt;/div&gt;</pre></div></div>

<p>It was that easy once I got the hang of it. Hope this can help someone with the same crap I had to go through.</p>
<!-- Social Buttons Generated by Digg Digg plugin v5.2.5,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://digijustin.com/2012/04/16/real-time-stock-ticker-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update to Facebook&#039;s New API</title>
		<link>http://digijustin.com/2008/07/08/update-to-facebooks-new-api/</link>
		<comments>http://digijustin.com/2008/07/08/update-to-facebooks-new-api/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 15:52:47 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://www.kodedkreations.net/?p=60</guid>
		<description><![CDATA[Last week I posted an entry about the new Facebook API that is due to be released sometime this summer. Well today, it was announced that Facebook is opening it up for all users to check out on July 16th. &#8230; <a href="http://digijustin.com/2008/07/08/update-to-facebooks-new-api/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://digijustin.com/2008/07/08/update-to-facebooks-new-api/" data-count="vertical" data-text="Update to Facebook&#039;s New API" data-via="digijustin" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fdigijustin.com%2F2008%2F07%2F08%2Fupdate-to-facebooks-new-api%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://digijustin.com/2008/07/08/update-to-facebooks-new-api/'></g:plusone></div><div class='dd_button'><script type='text/javascript' src='http://platform.linkedin.com/in.js'></script><script type='IN/share' data-url='http://digijustin.com/2008/07/08/update-to-facebooks-new-api/' data-counter='top'></script></div></div></div><p>Last week I posted an <a href="http://www.kodedkreations.net/2008/06/30/working-with-new-facebook-api/" target="_blank">entry</a> about the new Facebook API that is due to be released sometime this summer.  Well today, it was <a href="http://developers.facebook.com/news.php?blog=1&#038;story=129" target="_blank">announced</a> that Facebook is opening it up for all users to check out on July 16th.  While this isn&#8217;t the official launch, it still seems pretty close seeing as how the API is really buggy currently and on the Developer Forums, a lot of the programmers haven&#8217;t starting converting their apps over yet.</p>
<p>There is no mention of the &#8220;official&#8221; launch date as of yet but they say in their post that &#8220;early next week, we&#8217;ll post more answers to FAQs and share the new policies around the new profile design.&#8221;  That seems kind of bad since they are opening up the new platform to everyone to check out next week as well.  I foresee a lot of people complaining that the apps they have installed don&#8217;t work.  Of course they don&#8217;t, programmers are still working with the buggy API and trying to find their way around in a new, dark room.</p>
<p>I am one who is 100% in favor of the new look and feel that Facebook is releasing but personally I feel that they need to get the API working closer to 100% rather than 50% and have more documentation before they announce to the masses to &#8220;come check this out.&#8221;  Luckily they aren&#8217;t requiring all apps to use the new API as of yet but hopefully it won&#8217;t come too soon.</p>
<!-- Social Buttons Generated by Digg Digg plugin v5.2.5,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://digijustin.com/2008/07/08/update-to-facebooks-new-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with New Facebook API</title>
		<link>http://digijustin.com/2008/06/30/working-with-new-facebook-api/</link>
		<comments>http://digijustin.com/2008/06/30/working-with-new-facebook-api/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 22:45:59 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[publishTemplatizedAction]]></category>
		<category><![CDATA[publishUserAction]]></category>
		<category><![CDATA[registerTemplateBundle]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://www.kodedkreations.net/?p=59</guid>
		<description><![CDATA[As I&#8217;ve written previously, I have worked on a few Facebook applications. I&#8217;ve gotten quite familiar with the intricacies of Facebook and how things work using its API. It&#8217;s an interesting way of doing things if you ever get the &#8230; <a href="http://digijustin.com/2008/06/30/working-with-new-facebook-api/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://digijustin.com/2008/06/30/working-with-new-facebook-api/" data-count="vertical" data-text="Working with New Facebook API" data-via="digijustin" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fdigijustin.com%2F2008%2F06%2F30%2Fworking-with-new-facebook-api%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://digijustin.com/2008/06/30/working-with-new-facebook-api/'></g:plusone></div><div class='dd_button'><script type='text/javascript' src='http://platform.linkedin.com/in.js'></script><script type='IN/share' data-url='http://digijustin.com/2008/06/30/working-with-new-facebook-api/' data-counter='top'></script></div></div></div><p><span class="zemanta-img" style="margin: 1em; float: right; display: block;"><a href="http://commons.wikipedia.org/wiki/Image:Facebook.svg"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/06/Facebook.svg/202px-Facebook.svg.png" alt="Facebook logo - Image Via Wikipedia" style="border: medium none ; display: block;"></a></span>As I&#8217;ve written previously, I have worked on a few Facebook applications.  I&#8217;ve gotten quite familiar with the intricacies of Facebook and how things work using its API.  It&#8217;s an interesting way of doing things if you ever get the chance to check it out.</p>
<p>Anyhow, I&#8217;ve been working for the past week or so on getting to know the new API and platform changes that Facebook should be releasing in the next month or so.  While it seems that a lot of things will just work as is, there are a couple of main points that will need to be changed for any Facebook app written on the current platform.</p>
<p>The main change I feel is the way that the application publishes feeds.  Previously, you would call the Feed.publishTemplatizedAction function.  It is pretty basic and relatively easy to understand.  With the new platform, this old call is being removed and to be replaced with a couple of API calls.  With the old platform, you needed to register your templates, get a Template ID back from Facebook, and then use that to call your feeds whenever.</p>
<p>I had a lot of issues at first getting the syntax correct on how the data was passed to the feeds since there isn&#8217;t a lot of documentation on how they are supposed to look.  Especially since Facebook changed the call Feed.registerTemplateBundle.  But once I got the new changes implemented and the hang of it, publishing feeds stories finally worked as they once did.</p>
<p>The big change to the feed stories is that you are able to have 3 feed sizes.  The default is the one-liner.  Just like it sounds, one line of copy.  Next are the short story and the full story.  They are very similar with the exception that you actually register an array of short stories with each one having one less dynamic piece than the one before it.  With full stories, you only register one but you can make it large.  I&#8217;m not sure of the size difference between the short and full stories as I don&#8217;t think that has been decided as of yet.  If so, let me know.</p>
<p>Those are really the only things that I have done with the new API as of yet.  Seems really cool but also a lot of work to keep your old apps working seamlessly.  First of all, each application that you have, you will have to run the Feed.registerTemplateBundle API function to get a template ID for your app to use exclusively.  Secondly, you will have edit your API calls to now call the Feed.publishUserAction instead of the Feed.publishTemplatizedAction call being made previously.  It&#8217;s not a &#8220;huge&#8221; change but still there are a few differences.</p>
<p>My idea for updating the apps that I have worked on was to just change the API code that we use on every project but I have seen that won&#8217;t work exactly as I had planned.  Currently, I pass the entire feed story as a string into the API call but with the new way, I&#8217;m going to have to pass a JSON array because the story itself has already been registered along with the template ID.  It&#8217;s not a big deal but it would be nice if Facebook made their API a little bit more backwards compatible.  But I can see why they are doing it this way.  Everything is changing and it would be hard to keep the old stuff working.  I would like the ability to register templates like they do it currently through a form on the Facebook site.  That way I wouldn&#8217;t have to create a page on each app just to get a number back and then remove that page.  Seems like kind of a waste to me but it&#8217;s still early, maybe they&#8217;ll do that.</p>
<p>If you have worked with the new Facebook API, I would love to hear about your experiences and what you think about some of the pending changes.  I&#8217;m excited to see what changes end up happening and where the platform goes.
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/8f046a37-94ac-47dc-a075-984ee3d79edc/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_a.png?x-id=8f046a37-94ac-47dc-a075-984ee3d79edc" alt="Zemanta Pixie"></a></div>
<!-- Social Buttons Generated by Digg Digg plugin v5.2.5,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://digijustin.com/2008/06/30/working-with-new-facebook-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why Code from Other People Always Sucks</title>
		<link>http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/</link>
		<comments>http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 05:54:59 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kodedkreations.net/2008/01/07/why-code-from-other-people-always-sucks/</guid>
		<description><![CDATA[I&#8217;ve worked on quite a few projects in the time I&#8217;ve been in working in development. I&#8217;ve noticed a couple of similarities between all projects when a project is inherited from another group. Not too long after the developers get &#8230; <a href="http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share dd_post_share_left'><div class='dd_buttons'><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/" data-count="vertical" data-text="Why Code from Other People Always Sucks" data-via="digijustin" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fdigijustin.com%2F2008%2F01%2F07%2Fwhy-code-from-other-people-always-sucks%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div class='dd_button'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/'></g:plusone></div><div class='dd_button'><script type='text/javascript' src='http://platform.linkedin.com/in.js'></script><script type='IN/share' data-url='http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/' data-counter='top'></script></div></div></div><p>I&#8217;ve worked on quite a few projects in the time I&#8217;ve been in working in development.  I&#8217;ve noticed a couple of similarities between all projects when a project is inherited from another group.  Not too long after the developers get to look at it, something universally is always said by one or more members of the team.  &#8220;This code sucks.&#8221;</p>
<p>I&#8217;ve said it myself before but I got to wonder if others do this.  There are only a few reasons this could happen:</p>
<ol>
<li>The previous code does suck</li>
<li>The new team has better ways of doing things over the previous team</li>
<li>The code doesn&#8217;t suck, but it&#8217;s just what is said when inheriting new code</li>
</ol>
<p>Now I seriously doubt that most of the code out there sucks but it is a perception that most developers seem to have.  Everyone has their own way of doing things and most times, one is not all that better than another; just different.</p>
<p>This is also caused by progress in my opinion.  Something that might have seemed correct a few years ago is now seen as obsolete.  Also over-thinking a project can cause this.  I worked on a site a few years ago that was written using many PHP include files.  That&#8217;s not such a bad idea but it was overdone because many of its includes had includes of their own and it was a really tough project to maintain.  In my opinion, it was a good idea gone overboard.</p>
<p>Occasionally there will be a site that truly &#8220;sucks&#8221;.  I was part of a team that inherited a site that was in dire straights.  The code made no sense, the design wasn&#8217;t appealing at all and no one visited it.  We were lucky enough that the client was aware of these things and we were allowed to start from scratch.  Now I wonder if the people working on that site now think that it sucks.  Probably <img src='http://static.digijustin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>There are many different characteristics that programmers look for in &#8220;good&#8221; code.  The issue is that these characteristics differ between groups of programmers and what is the bread and butter for one team will be nothing more than garbage and a hassle for another.  Because programming is such a subjective art, not everyone will agree on the right way to do things because what is right for one person, might not be right for someone else.  Everyone and every team has strong and weak points and the idea is to code using your strongest abilities.  In turn, that will make your code better.</p>
<p>My goal when I come across new code is to not jump on it and say how horrible it is, but to rather spend some time looking at it and try to understand why certain things were done that way.  If you are able to step outside your comfort zone and think of things a different way, you might learn something that you hadn&#8217;t thought of before.</p>
<p>So before you announce that the code you just inherited &#8220;sucks&#8221;, take a closer look at it and try to get into the mind of the previous programmer.  If you still can&#8217;t make any sense of it, it&#8217;s because it probably sucks.</p>
<!-- Social Buttons Generated by Digg Digg plugin v5.2.5,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://digijustin.com/2008/01/07/why-code-from-other-people-always-sucks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Content Delivery Network via Amazon Web Services: S3: static.digijustin.com

Served from: digijustin.com @ 2012-05-22 23:31:24 -->
