<?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>Matt McCormick &#187; programming</title>
	<atom:link href="http://mattmccormick.ca/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattmccormick.ca</link>
	<description>Improving Software</description>
	<lastBuildDate>Fri, 03 Feb 2012 02:23:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Forget Sunscreen&#8230;.Focus</title>
		<link>http://mattmccormick.ca/2011/10/21/forget-sunscreen-focus/</link>
		<comments>http://mattmccormick.ca/2011/10/21/forget-sunscreen-focus/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 23:55:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Productivity]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=205</guid>
		<description><![CDATA[Focus. If I could offer you only one tip for the future, focus would be it. In the next 20 years, we are going to face an extreme shortage of people who are able to focus single-mindedly on what they are doing. Children growing up these days face an onslaught of distractions thanks to news [...]]]></description>
			<content:encoded><![CDATA[<p>Focus. If I could offer you only one tip for the future, focus would be it.</p>
<p>In the next 20 years, we are going to face an extreme shortage of people who are able to focus single-mindedly on what they are doing.  Children growing up these days face an onslaught of distractions thanks to news feeds and smartphones and it is only going to get worse.</p>
<p><strong>Why is this a problem?</strong></p>
<p>People cannot multi-task well.  I know there will be many people who say they can, but they can&#8217;t &#8211; at least not on a task that requires concentration and focus.  If you think multi-tasking is fine, answer me this: if you were going into surgery and saw your surgeon preparing while checking his mobile phone messages and watching TV, would you feel comfortable?</p>
<p>The ability to focus is a habit that can be trained or drained.  Growing up in a distraction-oriented world, this will be a problem because the best work gets done when someone is focused on what they are doing.</p>
<p>When programming, my best days are when I don&#8217;t even check email until the end of the day.  I have my tasks laid out and just start on them.  When I need a break, I take a break but focus solely on the break during that time.  Then when I am refreshed, I get back to work and focus just on the work.  Days like these are bliss.  I finish work feeling energized and enthusiastic.</p>
<p>The worst days are days I usually check email first thing in the morning.  Immediately the distractions start.  And even though I may check email only for a few minutes, it can throw me off for the rest of the day.  On these days, I finish work feeling drained of energy and wondering what I got done.</p>
<p>My first full-time job after university was at a large, bureaucratic organization.  As part of their IT policies, they blocked access to &#8220;time-wasting&#8221; sites like Gmail and Facebook.  At the time, I thought this was a horrible, Orwellian thing to do.  By restricting access, they were treating employees like children instead of trusting people to get their work done.</p>
<p>Now, I realise there is some benefit to this course of action (although it is better for people to figure it out for themselves &#8211; you can&#8217;t block every non-work essential website).</p>
<p><strong>How to focus</strong></p>
<p>What is focus?  Focus is setting limits on yourself.  In today&#8217;s world where most North Americans are in debt, setting limits is something that very few people do.  The average person might even be annoyed at just the idea of setting a limit on themselves.  Most people don&#8217;t even limit their spending to the income that they earn.  After all, it benefits others when you don&#8217;t set limits on yourself.  I hear advertisements all the time saying things like &#8220;Buy this. You deserve it.&#8221;  I never hear an ad saying &#8220;Buy this if you have the money saved and can afford it.&#8221;</p>
<p>Luckily, the ability to focus can be improved just like any skill.</p>
<p>There are two parts to it &#8211; mental fitness and physical fitness</p>
<p><strong>Mental Fitness</strong></p>
<p>I meditate for 15 minutes a day in the morning.  There are different kinds of meditation but for improving your focus, the best one I know of is just trying to focus on your breath and only your breath.  Whenever another thought or sensation enters your mind, just picture a bubble or cloud forming around it and floating away while you come back to focusing on your breath.</p>
<p>It can be a very challenging activity.  Currently, I can only last up to a few minutes before getting distracted without even realising it.  However, improvement comes with practice.</p>
<p>After a couple weeks, you should start noticing that you are able to focus more while working.  You will build up higher resistance to those thoughts that enter your mind throughout the day which tug at you saying &#8220;Let&#8217;s just check Facebook for a few minutes&#8230;&#8221;  This will help you get more done in less time.</p>
<p><strong>Physical fitness</strong></p>
<p>It should go without saying but being physically fit helps you in so many areas of your life, focus being one of them.  Your body can only expend so much energy at one time and if you are unhealthy, your body needs to spend more energy to keep your heart beating or your lungs breathing.  The more energy your body uses keeping you alive, the less energy you have to expend on the task at hand.</p>
<p>As we get further along in the technological revolution, the focus divide between people is going to become more noticeable.  If you want to set yourself apart from your peers, train and improve your ability to focus.  While other people are distracting the day away, you will be able to accomplish more in much less time.</p>
<p>Focus.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;count=none&amp;text=Forget%20Sunscreen%26%238230%3B.Focus" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;count=none&amp;text=Forget%20Sunscreen%26%238230%3B.Focus" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;linkname=Forget%20Sunscreen%26%238230%3B.Focus" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F10%2F21%2Fforget-sunscreen-focus%2F&amp;title=Forget%20Sunscreen%26%238230%3B.Focus" id="wpa2a_2">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2011/10/21/forget-sunscreen-focus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Do you program 4th dimensionally?</title>
		<link>http://mattmccormick.ca/2011/09/02/do-you-program-4th-dimensionally/</link>
		<comments>http://mattmccormick.ca/2011/09/02/do-you-program-4th-dimensionally/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 20:20:03 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=156</guid>
		<description><![CDATA[I&#8217;ve worked on a few different types of applications at this point in my career and one sure sign of poor programming I&#8217;ve noticed is the inability to program 4th dimensionally. You notice this when the application may be working but implementing features begins to take longer and longer. The performance starts to become an [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_157" class="wp-caption aligncenter" style="width: 460px"><a href="http://mattmccormick.ca/wp-content/uploads/2011/09/tumblr_lishpiSM8O1qgubxao1_1280.png"><img src="http://mattmccormick.ca/wp-content/uploads/2011/09/tumblr_lishpiSM8O1qgubxao1_1280-1024x550.png" alt="" title="tumblr_lishpiSM8O1qgubxao1_1280" width="450" height="241" class="size-large wp-image-157" /></a><p class="wp-caption-text">&quot;Marty, you&#039;re just not thinking 4th dimensionally&quot;</p></div>
<p>I&#8217;ve worked on a few different types of applications at this point in my career and one sure sign of poor programming I&#8217;ve noticed is the inability to program 4th dimensionally.  You notice this when the application may be working but implementing features begins to take longer and longer.  The performance starts to become an issue when more users are added to the system.  These problems are a result of the programmer not thinking about the future.</p>
<p>PHP code is notorious for this problem because it is so easy and tempting to write code that just focuses on the immediate problem.  A programmer gets the task done quickly and he is happy and the client is happy.  It&#8217;s also the reason why on outsourcing sites there are many job postings looking for PHP programmers at $5/hour.  I don&#8217;t see many postings looking for Ruby on Rails developers at that rate.  Ruby on Rails forces developers to use a well-established framework that adheres to good design practices.  With PHP, especially without using a framework, developers have the ability to just throw everything together if they so choose.  This leads to a big mess.  If the application grows, this mess gets bigger and bigger until it needs to be cleaned up.</p>
<p>Cleaning up a code mess involves a lot of work and it shouldn&#8217;t be done all at once.  It&#8217;s like switching bank accounts.  I&#8217;ve switched my main banking account before and it is a hassle that takes months to complete.  Any direct deposits and automated bill payments need to be changed to the new bank account.  Money needs to be transferred.  When you think you&#8217;ve got everything switched over, it&#8217;s also good to leave the old bank account active for a little while longer until you are reasonably confident that you haven&#8217;t forgotten anything.</p>
<p>Cleaning up a code mess is similar.  First you want to make sure that the logic will not break.  This involves writing tests for the current system.  These will most likely have to be done from scratch because if the codebase is a mess, chances are there is no testing being done.</p>
<p>Secondly, start with simple modules that are easy to understand and are loosely coupled to other parts of the application.  These parts of the application are the easiest to switch over to cleaner code because you can be relatively confident that they will still work without breaking the application.  Move on to more complicated modules as you understand the system better and all the connections.</p>
<p>Finally, when the modules have been re-coded into a more fluid design,  remove the old code.  Old code on a system just confuses new developers who don&#8217;t know if it&#8217;s important or not.  Throw it out to keep things simple.  You aren&#8217;t going to use it.</p>
<p>As a developer, how can you better program for the future?  There are a few things you can do:</p>
<p>Every time you write code think about how it will look in the future.  How easily can someone understand this code when they read it 6 or 12 months from now?  What if the code needs to be used somewhere else?  Is it easy to call from another part of the application?</p>
<p>In addition to thinking long-term while performing short-term tasks, start noticing code messes.  Anytime you see the same code repeated more than once in an application, alarm bells should start going off in your head alerting you to a possible mess.  Make a note of it.</p>
<p>Take some time regularly to clean up messy code you notice.  This is probably the most difficult as it requires a developer to think independently.  In my experience, very few managers are going to come to you and say &#8220;You should take the next week to work on cleaning up the code while no features are getting implemented.&#8221;  As a developer, you need to just clean up the code as you go along without being asked to do so.  You do it because even though the immediate task may take a little bit longer, you are saving more time down the road.</p>
<p>If all the effort is placed on the immediate short-term you will be like a public company that just focuses all its attention on the next quarter&#8217;s results.  It may work for a while but after cutting their Research and Development budget to save costs and boost short-term profits, the company then realises that they have nothing in the pipeline for the upcoming years and begins to lose market share.</p>
<p>Your manager/client is always going to be providing the short-term, immediate tasks you need to work on but to become a professional developer, you need to carve out a part of your day to think 4th dimensionally.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;count=none&amp;text=Do%20you%20program%204th%20dimensionally%3F" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;count=none&amp;text=Do%20you%20program%204th%20dimensionally%3F" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;linkname=Do%20you%20program%204th%20dimensionally%3F" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F09%2F02%2Fdo-you-program-4th-dimensionally%2F&amp;title=Do%20you%20program%204th%20dimensionally%3F" id="wpa2a_4">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2011/09/02/do-you-program-4th-dimensionally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advice for New Software Developers</title>
		<link>http://mattmccormick.ca/2011/06/01/advice-for-new-software-developers/</link>
		<comments>http://mattmccormick.ca/2011/06/01/advice-for-new-software-developers/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 13:32:46 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[advice]]></category>
		<category><![CDATA[work style]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=135</guid>
		<description><![CDATA[When starting a new path, it is often difficult to know which way to go. Some good advice I once received is that when people are starting something new, they need to be told exactly what and how to do it. It is only once they have a bit of experience that you can remove [...]]]></description>
			<content:encoded><![CDATA[<p>When starting a new path, it is often difficult to know which way to go.  Some good advice I once received is that when people are starting something new, they need to be told exactly what and how to do it.  It is only once they have a bit of experience that you can remove the &#8220;how&#8221; from the equation and just say what needs to be done.</p>
<p>For new programmers just getting started, here are the steps I recommend taking until you understand your working style better and can make adjustments.</p>
<p><strong>1) Understand the problem</strong></p>
<p>What you are trying to accomplish should be clear in your mind.  You should know what will happen once the task is complete and what the user will see.  If you are confused about anything, as a developer, it is your responsibility to ask for more clarification until your are clear about it.  There is nothing about writing code at this stage.  Often times, developers just want to jump right into coding but understanding the problem is paramount.</p>
<p><strong>2) Plan your approach on paper &#8211; pseudo code</strong></p>
<p>On a piece of paper, away from the computer, write out all the steps necessary you think it will take to accomplish the task.  Don&#8217;t write any programming code.  This should be pseudo code and written in plain English.  Write one action per line.  The more detailed, the better.</p>
<p>If you get stuck on part of it, then you do not understand the problem well enough.  Go back to step 1 and get it clear what you are trying to do. Notice, there is still nothing about writing code at this stage.</p>
<p><strong>3) Understand existing code</strong></p>
<p>Once the pseudo code is written out and your plan makes sense, now you can find the files and the areas that you think you will need to modify in existing code. You should read the surrounding code and understand it first before making any changes.  If you do not understand it fully, there is a greater chance that any changes you make will introduce more bugs.  Notice, there is still nothing about writing code at this stage.  So far, it has been all understanding and planning.</p>
<p><strong>4) Write code, one line at a time</strong></p>
<p>Ok, now you can start writing code because a) it is clear what you want to accomplish and b) you understand the existing code well.</p>
<p>NEVER, EVER copy code from somewhere else.  If you do find code somewhere else that (once you fully understand it) you think applies to your task, then type it out line by line.  You may think this will be slower but making sure you understand what you are doing ALWAYS saves you time down the road.  When typing it line by line, you should be reading it and understanding it as you go along.  If you are copying and pasting code, alarm bells should start going off in your head.</p>
<p>When writing code, only write out enough code for one of your pseudo-code lines.  Do not write out everything.  Start at the first line written on the paper and then convert that into actual code.  Then go on to the next step.</p>
<p>NOTE: this stage should actually take the least amount of time in the process.  Yes, it&#8217;s a little ironic that as a developer you&#8217;ll be spending the least amount of time writing actual code but you should be spending the majority of your time understanding the problem, planning it out, reading and understanding other code and testing your work.  If you are spending the most of your time here then there is something you do not understand well enough.  If it is the problem, then go back to step 1.  If it is the other code, then you need to read and understand more.  If it is the programming syntax then you need to read and understand more about the applicable programming language.</p>
<p><strong>5) Test what you have done</strong></p>
<p>For each line of your pseudo-code that you have written in actual code, test it to make sure it is doing what you expect.  Do this immediately after writing the code!  You do not want to write a whole bunch of code and then find out that it is not working somewhere.  You should be testing after each step so you can fix it at that point while it is fresh in your mind instead of finding it hours or days later and you have to think again about what you were doing.  If you test it and it works as you expect, go back to step 4 and write the code for the next line of your pseudo code.</p>
<p><strong>6) Don&#8217;t give up</strong></p>
<p>You are probably closer to the solution than you realise.  Have you heard the story about the gold miner?  During the gold rush he bought a mine and after weeks of exploration, found gold.  Experts said that he had found one of the richest mines in the state.  Returning with more equipment he spent time mining but no more gold could be found.  Frustrated, he finally gave up and sold the mine.  The new owner brought in an expert to assess the mine and he discovered that the main vein was just a few feet away from where they had stopped mining.</p>
<p>Sometimes it can be frustrating when you are programming and going in circles.  Instill good habits at the start of your programming career and they will treat you well down the road.  Be as orderly about your programming style as your code and you will find a successful career as a developer.  I wish you the best.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;count=none&amp;text=Advice%20for%20New%20Software%20Developers" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;count=none&amp;text=Advice%20for%20New%20Software%20Developers" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;linkname=Advice%20for%20New%20Software%20Developers" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2011%2F06%2F01%2Fadvice-for-new-software-developers%2F&amp;title=Advice%20for%20New%20Software%20Developers" id="wpa2a_6">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2011/06/01/advice-for-new-software-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming Spiritually</title>
		<link>http://mattmccormick.ca/2010/10/28/programming-spiritually/</link>
		<comments>http://mattmccormick.ca/2010/10/28/programming-spiritually/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 15:07:07 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=118</guid>
		<description><![CDATA[If you are a spiritual person, you may sometimes wonder how programming connects to the bigger picture. Working in front of a computer day after day can seem like an activity most removed from the world, nature and God. Here are some things to do to feel more connected: Awareness of Thought You are a [...]]]></description>
			<content:encoded><![CDATA[<p>If you are a spiritual person, you may sometimes wonder how programming connects to the bigger picture.  Working in front of a computer day after day can seem like an activity most removed from the world, nature and God.  Here are some things to do to feel more connected:</p>
<p><strong>Awareness of Thought</strong></p>
<p>You are a complete individual connected to a higher source.  This higher source offers answers to any question you throw at it.  It is extremely important to be aware of your thought process while programming.  Often running through my mind are questions like &#8220;Why is this not working?&#8221;, &#8220;Where is the problem?&#8221; and &#8220;How can I solve it?&#8221;.  It never fails that I receive answers to my questions.  Sometimes they come quickly.  Other times, I may need to take a break and go for a walk so that I can be open enough to receive the answer.  In cases of extreme disconnect, a good night&#8217;s sleep will relax me and let the answer flow in.</p>
<p>Untruthful thoughts should be avoided.  These thoughts question and doubt the power within you.  Some examples being &#8220;I can&#8217;t figure it out&#8221;, &#8220;It&#8217;s too complex for me to understand&#8221; or &#8220;The person who wrote this code is an idiot.&#8221;  True, the code may not be up to par, but that is just an indication that the previous programmer could be lacking knowledge or experience, not that they are a stupid or bad person.</p>
<p><strong>The Ripple Effect</strong></p>
<p>Everything in the universe is connected in a vast web.  Each created thought or action gets sent out as a wave throughout this web.  It&#8217;s like dropping a rock in a pond.  When you drop the rock, the water is affected the most immediately around the entry point.  The waves start out high and become calmer and calmer as they get further away from the entry point until they are not noticeable anymore.</p>
<p>When fixing a bug, be aware that any changes you make are going to have an effect throughout the system.  Before making the change, think about what possible effects this change could have on other parts of the system.  Nothing is isolated.</p>
<p>When designing a system, one can help this situation through abstraction.  Abstraction is like taking a big bowl of water &#8211; your system &#8211; and pouring it into several cups or glasses.  Now if you drop a stone into one of the glasses, the ripple effect will be limited to just that glass.</p>
<p><strong>Be Present</strong></p>
<p>Use the power of focus to help you maintain a flow-like state.  Email and IM notifications are a distraction which take you away from your present.  Anytime something comes up, you should be asking &#8220;Does this contribute to my present?&#8221; I have always disabled email notifications and deal with my email twice a day at set times.  This allows me to focus on my present and still get back to people in a timely manner.</p>
<p>Programming is your craft.  Cultivate it.  Your personality and character is expressed through your work.  Make it worthy.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;count=none&amp;text=Programming%20Spiritually" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;count=none&amp;text=Programming%20Spiritually" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;linkname=Programming%20Spiritually" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F10%2F28%2Fprogramming-spiritually%2F&amp;title=Programming%20Spiritually" id="wpa2a_8">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2010/10/28/programming-spiritually/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Never Compromise Quality</title>
		<link>http://mattmccormick.ca/2010/04/27/never-compromise-quality/</link>
		<comments>http://mattmccormick.ca/2010/04/27/never-compromise-quality/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 16:03:36 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[character]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=63</guid>
		<description><![CDATA[In programming people sometimes feel they have to sacrifice quality in order to get a product out the door on time. Never do this. You are hurting the customer, the company and yourself if you do. This American Life had a very interesting program on the New United Motor Manufacturing Inc (NUMMI) plant in Freemont, [...]]]></description>
			<content:encoded><![CDATA[<p>In programming people sometimes feel they have to sacrifice quality in order to get a product out the door on time.  Never do this.  You are hurting the customer, the company and yourself if you do.</p>
<p>This American Life had a very interesting program on the New United Motor Manufacturing Inc (NUMMI) plant in Freemont, California.  NUMMI was a joint venture started in 1984 between Toyota and GM for both parties to learn from each other.  GM would learn about Toyota&#8217;s quality control systems and Toyota would learn about building cars in America.</p>
<p>The amazing story is the turnaround of the plant.  Prior to the joint venture, the plant was operated by GM and was one of their worst factories.  The program talks about workers gambling, having sex, and drinking  at work.  They produced very low quality cars and didn&#8217;t really care.  The plant was closed as a result.  However, for this joint venture, GM agreed to re-open the plant and hired back many of the original workers.  Thanks to Toyota&#8217;s quality systems, the plant turned around to become one of the best GM had.</p>
<p>One example of change was &#8220;stopping the line.&#8221;  The GM workers grew up with the notion that you don&#8217;t stop the line.  If you notice something is wrong, you just keep it going.  Just get the cars out the door.  With Toyota&#8217;s system, workers were encouraged to stop the line if they noticed something wrong and fix it on the spot.  This was a big shift for them.  The process became about quality over quantity.  Within just three months, cars coming off the lot were being made with near perfect quality.</p>
<p>When you let an error slip, either with cars or with software, you are compounding the problem.  It takes much more time and money to fix the problem later than when it is first discovered.</p>
<p>How much more money?  One study estimated &#8220;it would take 50% more workers under the old system to produce the same car.&#8221;</p>
<p>Recently I had a situation like this.  I was responsible for checking over and delivering database scripts to a client.  I noticed one of the scripts had an input parameter and while I got a feeling I should double-check about it, I ignored that intuition and delivered them anyways.  The client ended up running the scripts in their environment but ignored the input parameter which caused part of the scripts to fail.  There was a lot of back and forth to get it fixed.  I estimate it probably wasted about one man-days worth of everybody&#8217;s time.  Because I didn&#8217;t take 5 minutes to check about something that could be wrong, I ended up costing hours worth of time.</p>
<p>It&#8217;s not mentioned explicitly but it is implied that the vices went away after the quality program was introduced.  While workers were embarrassed to be working at the plant before, they now were proud to tell  friends where they worked.</p>
<blockquote><p>In ancient times, brick makers, engravers, and other artisans used a symbol to mark the things they created to show that they were the makers.  The symbol that each one used was his &#8220;character.&#8221;  The value of the work was in proportion to the skill with which the object was made.  And only if the quality of the work was high was the character esteemed.  In other words, the quality of the person and his work gave value to his credentials.  If the work was good, so was the character.  If it was bad, then the character was viewed as poor.<br />
- &#8220;Becoming a Person of Influence&#8221; by John C. Maxwell &#038; Jim Dornan</p></blockquote>
<p>This is why the morale and esteem of the workers improved once quality became the focus.  Your character is revealed in the work you do and vice versa.  If you are producing shoddy work, your character is being revealed as such.</p>
<p>In programming, quality does not mean taking a stand over something trivial such as whether to use tabs or spaces for indentation.  Quality means being consistent in your work.  It means following design principles that will save time and effort down the road.  It means doing things right the first time so you don&#8217;t need to correct them later.</p>
<p>Always do things in a quality manner.  Never compromise.  For if you do, you are compromising your character.</p>
<p>&#8211;</p>
<p><a href="http://www.thisamericanlife.org/radio-archives/episode/403/nummi">This American Life episode about NUMMI</a><br />
<a href="https://www.amazon.com/dp/0785288392?tag=mattmccormick-20&#038;camp=0&#038;creative=0&#038;linkCode=as1&#038;creativeASIN=0785288392&#038;adid=1KHH40EYM22GBT702C63&#038;">Becoming a Person of Influence</a></p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;count=none&amp;text=Never%20Compromise%20Quality" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;count=none&amp;text=Never%20Compromise%20Quality" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;linkname=Never%20Compromise%20Quality" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F27%2Fnever-compromise-quality%2F&amp;title=Never%20Compromise%20Quality" id="wpa2a_10">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2010/04/27/never-compromise-quality/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to easily create Models and Table Relationships in Zend Framework</title>
		<link>http://mattmccormick.ca/2010/04/24/how-to-easily-create-models-and-table-relationships-in-zend-framework/</link>
		<comments>http://mattmccormick.ca/2010/04/24/how-to-easily-create-models-and-table-relationships-in-zend-framework/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 19:06:02 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[models]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[table relationships]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=52</guid>
		<description><![CDATA[When I first started using Zend Framework, I was so frustrated when trying to figure out how to get information from the database. I fought against the framework for the longest time. Instead of working with it, I would write the SQL and then simply query the database to get the data back as an [...]]]></description>
			<content:encoded><![CDATA[<p>When I first started using Zend Framework, I was so frustrated when trying to figure out how to get information from the database.  I fought against the framework for the longest time.  Instead of working with it, I would write the SQL and then simply query the database to get the data back as an array of objects.</p>
<p>Later on I learned at just how powerful Zend Framework can be when it comes to retrieving models.  It is actually easier and more fun to do things in the &#8220;Zend&#8221; way.</p>
<p>This is the post I wish I had read before spending hours going about things the wrong way.</p>
<p>I&#8217;m using Zend Framework for a project which has videos, users (each user can have many videos) and tags (many tags to many videos).  This example will show you how to setup your models correctly:</p>
<p><strong>/application/models/DbTable/Videos.php</strong></p>
<pre class="brush: php">class Model_DbTable_Videos extends Zend_Db_Table_Abstract
{
	protected $_name = &#039;videos&#039;;	// database table name
	protected $_rowClass = &#039;Model_Row_Video&#039;;	// row class for extending
	protected $_dependentTables = array(&#039;Model_DbTable_VideoTag&#039;);	// videos depends on the many-to-many join table for tags

	protected $_referenceMap = array(
		&#039;User&#039; =&gt; array(
			&#039;columns&#039; =&gt; &#039;user_id&#039;,	// the column in the &#039;videos&#039; table which is used for the join
			&#039;refTableClass&#039; =&gt; &#039;users&#039;,	// the users table name
			&#039;refColumns&#039; =&gt; &#039;id&#039;	// the primary key of the users table
		)
	);
}</pre>
<p><strong>/application/models/DbTable/User.php</strong></p>
<pre class="brush: php">class Model_DbTable_Users extends Zend_Db_Table_Abstract
{
	protected $_name = &#039;users&#039;;
	protected $_rowClass = &#039;Model_Row_User&#039;;
	protected $_dependentTables = array(&#039;Model_DbTable_Videos&#039;);
}</pre>
<p><strong>/application/models/DbTable/Tags.php</strong></p>
<pre class="brush: php">class Model_DbTable_Tags extends Zend_Db_Table_Abstract
{
    protected $_name = &#039;tags&#039;;
    protected $_rowsetClass = &#039;Model_Rowset_Tags&#039;;
}</pre>
<p><strong>/application/models/DbTable/VideoTag.php</strong> (the join table for many-to-many relationship)</p>
<pre class="brush: php">class Model_DbTable_VideoTag extends Zend_Db_Table_Abstract
{
    protected $_name = &#039;video_tag&#039;;
    protected $_referenceMap = array(
		&#039;Video&#039; =&gt; array(
			&#039;columns&#039; =&gt; &#039;video_id&#039;,
			&#039;refTableClass&#039; =&gt; &#039;Model_DbTable_Videos&#039;,
			&#039;refColumns&#039; =&gt; &#039;id&#039;
   		),
   		&#039;Tag&#039; =&gt; array(
   			&#039;columns&#039; =&gt; &#039;tag_id&#039;,
   			&#039;refTableClass&#039; =&gt; &#039;Model_DbTable_Tags&#039;,
   			&#039;refColumns&#039; =&gt; &#039;id&#039;
   		)
	);
}</pre>
<p>The protected fields allow you to tell the framework the setup of the tables.  You can also extend the Row on Rowset by simply setting the $_rowClass or $_rowsetClass field.</p>
<p>In Model_DbTable_Videos, you see I have specified the $_rowClass field.  This means any row returned will be an object of Model_Row_Video.  In the class Model_Row_Video, I have added extra methods for easily retrieving the user of the video and tags belonging to that video:</p>
<p><strong>/application/models/Row/Video.php</strong></p>
<pre class="brush: php">
class Model_Row_Video extends Zend_Db_Table_Row_Abstract
{
	private $tags = null;
	private $user = null;

	/**
	 * @return Model_Row_User
	 */
	public function getUser()
	{
		if (!$this-&gt;user) {
			$this-&gt;user = $this-&gt;findParentRow(&#039;Model_DbTable_Users&#039;);
		}

		return $this-&gt;user;
	}

	/**
	 * @return Model_Rowset_Tags
	 */
	public function getTags()
	{
		if (!$this-&gt;tags) {
			$this-&gt;tags = $this-&gt;findManyToManyRowset(
				&#039;Model_DbTable_Tags&#039;,	// match table
				&#039;Model_DbTable_VideoTag&#039;);	// join table
		}

		return $this-&gt;tags;
	}
}
</pre>
<p>Because I have all the relationships setup, I simply need to call findParentRow() or findManyToManyRowset() to get the Row or Rowset of a related record.</p>
<p>Here is an example for the Rowset:</p>
<p><strong>/application/models/Rowset/Tags.php</strong></p>
<pre class="brush: php">
class Model_Rowset_Tags extends Zend_Db_Table_Rowset_Abstract
{
	/**
	 * @return array the tags in an array
	 */
	public function getAsArray()
	{
		$tags = array();

		while ($this-&gt;valid()) {
			$tag = $this-&gt;current();
			$tags[] = $tag-&gt;name;  // the actual tag name
			$this-&gt;next();
		}

		$this-&gt;rewind();

		return $tags;
	}
}
</pre>
<p>So to get the tags of the video with ID 23 all I need to do now is simply:</p>
<pre class="brush: php">
$tblVideo = new Model_DbTable_Videos();
$video = $tblVideo-&gt;find(23)-&gt;current();  // returns Model_Row_Video
$tagsArr = $video-&gt;getTags()-&gt;getAsArray();
</pre>
<p>Working with Zend Framework becomes very easy and pleasurable once you follow their setup.</p>
<p>Refer to the <a href="http://framework.zend.com/manual/en/zend.db.html">Zend_Db section of the manual</a> for more information about working with the database.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;count=none&amp;text=How%20to%20easily%20create%20Models%20and%20Table%20Relationships%20in%20Zend%20Framework" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;count=none&amp;text=How%20to%20easily%20create%20Models%20and%20Table%20Relationships%20in%20Zend%20Framework" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;linkname=How%20to%20easily%20create%20Models%20and%20Table%20Relationships%20in%20Zend%20Framework" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2010%2F04%2F24%2Fhow-to-easily-create-models-and-table-relationships-in-zend-framework%2F&amp;title=How%20to%20easily%20create%20Models%20and%20Table%20Relationships%20in%20Zend%20Framework" id="wpa2a_12">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2010/04/24/how-to-easily-create-models-and-table-relationships-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>I Don&#8217;t Want to be a Code Monkey</title>
		<link>http://mattmccormick.ca/2009/11/30/i-dont-want-to-be-a-code-monkey/</link>
		<comments>http://mattmccormick.ca/2009/11/30/i-dont-want-to-be-a-code-monkey/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 21:24:10 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mattmccormick.ca/?p=6</guid>
		<description><![CDATA[&#8220;I don&#8217;t want to be a code monkey.&#8221;  I&#8217;ve heard a few friends say this who are involved in programming.  I don&#8217;t get it. Wikipedia says that a code monkey is someone &#8220;who writes computer code for a living.&#8221;  That&#8217;s pretty broad.  I assume a code monkey refers to someone who mindlessly takes orders.  In [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&#8220;I don&#8217;t want to be a code monkey.&#8221;  I&#8217;ve heard a few friends say this who are involved in programming.  I don&#8217;t get it.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Wikipedia says that a code monkey is someone &#8220;who writes computer code for a living.&#8221;  That&#8217;s pretty broad.  I assume a code monkey refers to someone who mindlessly takes orders.  In that case, a code monkey must be someone who stands behind a counter, smiles and says &#8220;Would you like to supersize that IF statement?  You can get an extra variable for just 50 cents more!&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Perhaps it is more than that though.  Perhaps these people just don&#8217;t want to take orders and want to have creative control over their work.  Fools!  If you are not fulfilling orders, you are not providing value and you are not getting paid.  No matter what you do, you will always have to take orders and serve.  Even a founder of a company needs to fulfill the orders of his customers.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">In my programming career I always feel I have creative control over my work.  I have worked with both technical and non-technical clients, on large systems and small and all situations call for creative input.  Without creativity, programming would be boring.  Top programmers can command 6 figure salaries.  Surely, monkeys do not get paid that well.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">What if you work for a non-technical manager who just says what he wants done?</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">What&#8217;s wrong with that I say.  If the person you&#8217;re working for isn&#8217;t technically minded then you have complete freedom to do the work in whatever way you choose.  You can try out new frameworks or programming languages.  You can use different development methodologies.  It doesn&#8217;t matter as long as it gets the job done.  There are differences between working for a technical and non-technical manager and they generally balance out.  With a non-technical manager, however, you are the expert.  They hired you because they don&#8217;t know what you know.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Just because you program doesn&#8217;t mean you are a code monkey.  You have a choice.  You will end up being a code monkey if you stop learning after college.</div>
<p>&#8220;I don&#8217;t want to be a code monkey.&#8221;  I&#8217;ve heard a few friends say this who are involved in programming.  I don&#8217;t get it.</p>
<p>Wikipedia says that a code monkey is someone &#8220;who writes computer code for a living.&#8221;  That&#8217;s pretty broad.  I assume a code monkey refers to someone who mindlessly takes orders.  In that case, a code monkey must be someone who stands behind a counter, smiles and says &#8220;Would you like to supersize that IF statement?  You can get an extra variable for just 50 cents more!&#8221;</p>
<p>Perhaps it is more than that though.  Perhaps these people just don&#8217;t want to take orders and want to have creative control over their work.  Fools!  If you are not fulfilling orders, you are not providing value and you are not getting paid.  No matter what you do, you will always have to take orders and serve.  Even a founder of a company needs to fulfill the orders of his customers.</p>
<p>I always feel I have creative control over my work.  I have worked with both technical and non-technical clients, on large systems and small and all situations call for creative input.  Without creativity, programming would be boring.  Top programmers can command 6 figure salaries.  Surely, monkeys do not get paid that well.</p>
<p>What if you work for a non-technical manager who just says what he wants done?</p>
<p>What&#8217;s wrong with that I say.  If the person you&#8217;re working for isn&#8217;t technically minded then you have complete freedom to do the work in whatever way you choose.  You can try out new frameworks or programming languages.  You can use different development methodologies.  It doesn&#8217;t matter as long as it gets the job done.  There are differences between working for a technical and non-technical manager and they generally balance out.  With a non-technical manager, however, <strong>you </strong>are the expert.  They hired you because they don&#8217;t know what you know.</p>
<p>Just because you program doesn&#8217;t mean you are a code monkey.  You have a choice.  You will end up being a code monkey if you stop learning after college.</p>
<p><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;count=none&amp;text=I%20Don%26%238217%3Bt%20Want%20to%20be%20a%20Code%20Monkey" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;counturl=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;count=none&amp;text=I%20Don%26%238217%3Bt%20Want%20to%20be%20a%20Code%20Monkey" scrolling="no" style="border:none;overflow:hidden;width:55px;height:20px"></iframe><!--<![endif]--><a class="a2a_button_email" href="http://www.addtoany.com/add_to/email?linkurl=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;linkname=I%20Don%26%238217%3Bt%20Want%20to%20be%20a%20Code%20Monkey" title="Email" rel="nofollow" target="_blank"><img src="http://mattmccormick.ca/wp-content/plugins/add-to-any/icons/email.png" width="16" height="16" alt="Email"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmattmccormick.ca%2F2009%2F11%2F30%2Fi-dont-want-to-be-a-code-monkey%2F&amp;title=I%20Don%26%238217%3Bt%20Want%20to%20be%20a%20Code%20Monkey" id="wpa2a_14">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://mattmccormick.ca/2009/11/30/i-dont-want-to-be-a-code-monkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

