<?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>codegumbo &#187; Good Habits</title>
	<atom:link href="http://codegumbo.com/index.php/category/development/code/good-habits/feed/" rel="self" type="application/rss+xml" />
	<link>http://codegumbo.com</link>
	<description>Laissez Les Bon Code Roulez!</description>
	<lastBuildDate>Fri, 03 Feb 2012 00:43:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Three Myths about Agile Development</title>
		<link>http://codegumbo.com/index.php/2011/06/09/three-myths-about-agile-development/</link>
		<comments>http://codegumbo.com/index.php/2011/06/09/three-myths-about-agile-development/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 13:37:56 +0000</pubDate>
		<dc:creator>stuart</dc:creator>
				<category><![CDATA[Good Habits]]></category>
		<category><![CDATA[Something New]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>

		<guid isPermaLink="false">http://codegumbo.com/index.php/2011/06/09/three-myths-about-agile-development/</guid>
		<description><![CDATA[I recently attended Microsoft Tech Ed in Atlanta, and while there wasn’t much new being announced about SQL Server (I had heard about many of the features for Denali at PASS Summit 2010), I did find myself drawn to several sessions regarding Agile principles and development.&#160; My shop has been using the Scrum method for [...]]]></description>
			<content:encoded><![CDATA[<p>I recently attended <a href="http://northamerica.msteched.com" target="_blank">Microsoft Tech Ed</a> in Atlanta, and while there wasn’t much new being announced about SQL Server (I had heard about many of the features for Denali at <a href="http://www.agilemanifesto.org/" target="_blank">PASS Summit 2010</a>), I did find myself drawn to several sessions regarding Agile principles and development.&#160; My shop has been using the Scrum method for about 2 years now, and it was nice to have a refresher.&#160; I also participated in (and overheard) a lot of conversations about Agile methods, and it made me realize two very important things:</p>
<ol>
<li>Many people who claimed to be using Agile methods had never read the Agile Manifesto, and </li>
<li>There are several misconceptions in play regarding Agile development. </li>
</ol>
<p>The point of this blog post is dual-fold; first I want to encourage you to read the <a href="http://www.agilemanifesto.org/" target="_blank">Agile Manifesto</a>.&#160; If you’ve read it before, <a href="http://www.agilemanifesto.org/" target="_blank">read it again</a>.&#160; And then, read it a <a href="http://www.agilemanifesto.org/" target="_blank">third time</a> (it’s short, so easy to read).&#160; Done that?&#160; Good, because here’s the crux of my argument:</p>
<p><strong>If you want to do Agile development, you must adhere to the principles of the Agile Manifesto.</strong></p>
<p>It’s simple, really; you shouldn’t claim to be a SQL Server developer if you’ve never written a T-SQL statement.&#160; You can’t call yourself a cubist if you haven’t studied the works of Picasso.&#160; You shouldn’t claim to be doing Agile development if you don’t adhere to the principles of the Agile Manifesto. </p>
<p>And, that leads us to the second part of this post; I believe that lots of us think we’re adhering to the methods and principles of Agile development, but there are at least three basic myths about Agile development which keep development teams from being as agile as they can be; here’s my take on them:</p>
<h3>Myth 1: Daily meetings with business people are an impediment to rapid development.</h3>
<p>I actually got into a fervent discussion with gentleman at TechEd about this subject during a Birds of the Feather Session on Scrum.&#160; he claimed to be a Scrum Master for 6 teams (including several overseas), and that he barred business people from entering into the daily standup in order to keep them from dragging the meeting astray.&#160; I think that’s wrong, and here’s why (from the Agile Manifesto principles):</p>
<blockquote><p>Business people and developers must work together daily throughout the project. </p>
</blockquote>
<p>While it’s true that the daily standup in Scrum need not be the daily interaction, it makes sense that business people LISTEN (but not INTERACT) in that meeting in order to understand on what issues the development team is working, and how those issues interplay with each other (Note: scrum calls this the <a href="http://en.wikipedia.org/wiki/The_Chicken_and_the_Pig" target="_blank">chicken and the pig</a>; business people need to know what’s going on across the development team, but shouldn’t be involved at this point.&#160; However, the daily standup can spur additional conversations).&#160;&#160; If your development team chooses to have a daily standup without business people, your team members MUST interact with business people in order to handle changing requirements; they must also communicate at that time what the priorities of the development organization are, and why this particular project is not progressing because some other project takes priority.</p>
<p>Agile development depends on the interaction between developers and business people; to isolate half of the team from the other half of the team will cause disruption to the process.&#160; That leads us to our second myth:</p>
<h3>Myth 2: Your development team can be agile in a vacuum.</h3>
<p>I call this the Agile-Waterfall mindset; your business organization is separate from your development team.&#160; Your developers are practicing some form of Agile development, but the organization is used to handing off a set of requirements to the developers, and then having them return a product at periodic intervals.&#160; Think of this as the complement to Myth 1; Business people aren’t deemed to be an impediment, but the organization hasn’t endorsed agile development throughout.&#160; Daily meetings with developers aren’t deemed to be a priority by the business people; the organization has developed a culture of handing off responsibilities, and expecting them to be fulfilled without daily guidance.</p>
<p><strong>By definition, you can not have an agile team without input from both developers and business people.</strong>&#160;&#160; If you want to respond to changing requirements (as frustrating as that can be to developers), you must have input from business people as soon as those requirements change.&#160; Again, you need to handle prioritization, as changing requirements do not necessarily merit immediate priority.</p>
<h3>Myth 3: Self-organizing teams self-manage efficiently.</h3>
<p>A couple of great principles from the Agile Manifesto deal with communication:</p>
<blockquote><p>The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.</p>
<p>The best architectures, requirements, and designs emerge from self-organizing teams. </p>
</blockquote>
<p>While I believe in the wisdom of these two principles, I don’t want to de-emphasize the need for good, basic software design principles.&#160; Most enterprise development consists of intertwined projects and resources; in order to minimize maintenance issues, adherence to consistent programming standards is a must.&#160; Developers have different naming standards, procedural methodology, and architectural perspectives; a good team has a playbook that ALL members of the development team (regardless of what project team they serve) follow. If you have one database developer that makes heavy use of schemas, and another one that doesn’t, maintaining each other’s code requires some additional effort on their parts.&#160; Furthermore, when teams are self-formed of roughly equally-experienced developers, resolution of architectural decisions can be difficult.</p>
<p>Development teams need an enforcer; a good manager goes a long way toward resolving interpersonal conflicts before they get started.&#160; Just because teams communicate well (and good communication includes conflict), it does not necessarily mean that those same teams will develop quality code in an efficient manner.&#160; Good teams need good direction.</p>
<h3></h3>
<h3>Summing Up.</h3>
<p>If you’ve made it this far, I hope I’ve given you some food for thought, as well as encouraged you to go back and revisit the Agile Manifesto, as well as your own organizational processes.&#160; Let me sum up with a final thought from the Agile Manifesto:</p>
<blockquote><p>At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://codegumbo.com/index.php/2011/06/09/three-myths-about-agile-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good Habits To Adopt: Enforcing the natural primary key</title>
		<link>http://codegumbo.com/index.php/2009/10/22/good-habits-to-adopt-enforcing-the-natural-primary-key/</link>
		<comments>http://codegumbo.com/index.php/2009/10/22/good-habits-to-adopt-enforcing-the-natural-primary-key/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 03:55:58 +0000</pubDate>
		<dc:creator>stuart</dc:creator>
				<category><![CDATA[Good Habits]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>

		<guid isPermaLink="false">http://codegumbo.com/index.php/2009/10/22/good-habits-to-adopt-enforcing-the-natural-primary-key/</guid>
		<description><![CDATA[I’ve been reading Aaron Bertrand’s great series of blog posts on bad habits to kick, and have been thinking to myself: what are some good habits that SQL Server developers should implement?&#160;&#160;&#160; I spend most of my day griping about bad design from vendors, yet I hardly ever take the time to document what should [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px 0px 10px 10px; display: inline" align="right" src="http://sustainablecities.dk/en/files/imagecache/case/blog/being_less_bad_is_not_being_good_by_Shira_Golding_April_29_2009_flickr_creative_commons.jpg" width="354" height="207"> I’ve been reading Aaron Bertrand’s great series of blog posts on bad habits to kick, and have been thinking to myself: what are some good habits that SQL Server developers should implement?&nbsp;&nbsp;&nbsp; I spend most of my day griping about bad design from vendors, yet I hardly ever take the time to document what should be done instead.&nbsp; This post is my first attempt to do so, and it’s based on the following assumptions:</p>
<ul>
<li>Good habits are going to be a lot more controversial than bad habits, and
<li>SQL Server doesn’t enforce many of these good habits for you.</li>
</ul>
<p>The first point refers to the fact that some of the choices that I make are not necessarily the best way to do things, and they may not satisfy the need of every application.&nbsp; I’m a firm believer that there is an exception to every rule, but my goal is to at least define what the rules are (and again, these rules are my own creation and someone may have better rules).&nbsp; The second point refers to the fact that SQL Server enforces the rules of SQL, but leaves some of that enforcement open to interpretation.&nbsp; For example, the relational model defined by SQL assumes that tables are related, but SQL Server doesn’t require that you define a FOREIGN KEY (or even a PRIMARY KEY).</p>
<p>So here’s my first good habit:</p>
<h3>When defining a surrogate primary key for a table, you should enforce the natural primary key with the use of a UNIQUE constraint.</h3>
<p>To really understand this, you have to start with defining what a surrogate primary key is versus a natural primary key.&nbsp; You can <a href="http://www.bing.com/search?q=natural+versus+surrogate+key&amp;form=IE8SRC&amp;src=IE-SearchBox">search for a variety of definitions</a>, but I’ll use the following:</p>
<ul>
<li><strong>Primary Key</strong>: a non-nullable attribute (or combination of attributes) that can be used to uniquely identify a specific instance of an entity.&nbsp; When used within SQL, a primary key can be mapped to a column (or columns) in a table, and the value of the key uniquely identifies a row.
<li><strong>Natural Primary Key</strong>: a primary key that is not auto-generated by the database or application.&nbsp; The key is comprised of attributes that are associated with an entity, and the value of those attributes is defined by some authority beyond the scope of the database or application.&nbsp; For example, a Social Security number is a “arbitrarily” assigned number that belongs to a specific citizen of the United States; most databases that use the Social Security number do not create the number, but rather use it as a reference to a particular US citizen.
<li><strong>Surrogate Primary Key</strong>: a primary key that is auto-generated by the database or application to specifically identify the row in the table representing the collection of entities.&nbsp; Surrogate keys have no meaning outside of the database and have no relationship to the other attributes in the table.&nbsp; An ID of 1 simply identifies a row in a table; a row representing a person, a squid, or an automobile may all have an id of 1, depending on what table the surrogate key the data lives in.</li>
</ul>
<blockquote><p><font style="background-color: #ffffff">Sidebar: as I was writing this, Pinal Dave post the following to his blog: <a title="http://blog.sqlauthority.com/2009/10/22/sql-server-difference-between-candidate-keys-and-primary-key-2/" href="http://blog.sqlauthority.com/2009/10/22/sql-server-difference-between-candidate-keys-and-primary-key-2/">http://blog.sqlauthority.com/2009/10/22/sql-server-difference-between-candidate-keys-and-primary-key-2/</a></font>&nbsp;</p>
</blockquote>
<p>Most novices recognize that every table needs a primary key, and surrogate keys offer some benefits that natural keys do not, including:</p>
<ul>
<li>Immutability: the ability of a key to stay constant over time.&nbsp; A natural primary key (such as a person’s name) may change, but a surrogate key does not.
<li>Simplicity of relational JOINS: surrogate keys can remain as a singular column for each table they represent.&nbsp; For example, a complete invoice may need to be represented by a ClientID, an InvoiceID, and the LineID’s for the lines on that invoice.&nbsp; Joining on the natural keys may require the Client Name and Address, the Invoice Number, and the Line Number.&nbsp; </li>
</ul>
<p>However, surrogate keys have one major weakness; they do NOT enforce the unique validity of each row.&nbsp; If you use an IDENTITY function in SQL Server to auto-generate your surrogate PRIMARY KEY, and you insert Stuart Ainsworth into your table of Employees, and you accidentally run your INSERT script again, you’ve just double-inserted Stuart Ainsworth.&nbsp; While there are certainly multiple people with my name, I’m the only one at my company.&nbsp; However, my application never noticed it.</p>
<p>Using a UNIQUE CONSTRAINT on the columns holding the natural key information avoids this problem; you get the benefits of a surrogate key AND the unique validation of a natural primary key.&nbsp;&nbsp; The hard part is, of course, identifying the appropriate natural primary key to enforce.&nbsp; However, this exercise should NOT be overlooked when designing a database.</p>
]]></content:encoded>
			<wfw:commentRss>http://codegumbo.com/index.php/2009/10/22/good-habits-to-adopt-enforcing-the-natural-primary-key/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

