<?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>Schauderhaft &#187; Uncategorized</title>
	<atom:link href="http://blog.schauderhaft.de/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.schauderhaft.de</link>
	<description>Softwaredevelopment, Projectmanagement, Qualitymanagement and all things &#34;schauderhaft&#34;</description>
	<lastBuildDate>Sun, 25 Jul 2010 14:04:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>When is Elaborate Project Plannng Appropriate?</title>
		<link>http://blog.schauderhaft.de/2010/04/04/when-is-elaborate-project-plannng-appropriate/</link>
		<comments>http://blog.schauderhaft.de/2010/04/04/when-is-elaborate-project-plannng-appropriate/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 11:02:07 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plan]]></category>
		<category><![CDATA[project management]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=453</guid>
		<description><![CDATA[I got varying reactions on my last post. Some thought the story about making coffee using an extremely detailed plan was funny.  For example Fabio Akita wrote:
&#8220;Planning is the death of any project&#8221; http://bit.ly/bFYkAW Just an entertainment story, but fun nonetheless
I&#8217;m certainly proud to produce something that is considered fun. Yet my little story actually [...]]]></description>
			<content:encoded><![CDATA[<p>I got varying reactions on my <a href="/2010/03/28/planning-is-the-death-of-any-project/">last post</a>. Some thought the story about making coffee using an extremely detailed plan was funny.  For example <a href="http://twitter.com/AkitaOnRails/status/11310354766">Fabio Akita wrote</a>:</p>
<blockquote><p>&#8220;Planning is the death of any project&#8221; http://bit.ly/bFYkAW Just an entertainment story, but fun nonetheless</p></blockquote>
<p>I&#8217;m certainly proud to produce something that is considered fun. Yet my little story actually has some serious background. Of course the simple task of making coffee doesn&#8217;t justify elaborate project planning. But which task does? As we have seen, simple tasks don&#8217;t.</p>
<p>So how about complex tasks? Tasks that depend on circumstances in many ways, like e.g. balancing a stick on a finger, or playing table tennis. It would surely simplify the task, if we knew exactly when to make which movement. But we can&#8217;t plan this kind of thing, because the tiniest deviation from the intendend movement at some point in time will greatly change the required action some time later.</p>
<p>The coach teaching me project management had a great example of a project needing very accurate planning: When you build a nuclear reactor, the core will get encapsulated in a huge steel chamber. There are only very few cranes huge enough to move this thing. And they need a rail track to get to the building site, as well as a foundation for the crane to stand on. Rent of this crane is expensive as hell and you have to fix the dates years in advance. Everything that was needed for this crane and the needed structure, was planned with great care, to make sure everything was in place.</p>
<p>Few of us build nuclear reactors. For all others check these rules as a guide for the amount of planning justified:</p>
<ul>
<li>How plannable is it anyway? Don&#8217;t try to plan the unplannable. Get it out of the way instead. This is what many agile approaches do, when they implement the most risky stuff first.</li>
<li>Do you have fixed dependencies between tasks? A plan becomes more helpfull, when you have many dependencies between tasks, possible with long ramp up or preperation time. As with the crane: The task of moving the steel shell wasn&#8217;t  very long, but the preperation had to start years ahead. Without a plan it gets easy to kill a deadline long before it comes into sight.</li>
<li>What is the damage done, when you don&#8217;t stick to the plan. In some projects, the only damage done is that somebody has to adjust all the plans. In that case, you might just as well scrap the plan.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2010/04/04/when-is-elaborate-project-plannng-appropriate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>You should Provide a Service, not a Defense</title>
		<link>http://blog.schauderhaft.de/2010/03/07/providing-service-not-defense/</link>
		<comments>http://blog.schauderhaft.de/2010/03/07/providing-service-not-defense/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 05:42:54 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[The Rest]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=428</guid>
		<description><![CDATA[Let’s assume you are manager (or just part of) a small department. The task of the department is to make sure that everybody in the company is using Grglwup for wumpeling and does so in the correct way. What do you do to achieve that?
The approach I see most of the times lets me wonder, [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_437" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.schauderhaft.de/wp-content/uploads/2010/03/1121648_24685858.jpg"><img class="size-medium wp-image-437" title="1121648_24685858" src="http://blog.schauderhaft.de/wp-content/uploads/2010/03/1121648_24685858-300x184.jpg" alt="A row of cannon" width="300" height="184" /></a><p class="wp-caption-text">Cannon</p></div>
<p>Let’s assume you are manager (or just part of) a small department. The task of the department is to make sure that everybody in the company is using Grglwup for wumpeling and does so in the correct way. What do you do to achieve that?</p>
<p>The approach I see most of the times lets me wonder, if companies are run by Vogons. It looks like this.</p>
<p>A document is written describing the process for wumpeling by use of Grglwup in great detail. It gets published on a newly created website, which nobody knows about.</p>
<p>A 23 step process is put up defining how to get Grglwup, how to get a license for it and who is allowed to use it. It describes the 5 forms 7 signatures and 3 trainings you need, but it lacks any reason, why it is a good idea to us Grglwup instead of Open G which you could download and use for free and which is so easy to use, that anybody will be done with the task of wumpeling within 5 minutes.</p>
<p>Of course nobody adheres to that process. So an evaluation if wumpeling is needed and a 5 day consulting with the fixed result of advising to use Grglwup are made a required and expensive part of every project.</p>
<p>That was easy right? Now nobody can do any wumpeling without Grglwup as desired. At a side effect your department grew by a factor of 5 in order to handle all the consulting. Oh, and the cost of every project increased by about 10.000Euro for the consulting and getting through the whole process. Therefore people will hate you and your department.</p>
<p>I propose a different approach.</p>
<p>Find out why Grglwup must be used. If it is a valid reason, make sure everybody at least in your department understands it. If there aren’t valid reasons, fight the requirement.</p>
<p>Everything else is about making work with Grglwup a pleasure:</p>
<p>Write easy to use and fun to read documentation for it. Prefer a wiki as a platform so everybody can improve on it.</p>
<p>Make sure that that page shows up whenever anybody is searching for Grglwup, wumpeling or Open G on your intranet.</p>
<p>Offer free training for use of Grglwup.</p>
<p>Make the question: “What else can we do to make working with Grglwup easier?” part of every contact with a user.</p>
<p>Make sure that you reply to those that answer the question. Actually reply twice: First to confirm that you received the answer and then when you actually provide something.</p>
<p>You probably would like to have a single way uses address your team with questions about Grglwup. Still you should accept any way of communication: e-Mail, fax, phone or whatever. Don’t make them use your preferred tool. Of course you are free to funnel communication inside your department into a single tool.</p>
<p>Make sure everybody who might need to do some wumpeling, knows about you and your department.</p>
<p>If you succeed in this, everybody use Grglwup because it is the easy, the obvious thing to do.</p>
<p>Of course all this will cost money, just as the first approach. But you can’t charge the users for that. They aren’t the ones that want to use Grglwup. The company wants. So the company should pay for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2010/03/07/providing-service-not-defense/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Careers for Developers</title>
		<link>http://blog.schauderhaft.de/2010/02/28/areers-for-developers/</link>
		<comments>http://blog.schauderhaft.de/2010/02/28/areers-for-developers/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 21:27:34 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[developer]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=432</guid>
		<description><![CDATA[Many developers try to get into (project)management. That is ok I guess. But what bothers me is, that many developers do that without actually wanting to be managers. It&#8217;s just that they want to make some progress and the only career option available is to get into management and manage larger and larger teams, or [...]]]></description>
			<content:encoded><![CDATA[<p>Many developers try to get into (project)management. That is ok I guess. But what bothers me is, that many developers do that without actually wanting to be managers. It&#8217;s just that they want to make some progress and the only career option available is to get into management and manage larger and larger teams, or leave the company to work somewhere else.</p>
<p>I can only speculate why this is so. Maybe managers can&#8217;t think of alternative career paths? Well, I think I can help with that. Here are a couple of things developers might consider a step up on the career ladder.</p>
<p><strong>Trainer</strong>: Many of the better developers I know, love to teach their knowledge to others.</p>
<p><strong>Mentor</strong>: While a trainer will do workshops, a mentor will work together with a single coworker, or a small group, to pass on his knowledge. It is a lot of work, a lot of responsibility but very satisfying when the student comes back to the mentor after sometimes with something like &#8220;I learned a lot in the time with you as my mentor.&#8221;</p>
<p><strong>Firefighter</strong>: Send a fire fighter into projects which have problems. The firefighter moves in, puts out the fire and moves one to the next project/fire. It makes a job extremely interesting but also stressful.</p>
<p><strong>Technical Teamlead / Software Designer / Architect</strong>: Whatever these people get called at your place, they have a larger than average saying on what tools, what technologies get used and how.</p>
<p><strong>Researcher</strong>: The guy evaluating the new languages, the new tools before anybody else gets to use them.</p>
<p><strong>Prophet</strong>: While the researcher evaluates what can be done today, the prophet tries to see in the future, evaluates all the hip stuff in order to separate the hype from the good stuff.</p>
<p>Don&#8217;t get me wrong, nobody should print business cards with these titles on. But managers should make sure the developers who should do these things know about it, get the appropriate resources. And they should make sure that these tasks a only put in the hand of the best people.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2010/02/28/areers-for-developers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>More on JUnit Theories</title>
		<link>http://blog.schauderhaft.de/2010/02/07/junit-theories/</link>
		<comments>http://blog.schauderhaft.de/2010/02/07/junit-theories/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 13:02:21 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=404</guid>
		<description><![CDATA[In my last blog post, I described how to use JUnit Theories to create large amounts of test runs, with very limited amount of work, like so:

import static org.junit.Assume.assumeTrue;


@RunWith&#40;Theories.class&#41;


public class TheorieTest &#123;


&#160;


&#160;@DataPoint


&#160;public static String a = &#34;a&#34;;


&#160;


&#160;@DataPoint


&#160;public static String b = &#34;bb&#34;;


&#160;


&#160;@DataPoint


&#160;public static String c = &#34;ccc&#34;;


&#160;


&#160;@Theory


&#160;public void stringTest&#40;String x, String y&#41; &#123;


&#160; assumeTrue&#40;x.length&#40;&#41; &#38;gt; [...]]]></description>
			<content:encoded><![CDATA[<p>In my last <a href="/2010/01/31/new-feature-of-junit-theories/">blog post</a>, I described how to use JUnit Theories to create large amounts of test runs, with very limited amount of work, like so:</p>
<div class="geshi no java">
<div class="head">import static org.junit.Assume.assumeTrue;</div>
<ol>
<li class="li1">
<div class="de1">@RunWith<span class="br0">&#40;</span>Theories.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> TheorieTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@DataPoint</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw2">static</span> <span class="kw3">String</span> a = <span class="st0">&quot;a&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@DataPoint</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw2">static</span> <span class="kw3">String</span> b = <span class="st0">&quot;bb&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@DataPoint</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw2">static</span> <span class="kw3">String</span> c = <span class="st0">&quot;ccc&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Theory</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> stringTest<span class="br0">&#40;</span><span class="kw3">String</span> x, <span class="kw3">String</span> y<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; assumeTrue<span class="br0">&#40;</span>x.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">&amp;</span>gt<span class="sy0">;</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">println</span><span class="br0">&#40;</span>x + <span class="st0">&quot; &quot;</span> + y<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>The trick is simple to provide data points for every parameter type of the test method. The JUnit Theories Runner will call the test method with every possible combination of datapoints. If you think a little about it you will soon realize some of the limitations of this approach:</p>
<ul>
<li>You&#8217;ll soon end up with lots of data point fields cluttering your code</li>
<li>Parameters of the same type will receive the same set of parameters, even when the usable range of inputs is completely different.</li>
</ul>
<p>Fortunately the developers of JUnit provided really nice solutions to these problems.</p>
<p>Instead of specifying single data points, you can provide a full array of datapoints using the <tt>@Datapoints</tt> annotation, like so (add imports for good measure):</p>
<div class="geshi no java">
<ol>
<li class="li1">
<div class="de1">@RunWith<span class="br0">&#40;</span>Theories.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> TheorieTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@DataPoints</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw2">static</span> <span class="kw3">String</span><span class="br0">&#91;</span><span class="br0">&#93;</span> a = <span class="br0">&#123;</span> <span class="st0">&quot;a&quot;</span>, <span class="st0">&quot;bb&quot;</span>, <span class="st0">&quot;ccc&quot;</span> <span class="br0">&#125;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@DataPoints</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw2">static</span> <span class="kw3">Integer</span><span class="br0">&#91;</span><span class="br0">&#93;</span> j = <span class="br0">&#123;</span> <span class="nu0">1</span>, <span class="nu0">2</span>, <span class="nu0">3</span> <span class="br0">&#125;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Theory</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> someTest<span class="br0">&#40;</span><span class="kw3">String</span> x, <span class="kw3">Integer</span> y<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; assumeTrue<span class="br0">&#40;</span>x.<span class="me1">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">println</span><span class="br0">&#40;</span>x + <span class="st0">&quot; &quot;</span> + y<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>This of course is much less verbose. Instead of an array you may provide a method returning an array, or at least it looks like this should be possible. But when I tried it JUnit seemed unable to handle the types correctly resulting in IllegalArgumentExceptions. Guess I&#8217;ll have to file a bug when finished with this article &#8230; </p>
<p>But we still need to take care of parameters which have the same type, but very different meaning and therefore different useful values. The clean OO way of doing things would be to get rid of the generic types like <tt>String</tt> and use stronger types like <tt>CreditCardNumber</tt> or <tt>Name</tt> instead. But then in a perfect world we wouldn&#8217;t need tests, because our programs wouldn&#8217;t contain any bugs to begin with. So lets try this instead (Again imports omitted):</p>
<div class="geshi no java">
<ol>
<li class="li1">
<div class="de1">@Retention<span class="br0">&#40;</span>RetentionPolicy.<span class="me1">RUNTIME</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">@ParametersSuppliedBy<span class="br0">&#40;</span>CreditCardSupplier.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> @<span class="kw2">interface</span> AllCreditCards <span class="br0">&#123;</span><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">@Retention<span class="br0">&#40;</span>RetentionPolicy.<span class="me1">RUNTIME</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">@ParametersSuppliedBy<span class="br0">&#40;</span>NameSupplier.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> @<span class="kw2">interface</span> AllNames <span class="br0">&#123;</span><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> CreditCardSupplier <span class="kw2">extends</span> ParameterSupplier <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> List<span class="sy0">&lt;</span>PotentialAssignment<span class="sy0">&gt;</span> getValueSources<span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;ParameterSignature signature<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; ArrayList<span class="sy0">&lt;</span>PotentialAssignment<span class="sy0">&gt;</span> result = <span class="kw2">new</span> ArrayList<span class="sy0">&lt;</span>PotentialAssignment<span class="sy0">&gt;</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Amex&quot;</span>, <span class="st0">&quot;Amex&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Master&quot;</span>, <span class="st0">&quot;Master&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Visa&quot;</span>, <span class="st0">&quot;Visa&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">return</span> result<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> NameSupplier <span class="kw2">extends</span> ParameterSupplier <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> List<span class="sy0">&lt;</span>PotentialAssignment<span class="sy0">&gt;</span> getValueSources<span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;ParameterSignature signature<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; AllNames annotation = signature.<span class="me1">getAnnotation</span><span class="br0">&#40;</span>AllNames.<span class="kw2">class</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">println</span><span class="br0">&#40;</span><span class="st0">&quot;just wanted to show that I can access it &quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; + annotation<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; ArrayList<span class="sy0">&lt;</span>PotentialAssignment<span class="sy0">&gt;</span> result = <span class="kw2">new</span> ArrayList<span class="sy0">&lt;</span>PotentialAssignment<span class="sy0">&gt;</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Alf&quot;</span>, <span class="st0">&quot;Alf&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Willie&quot;</span>, <span class="st0">&quot;Willie&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Tanner&quot;</span>, <span class="st0">&quot;Tanner&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; result.<span class="me1">add</span><span class="br0">&#40;</span>PotentialAssignment.<span class="me1">forValue</span><span class="br0">&#40;</span><span class="st0">&quot;Cat&quot;</span>, <span class="st0">&quot;Cat&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">return</span> result<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">@RunWith<span class="br0">&#40;</span>Theories.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> SuppliedByTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Theory</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> imagineThisIsATest<span class="br0">&#40;</span>@AllCreditCards <span class="kw3">String</span> x, @AllNames <span class="kw3">String</span> y<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">println</span><span class="br0">&#40;</span><span class="st0">&quot;consider &quot;</span> + x + <span class="st0">&quot; / &quot;</span> + y + <span class="st0">&quot; tested.&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Theory</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> testIntegers<span class="br0">&#40;</span>@TestedOn<span class="br0">&#40;</span>ints = <span class="br0">&#123;</span> <span class="nu0">2</span>, <span class="nu0">3</span>, <span class="nu0">4</span>, <span class="nu0">7</span>, <span class="nu0">13</span>, <span class="nu0">23</span>, <span class="nu0">42</span> <span class="br0">&#125;</span><span class="br0">&#41;</span> <span class="kw4">int</span> i<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">System</span>.<span class="me1">out</span>.<span class="me1">println</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Wow, thats a lot of code. Just look at the last piece and see what appears in the console when we run it:</p>
<pre>
just wanted to show that I can access it @de.schauderhaft.junit.theories.AllNames()
consider Amex / Alf tested.
consider Amex / Willie tested.
consider Amex / Tanner tested.
consider Amex / Cat tested.
just wanted to show that I can access it @de.schauderhaft.junit.theories.AllNames()
consider Master / Alf tested.
consider Master / Willie tested.
consider Master / Tanner tested.
consider Master / Cat tested.
just wanted to show that I can access it @de.schauderhaft.junit.theories.AllNames()
consider Visa / Alf tested.
consider Visa / Willie tested.
consider Visa / Tanner tested.
consider Visa / Cat tested.
2
3
4
7
13
23
42
</pre>
<p>Have a look at the row beginning with: &#8220;consider&#8221;. Obviously the Theory <tt>imagineThisIsATest</tt> gets fed with the values from the <tt>CreditCardSupplier</tt> and <tt>NameSupplier</tt>. The parameters and the &#8216;Suppliers&#8217; are connected by the two annotations <tt>@AllNames</tt> and <tt>AllCreditCards</tt>. So whenever you have a parameter to a theory where the type alone is not sufficient for identifying the kind of values that should get used, you can simple create an annotation, which itself is annotated with a reference to a <tt>ParameterSupplier</tt> class and you are all set. You might think this is a lot of code for supplying a handful of parameters. You are right, but remember, that you can reuse your suppliers wherever you need names or credit card values in your tests. </p>
<p>Now let&#8217;s look at the first line of the output:<br />
<tt>just wanted to show that I can access it @de.schauderhaft.junit.theories.AllNames()</tt><br />
It simply shows of that you get access to the annotation (and actually the signature of the compete test method. This can be very useful, when you want your supplier to behave differently for different theories. Have a look at the <tt>NameSupplier</tt> above to see how this works.</p>
<p>JUnit actually comes with an example where this is used, and I demonstrated it with the other theory in the demonstration code above. The <tt>@TestedOn</tt> annotation takes an array of values to be used as data points for the annotated parameter.</p>
<p>Thats it for today. I hope the power of theories became obvious, as well as the power you have as a developer to extend that mechanism. Again be warned: All this nice stuff is in a package named experimental for good reason. If you use it, you might find bugs, and thing will likely change at least in name in an upcoming version. Taking about versions, I am using junit4.8.1 for the examples.</p>
<p>For next week the conclusion of the little series about JUnit theories is planned, with a few thoughts on use and danger of this kind of testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2010/02/07/junit-theories/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Mixins, Inheritance and Delegation</title>
		<link>http://blog.schauderhaft.de/2010/01/24/mixin-inheritance-delegation/</link>
		<comments>http://blog.schauderhaft.de/2010/01/24/mixin-inheritance-delegation/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 11:27:49 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[delegate]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mixin]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[trait]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=385</guid>
		<description><![CDATA[A week ago I started learning Scala. One of the features I found pretty interesting are mixins and traits. That was just the point of time, when I read this little tweet of GeekyL:
&#8220;i am still not sure if mixins are super cool or dark magic.&#8221;
Of course I was instantly reminded of the time when [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_391" class="wp-caption alignright" style="width: 310px"><a href="http://blog.schauderhaft.de/wp-content/uploads/2010/01/962589_79025341x.jpg"><img class="size-medium wp-image-391" title="962589_79025341x" src="http://blog.schauderhaft.de/wp-content/uploads/2010/01/962589_79025341x-300x299.jpg" alt="Blender" width="300" height="299" /></a><p class="wp-caption-text">Blender</p></div>
<p>A week ago I started learning <a href="http://www.scala-lang.org/">Scala</a>. One of the features I found pretty interesting are <a href="http://www.scala-lang.org/node/117">mixins and traits</a>. That was just the point of time, when I read this little <a href="http://twitter.com/GeekyL/status/8037135496">tweet</a> of <a href="http://twitter.com/GeekyL">GeekyL</a>:</p>
<p>&#8220;i am still not sure if mixins are super cool or dark magic.&#8221;</p>
<p>Of course I was instantly reminded of the time when the dinosaurs dominated the world and I was learning the first little bits of OO and C++. I thought inheritance and polymorphism was great and the solution for every possible programming problem there is. It turned out that was not the case. Actually inheritance can result in pretty ugly code.</p>
<p>So GeekyL&#8217;s tweet got me thinking: Do mixins have the same problem? What exactly are the problems with inheritance anyway? Time for a new blog post.</p>
<p><strong>What are the problems of inheritance?</strong></p>
<p><strong>Inheritance for code reuse</strong>: It is tempting to have a class inherit from a superclass just because the superclass has some useful feature. Like this.</p>
<div class="geshi no java">
<div class="head">import java.beans.PropertyChangeSupport;</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> PropertySupport <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">protected</span> <span class="kw3">PropertyChangeSupport</span> propSup<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> UserEntity <span class="kw2">extends</span> PropertySupport <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">private</span> <span class="kw3">String</span> firstName<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> setFirstName<span class="br0">&#40;</span><span class="kw3">String</span> aFirstName<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">String</span> oldValue = firstName<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; firstName = aFirstName<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; propSup.<span class="me1">firePropertyChange</span><span class="br0">&#40;</span><span class="st0">&quot;firstName&quot;</span>, oldValue, firstName<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>The problem with such code is that inheritance suggests a is-a-relationship, which in this case is just wrong. A UserEntity is not a PropertySupport, it just uses one.</p>
<p><strong>Multiple inheritance</strong>: At least in java a class can only inherit from one superclass. But many classes are many things. For example, a Cat is a Carnivor, it is a FourLeggedAnimal and a FurryAnimal. Without multiple inheritance there is just no way how to model this with class inheritance. With multple inheritance you can extend all these classes at the same time, but now you inherit the top class Animal three times, which at least is ugly.</p>
<p>So the proper way to do this kind of stuff in java is to use delegation and interfaces:</p>
<div class="geshi no java">
<div class="head">public class Cat implements Furry, FourLegged {</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;FurryDelegate fd<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;FourLeggedDelegate fld<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> pet<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; fd.<span class="me1">pet</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;@Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw2">public</span> <span class="kw4">void</span> runFast<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; fld.<span class="me1">runFast</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Which works in the sense that you can pretty much express the kind of things you need to do, and which you might be tempted to solve with class inheritance. Of course the draw back is that you&#8217;ll have to create all theses trivial delegate methods.</p>
<p>In Scala you have the option to use Traits. Like so</p>
<div class="geshi no scala">
<div class="head">class Animal</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">class Cat extends Animal with Furry with FourLegs{
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">trait Furry{
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;def pet() {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; println(&quot;purrrrr&quot;)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;}
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">trait FourLegs{
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;def runFast() {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; println(&quot;I&#39;m gone&quot;)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;}
</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>Obviously this contains much less code duplication then the java version. Does it have drawbacks? You bet.</p>
<p>Mixins are firmly tied to the traits they use. Imagine a more complex trait, which itself uses many other clases and resources. Once you mix in such a trait you have a strong dependency. Therefor I suggest the following pattern for getting the reduction of code duplication from traits and the flexibility of delegates: Use Traits, which don&#8217;t have a real implementation, but use a delegate for doing all the real stuff, this way you can switch the implementation with touching just a single place:</p>
<div class="geshi no scala">
<div class="head">class Superclass</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">class Mixin extends Superclass with Trait {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; // &#8230; more stuff goes here
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">trait Trait {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; val delegate = new TraitImpl // this should be some kind of DI or lookup in a real system
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; def aMethod() {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; delegate.aMethod()
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">class TraitImpl extends Trait {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; override def aMethod(){
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; println(&quot;you just called me&quot;)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>Summary: Traits can be used to solve some of the problems of inheritance, but they might introduce strong coupling, which you can easily be avoided.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2010/01/24/mixin-inheritance-delegation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Naming Strategy for Hibernate Released as a proper Open Source Project</title>
		<link>http://blog.schauderhaft.de/2009/03/07/oracle-naming-strategy-for-hibernate-released-as-a-proper-open-source-project/</link>
		<comments>http://blog.schauderhaft.de/2009/03/07/oracle-naming-strategy-for-hibernate-released-as-a-proper-open-source-project/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 20:21:13 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Datenbank]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Softwareentwicklung]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/2009/03/07/oracle-naming-strategy-for-hibernate-released-as-a-proper-open-source-project/</guid>
		<description><![CDATA[I am a big fan of creating at least the basic structure of your database from the domain model using hibernate. But if you work with Oracle you know on problem with this approach: the length of names is seriously limited for tables and columns. So if you have a  inner class with embeddables you [...]]]></description>
			<content:encoded><![CDATA[<p>I am a big <a href="/2008/11/27/why-hibernate-is-so-much-more-powerful-than-jdbc/">fan of creating at least the basic structure of your database from the domain model using hibernate</a>. But if you work with <a href="http://www.oracle.com">Oracle</a> you know on problem with this approach: the length of names is seriously limited for tables and columns. So if you have a  inner class with embeddables you pretty soon bump against that limit of 30 characters.</p>
<p>I published before an <a href="/2008/02/22/hibernate-namingstrategy-fur-oracle/">OracleNamingStrategy</a> that fixes this problem by creating abbreviations on this blog. But writing a <a href="/2008/03/29/hibernate-naming-strategie-fur-oracle-die-zweite/">new blog entry</a> with all the code every time I find a little glitch in the code felt just wrong. So I published it as an official Open Source Project over at <a href="http://code.google.com/">google code</a>: <a href="http://code.google.com/p/hibernate-naming-strategy-for-oracle/">The Hibernate Naming Strategy for Oracle!</a> And I just released the first version. and since it is so extremely simple, it isn&#8217;t even a jar but a <a href="http://code.google.com/p/hibernate-naming-strategy-for-oracle/downloads/list">single java file</a>.</p>
<p>I&#8217;d be glad if this is of some use for other developers. If you like it, drop me a line in the comments. If you find a bug or have an idea for improvement use the <a href="http://code.google.com/p/hibernate-naming-strategy-for-oracle/issues/list">issue tracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2009/03/07/oracle-naming-strategy-for-hibernate-released-as-a-proper-open-source-project/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Applying Rules of Graphical Design to Judge the Beauty of Code</title>
		<link>http://blog.schauderhaft.de/2009/01/24/applying-rules-of-graphical-design-to-judge-the-beauty-of-code/</link>
		<comments>http://blog.schauderhaft.de/2009/01/24/applying-rules-of-graphical-design-to-judge-the-beauty-of-code/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 20:23:12 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/2009/01/24/applying-rules-of-graphical-design-to-judge-the-beauty-of-code/</guid>
		<description><![CDATA[You probably know this feeling: You take a look at somebody’s code and immediately think “Oh my god this is ugly” More seldom, yet it also happens that you think “man this looks nice” even before you have the slightest idea of what the code is all about.
I hereby claim that the chance of your [...]]]></description>
			<content:encoded><![CDATA[<p>You probably know this feeling: You take a look at somebody’s code and immediately think “Oh my god this is ugly” More seldom, yet it also happens that you think “man this looks nice” even before you have the slightest idea of what the code is all about.</p>
<p>I hereby claim that the chance of your code being beautiful rises when you apply four principles which origin from graphical design. And with beautiful I’m not referring to some pure aesthetic value but the attribute that is considered an important aspect when judging quality especially maintainability of code.</p>
<p>So here are the four principles:</p>
<h2>Contrast</h2>
<p>In graphical design contrast is often achieved by using different font, size or color. Contrast is used to add emphasis on the really important part of a document or a work of art. But how can we add contrast to source code? For one it is done by our IDE or editor, by setting key words in a bold typeface, using a different color for text literals and so on. If you are ever forced to switch from your preferred IDE or rich editor to a simple tool like notepad you’ll see what you miss.<br />
But even without the magic of an IDE you can and should profit from using contrast in your code. Most coding conventions go into great detail about adding contrast to code. CONSTANTS are all caps. Classes and Interfaces begin with capitals, methods, variables and fields begin with small letters.<br />
Another way to add contrast is with comments. Who hasn’t used a comment like this?</p>
<p><code><br />
/*********************************<br />
DON’T DO X OR Y WILL HAPPEN<br />
*********************************/<br />
</code></p>
<p>It’s all about contrast and most developers use it pretty reasonably in my experience.<br />
Also if your method spans 50 lines, everything gets lost in the noise. There is just no contrast. The header of a method does add contrast.</p>
<h2>Repetition</h2>
<p>In graphical design this refers to repeating graphical elements to convey a feeling of cohesion. In software development repetition comes in the form of code conventions. Do your factory classes have the suffix “Factory”? Has the single instance of a singleton always the same name? While I haven’t found a group of more the one developer that could agree on a code convention without discussion, everybody always agreed on the value of code conventions.  Of course Repetition should not be an excuse to use cut’n’paste! The DRY principle still applies.</p>
<h2>Alignment</h2>
<p>Alignment gives a clean structure to a graphical design. And it does the same for source code. Again you can apply it on various levels. It starts on the code convention level on indenting your code following simple rules. It applies on the method level as well. Do you have six nested if statements? The reader will have problems to identify the alignment and to understand your code. Or you can apply it on the package level. Has your package structure about the same depth every where? Or have 90% of your packages no subpackage at all but the remaining 10 percent have a subpackage structure 5 levels deep?</p>
<h2>Proximity</h2>
<p>The principle of proximity simple means: put those things together  that belong together. And once more this can be applied on various levels in software development.<br />
A package, class or method should have exactly one purpose thus putting the stuff need for this purpose inside (close together) and everything else separate. Often you have to prepare two or more objects, before putting them together. In such a case please honor the principle of proximity and put first the code for preparing the first object, then prepare the second object and so on. Don’t mix it together in some random order.<br />
So go ahead write beautiful code.</p>
<p>The original idea of applying these rules to source code comes from a colleague and he told me only briefly about it on a Christmas party.  But the details are from my own sick mind, so I am curious if he or any of the readers has some more ideas on applying graphical design principles to source code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2009/01/24/applying-rules-of-graphical-design-to-judge-the-beauty-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ohne weitere Worte</title>
		<link>http://blog.schauderhaft.de/2008/12/06/ohne-weitere-worte/</link>
		<comments>http://blog.schauderhaft.de/2008/12/06/ohne-weitere-worte/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 21:20:36 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/2008/12/06/ohne-weitere-worte/</guid>
		<description><![CDATA[James Nachtwey: TED Prize wish: Share a vital story with the world
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ted.com/index.php/talks/james_nachtwey_s_searing_pictures_of_war.html"><span>James Nachtwey: TED Prize wish: Share a vital story with the world</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2008/12/06/ohne-weitere-worte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netzplantechnik, so nicht!</title>
		<link>http://blog.schauderhaft.de/2008/07/31/netzplantechnik-so-nicht/</link>
		<comments>http://blog.schauderhaft.de/2008/07/31/netzplantechnik-so-nicht/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 17:35:03 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/2008/07/31/netzplantechnik-so-nicht/</guid>
		<description><![CDATA[Heather O&#8217;Cull erklärt in ihrem jüngsten Artikel die Funktionsweise von Abhängigkeiten in MS-Project, bzw. allgemein in der Netzplantechnik. Leider unterläuft ihr bei der Auswahl der Beispiele einen klassischen Fehler: Statt wirklich tatsächliche Einschränkungen mit den Abhängigkeiten abzubilden, benutzt sie in den Beispielen Abhängigkeiten um eine Planung, die sie im Kopf hat in MS-Project abzubilden. Und [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/user/Profile.aspx?UserID=31118" id="ctl00___ctl00___ctl02___Entry___AuthorLink">Heather O&#8217;Cull</a> erklärt in ihrem jüngsten Artikel die Funktionsweise von <a href="http://blogs.msdn.com/project/archive/2008/07/29/back-to-basics-understanding-task-dependencies.aspx">Abhängigkeiten in MS-Project</a>, bzw. allgemein in der Netzplantechnik. Leider unterläuft ihr bei der Auswahl der Beispiele einen klassischen Fehler: Statt wirklich tatsächliche Einschränkungen mit den Abhängigkeiten abzubilden, benutzt sie in den Beispielen Abhängigkeiten um eine Planung, die sie im Kopf hat in MS-Project abzubilden. Und so kommte es das sie eine Start-Start Beziehung zwischen den Vorgängen &#8216;Kuchen backen&#8217; und &#8216;Kuchenguß herstellen&#8217; einplant, da er den Kuchenguß machen möchte, während der Kuchen im Ofen backt. Es gibt aber keinen Grund, warum der Guß nicht schon vorher vorbereitet werden sollte, diese Beziehung ist also FALSCH.</p>
<p>Ein sinnvolles Beispiel für eine Start-Start Beziehung könnte eine Renovierungsaktion liefern. Vorgang A: spachteln der Wände, Vorgang B streichen der Wände. Mit dem Streichen der Wände kann man erst dann beginnen, wenn mit dem spachteln begonnen wurde. Die selben beiden Vorgänge haben auch eine Ende-Ende Beziehung, denn mit dem Streichen der Wände kann ich erst abschließen, wenn sie fertig gespachtelt sind. Zumindest kann also einer spachteln, während jemand anderes (oder der Gleiche mit der anderen Hand) die eben gespachtelte Fläche streicht.</p>
<p>Trotz allem Gemecker, wenn ihr euch mit MS-Project auseinandersetzt, werft ruhig mal einen Blick auf das <a href="http://blogs.msdn.com/project/default.aspx">MS-Project Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2008/07/31/netzplantechnik-so-nicht/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
