<?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</title>
	<atom:link href="http://blog.schauderhaft.de/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, 12 May 2013 04:41:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Dependency Antipatterns &#8211; Clotheslines</title>
		<link>http://blog.schauderhaft.de/2013/05/12/dependency-antipatterns-clotheslines/</link>
		<comments>http://blog.schauderhaft.de/2013/05/12/dependency-antipatterns-clotheslines/#comments</comments>
		<pubDate>Sun, 12 May 2013 04:41:16 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[anti pattern]]></category>
		<category><![CDATA[degraph]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[package dependencies]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1335</guid>
		<description><![CDATA[This is the third part in my little series about dependency anti-patterns. The first part was about the God Node, the second one about the Bypass Images and nomenclature are based on Degraph. When you have two slices with lots of parallel connections as in the image on the side, you found this patterns. Just [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://blog.schauderhaft.de/wp-content/uploads/2013/05/clothesLines.png"><img class="size-medium wp-image-1388 alignright" alt="clothesLines" src="http://blog.schauderhaft.de/wp-content/uploads/2013/05/clothesLines-106x300.png" width="106" height="300" /></a></p>
<p>This is the third part in my little series about dependency anti-patterns. The <a href="/2013/03/17/dependency-antipatterns-god-node/">first part was about the God Node</a>, the <a href="/2013/03/24/dependency-antipatterns-the-bypass/">second one about the Bypass</a></p>
<p>Images and <a href="https://github.com/schauder/degraph/wiki/Nomenclature">nomenclature</a> are based on <a href="https://github.com/schauder/degraph">Degraph</a>.</p>
<p>When you have two slices with lots of parallel connections as in the image on the side, you found this patterns. Just as with real clotheslines there might be some crossing in the lines, but the majority is parallel.</p>
<p>This kind of stuff happens when you split classes into packages (or larger slices) not by the domain they deal with, but by the pattern they implement. An example would be a set of entities and there matching DAOs. If you put all the entities in one package and all the DAOs in another you get exactly this pattern. It is an example of high coupling and low coehesion and in case you are wondering: Yes we normally strive for the opposite.</p>
<p>You want to avoid clotheslines because the affected nodes are couple so tightly together that you can&#8217;t really split them, so you might as well throw them in one bag. Which in turn might result in a giant node, you you don&#8217;t want either.</p>
<p>The good news is the situation is easy to improve. Just arrange the classes connected by clothesline into one package. Possibly on their own, and if they have cross connections with other pairs, together with those. You&#8217;ll end up with something that looks more like the image below: More dependencies inside a package, fewer between packages. Also known as high cohesion, low coupling.</p>
<p><a href="http://blog.schauderhaft.de/wp-content/uploads/2013/05/clothesLinesFixed.png"><img class="alignnone size-medium wp-image-1389" alt="clothesLinesFixed" src="http://blog.schauderhaft.de/wp-content/uploads/2013/05/clothesLinesFixed-300x151.png" width="300" height="151" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/05/12/dependency-antipatterns-clotheslines/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Java Application Architecture</title>
		<link>http://blog.schauderhaft.de/2013/03/31/pragkirk/</link>
		<comments>http://blog.schauderhaft.de/2013/03/31/pragkirk/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 13:10:58 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[The Rest]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[modular]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1367</guid>
		<description><![CDATA[At Devoxx last year I attended half a session by Kirk Knoernschild. I don&#8217;t know why I missed half the session, but I fixed that by listening to the full talk over at parleys (not sure if you can see the full talk with out registering). I found the talk intriguing for two reasons. First [...]]]></description>
				<content:encoded><![CDATA[<p>At Devoxx last year I attended half a session by Kirk Knoernschild. I don&#8217;t know why I missed half the session, but I fixed that by listening to <a href="http://parleys.com/#play/5148922b0364bc17fc56c8e7/chapter0/about">the full talk over at parleys</a> (not sure if you can see the full talk with out registering).</p>
<p>I found the talk intriguing for two reasons. First Kirk looks so much like me that I think I&#8217;m seeing me when ever I see a picture of him. It is really unnerving. The other, more important one: He is arguing a similar point as I am. </p>
<p>One of his main messages is: As a responsible developer or an architect you must take care of <strong>modules</strong> and their dependencies. </p>
<p>While my point is: you should take care of <strong>packages</strong> and their dependency structure.</p>
<p>So I went and bought his book &#8220;Java Application Architecture&#8221; in order to learn more about what he has to say. </p>
<p><a href="http://www.amazon.de/gp/product/B007KOGS5U/ref=as_li_ss_il?ie=UTF8&#038;camp=1638&#038;creative=19454&#038;creativeASIN=B007KOGS5U&#038;linkCode=as2&#038;tag=schauderhafte-21"><img border="0" src="http://ws.assoc-amazon.de/widgets/q?_encoding=UTF8&#038;ASIN=B007KOGS5U&#038;Format=_SL160_&#038;ID=AsinImage&#038;MarketPlace=DE&#038;ServiceVersion=20070822&#038;WS=1&#038;tag=schauderhafte-21" ></a><img src="http://www.assoc-amazon.de/e/ir?t=schauderhafte-21&#038;l=as2&#038;o=3&#038;a=B007KOGS5U" width="1" height="1" border="0" alt="Java Application Architecture by Kirk Knoernschild" style="border:none !important; margin:0px !important;" /></p>
<p>It turned out to be a book that every advanced developer or architect should read. A label that I haven&#8217;t attached to a book for quite some time. Why?</p>
<p>It covers the benefits and costs of a modular software architecture in great detail, something that I haven&#8217;t seen in another book. Other books describe how to write code on a very granular level, like methods, classes and patterns. Or they describe the large scale structures relevant in system architecture, but the middle ground of packages and modules gets ignored by most books I have seen so far.</p>
<p>After the general analysis of the effects of modularity, the middle part describes patterns of module dependencies. I personally found this part a little boring and repetitive, because I apply these kind of pattern for quite some time now. But I think it would be very helpful for others who want to apply the tool of modularization to their application.</p>
<p>In the last part Kirk describes how OSGI helps in achieving modularity and reaping the benefits of it. I found this part interesting again, because so far I&#8217;ve experienced OSGI only as a road block to productivity and this part together with the rest of the book explained how it actually could have helped me.</p>
<p>Of course the book isn&#8217;t perfect either. I think it is to repetitive, which made me skip some passages. Also the title is a little misleading, since it talks only about a very specific part of application architecture. But none of this should keep anybody from buying and reading this book.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/03/31/pragkirk/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Dependency Antipatterns &#8211; The Bypass</title>
		<link>http://blog.schauderhaft.de/2013/03/24/dependency-antipatterns-the-bypass/</link>
		<comments>http://blog.schauderhaft.de/2013/03/24/dependency-antipatterns-the-bypass/#comments</comments>
		<pubDate>Sun, 24 Mar 2013 15:21:45 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[anti pattern]]></category>
		<category><![CDATA[degraph]]></category>
		<category><![CDATA[dependency]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1336</guid>
		<description><![CDATA[This is the second part in my little series about dependency anti-patterns. The first part was about the God Node. Images and nomenclature are based on Degraph. As long as the affected nodes are collapsed the Bypass looks just like any circular dependency. But if you expand them something strange happens. In one node (A) [...]]]></description>
				<content:encoded><![CDATA[<p>This is the second part in my little series about dependency anti-patterns. The <a href="/2013/03/17/dependency-antipatterns-god-node/">first part was about the God Node</a>. Images and <a href="https://github.com/schauder/degraph/wiki/Nomenclature">nomenclature</a> are based on <a href="https://github.com/schauder/degraph">Degraph</a>.</p>
<p>As long as the affected nodes are collapsed the Bypass looks just like any circular dependency. </p>
<p><a href="http://blog.schauderhaft.de/wp-content/uploads/2013/03/bypassCollapsed.png"><img src="http://blog.schauderhaft.de/wp-content/uploads/2013/03/bypassCollapsed.png" alt="bypassCollapsed" width="254" height="114" class="alignnone size-full wp-image-1360" /></a></p>
<p>But if you expand them something strange happens. In one node (A) (the main road so to say) one part of the subnodes gets pushed to the left (A1), while the rest gets pushed to the right (A2). The A1 nodes depend on B (the actual bypass) and B depends on A2. Since all arrows still go from left to right it can get hard to spot the problem, when more nodes are involved. </p>
<p><a href="http://blog.schauderhaft.de/wp-content/uploads/2013/03/bypassExploded.png"><img src="http://blog.schauderhaft.de/wp-content/uploads/2013/03/bypassExploded.png" alt="bypassExploded" width="293" height="233" class="alignnone size-full wp-image-1359" /></a></p>
<p>I have seen this many times when someone attempted some kind of dependency injection, but didn&#8217;t complete it. Maybe B is a plugin like class implementing a feature for an application A. For this it implements some kind of plugin interface A2, so that A doesn&#8217;t actually need to know B. But something (A1) has to plug everything together, so it has to know A1 and B. That is ok, it just shouldn&#8217;t be in the same node as A2.</p>
<p>Which already gives a fix to this kind of problem: Move A1 (or A2) to its own node, basically splitting A in two pieces, voila you just got rid of a circular dependency. An alternative is to move A2 into B. The correct decision depends on the semantics of the nodes involved.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/03/24/dependency-antipatterns-the-bypass/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dependency Antipatterns &#8211; God Node</title>
		<link>http://blog.schauderhaft.de/2013/03/17/dependency-antipatterns-god-node/</link>
		<comments>http://blog.schauderhaft.de/2013/03/17/dependency-antipatterns-god-node/#comments</comments>
		<pubDate>Sun, 17 Mar 2013 09:44:28 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[anti pattern]]></category>
		<category><![CDATA[degraph]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1326</guid>
		<description><![CDATA[I wrote before about the dependency analysis and visualization tool Degraph. When you use such a tool to examine various projects you will find some patterns that stick out like a sore thumb. This is a first articles about  such antipatterns, including my interpretation of what is going wrong and how to fix it. I&#8217;m [...]]]></description>
				<content:encoded><![CDATA[<p><a href="/2013/02/24/introducing-degraph-for-visualizing-package-dependencies/">I wrote before</a> about the <a href="https://github.com/schauder/degraph">dependency analysis and visualization tool Degraph</a>. When you use such a tool to examine various projects you will find some patterns that stick out like a sore thumb. This is a first articles about  such antipatterns, including my interpretation of what is going wrong and how to fix it.</p>
<p>I&#8217;m using the somewhat abstract term <strong>node</strong>, which might refer to a class, a package or even to a <strong>slice</strong> that you define, bundling classes according to some rule that you see fit. If you are confused by the terminology you might have a look at the <a href="https://github.com/schauder/degraph/wiki/Nomenclature">wiki page for Degraph, where I try to explain these terms</a>.</p>
<p><strong>God Node</strong></p>
<p>When you see a node in a dependency diagram that has tons of in and outgoing connections, you are looking at the death rays emitting from a god node. It does a lot of important things, that&#8217;s why it depends on many other nodes. It also gets used by many things, which makes it even worse.</p>
<p><a href="http://blog.schauderhaft.de/wp-content/uploads/2013/03/godObject.png"><img class="alignnone size-medium wp-image-1351" alt="godObject" src="http://blog.schauderhaft.de/wp-content/uploads/2013/03/godObject-160x300.png" width="160" height="300" /></a></p>
<p>You want to extract stuff from that node! Why? Because when it does so many things and depends on so many things, it is very likely you</p>
<ol>
<li>can&#8217;t properly test it</li>
<li>have to change it very often</li>
<li>thereby over and over creating new bugs, that go undetected by your automatic tests.</li>
</ol>
<p>If this is a simple node, i.e. it doesn&#8217;t represent at least a package or a class with inner classes, may the god class have mercy with your soul. Do some refactoring of that monster, until you can extract some classes. Prefer to extract classes that encapsulate some of the dependencies to other class. This image show how this looks like with the a new class represented by an orange octagon.</p>
<p><img class="alignnone size-medium wp-image-1350" alt="godObjectDelegate" src="http://blog.schauderhaft.de/wp-content/uploads/2013/03/godObjectDelegate-197x300.png" width="197" height="300" /></p>
<p>An alternative start is to extract interfaces and make other parts of the application depend only on the interfaces. This will move remove some dependencies from the God Node and spread them among the new interface nodes, as sketched in the following image, with the introduced interfaces represented by orange octagons.</p>
<p><img class="alignnone size-medium wp-image-1349" alt="godObjectInterfaces" src="http://blog.schauderhaft.de/wp-content/uploads/2013/03/godObjectInterfaces-73x300.png" width="73" height="300" /></p>
<p>Note that</p>
<ol>
<li><span style="line-height: 13px;">Since the god node &#8216;implements&#8217; the interface nodes it depends on them, not the other way round</span></li>
<li>Some third node has to inject the implementation (the god node) into the clients so it will have dependencies to both. This is basically what I described in an earlier article about <a href="http://blog.schauderhaft.de/2011/07/17/breaking-dependency-cylces/">how to break dependency cycles</a>.</li>
</ol>
<p>If this is a compound node have a look inside. Often it already exhibits a structure of it own. Look at the upcoming posts about Dependency Antipatterns for stuff to look out for.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/03/17/dependency-antipatterns-god-node/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Introducing Degraph for Visualizing Package Dependencies</title>
		<link>http://blog.schauderhaft.de/2013/02/24/introducing-degraph-for-visualizing-package-dependencies/</link>
		<comments>http://blog.schauderhaft.de/2013/02/24/introducing-degraph-for-visualizing-package-dependencies/#comments</comments>
		<pubDate>Sun, 24 Feb 2013 06:29:32 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[degraph]]></category>
		<category><![CDATA[dependency graph]]></category>
		<category><![CDATA[dependency visualization]]></category>
		<category><![CDATA[package dependencies]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1312</guid>
		<description><![CDATA[I wrote before that I consider packages an important tool for structuring your code. I like to have a well defined package structure, where each and every package belongs to a set of slices, with a slice being either a domain module containing code dealing with a certain part of the domain (like, &#8216;shopping cart&#8217;, [...]]]></description>
				<content:encoded><![CDATA[<p>I wrote before that I consider <a href="/2013/01/13/the-importance-of-packages/">packages an important tool for structuring your code</a>. I like to have a well defined package structure, where</p>
<ul>
<li>each and every package belongs to a set of slices, with a slice being either a domain module containing code dealing with a certain part of the domain (like, &#8216;shopping cart&#8217;, &#8216;fulfillment&#8217;, &#8216;customer&#8217;) or a technical part of the application (&#8216;presentation&#8217;, &#8216;persistance&#8217;, &#8216;domain&#8217;)</li>
<li>all dependencies between packages and slices are free of cycles</li>
</ul>
<p>One problem with this set of rules is: Since dependencies aren&#8217;t readily visible in the code it is hard to maintain these rules. And once they are broken it is even harder to fix them.</p>
<p>In one project this lead to developers packing lots of stuff in a single package, because they didn&#8217;t know where to put new stuff without creating circles. Obviously that was not what we intended with the rules. But what do you do when faced with a package containing 170 classes and the task to break it (as a first step) in a set of smaller packages void of dependency cycles?</p>
<p>There are tools that tell you when you have dependency cycles. Most of the time they show you the problem as a <a href="http://erik.doernenburg.com/2010/04/dependency-structure-matrix/">dependency structure matrix</a>. Unfortunately it is really hard to identify a bunch of classes that you can pull out of a package in order to fix a dependency cycle. They tell you even less about which group of classes you can pull out of a package without creating new dependency cycles.</p>
<p>In order to fix this I created <strong><a href="https://github.com/schauder/degraph">Degraph</a></strong>.</p>
<p>Degraph analyses the dependencies of a bunch of class or jar files and creates a graph representation of it. In this graph it also groups classes into packages and if you want into slices. The result is written to disc as a <tt>graphml</tt> file. This file can then be opened with <a href="http://www.yworks.com/en/products_yed_helpresources.html">yed</a>, a free graph editor with strong layout capabilities.</p>
<p>The result looks like the following image (click for a larger version).</p>
<p><a href="http://blog.schauderhaft.de/wp-content/uploads/2013/02/selfTestBlogExample.png"><img class="alignnone size-medium wp-image-1313" alt="selfTestBlogExample" src="http://blog.schauderhaft.de/wp-content/uploads/2013/02/selfTestBlogExample-300x183.png" width="300" height="183" /></a></p>
<p>You can see packages as boxes containing classes. If the classes contain inner classes those are contained in the boxes representing the outer classes. What is not visible in the image is that you can open and collapse the boxes representing packages or classes with inner classes. This enables you to show that part of the dependencies that you actually care about.</p>
<p>If this sounds interesting to you give it a try. You can <a href="http://schauder.github.com/degraph/download/degraph-0.0.3.zip">download the current distribution</a> and install it by unzipping it (you&#8217;ll need a a properly installed JRE). You can find more instructions on <a href="https://github.com/schauder/degraph/wiki/Examples">how to use and configure Degraph in its wiki</a></p>
<p>Degraph is obviously at a very early stage of development, but it is still useful (and fun) if you want to have a look at the structure of your class dependencies. While it shows you the dependency and allows you to identify cycles visually, so far it doesn&#8217;t identify such cycles on its own. I&#8217;m currently working on adding that ability.</p>
<p>Probably next is the option to integrate Degraph in JUnit (or other) automated tests.</p>
<p>Beyond that I have tons of ideas (definition and test of allowed/disallowed dependencies, creation of <tt>dot</tt> files, interactive specialized ui, identification of dependencies to break, integration of spring file analysis ..) but this will obviously take some time. In the mean time: If you find a bug, have a problem or an idea for improvement, leave a comment or <a href="https://github.com/schauder/degraph/issues?state=open">open an issue</a>.</p>
<p>Updated: Since I released a new version of Degraph I updated the link for downloading the binary distribution.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/02/24/introducing-degraph-for-visualizing-package-dependencies/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Shu Ha Ri and Code Metrics</title>
		<link>http://blog.schauderhaft.de/2013/02/17/shu-ha-ri-and-code-metrics/</link>
		<comments>http://blog.schauderhaft.de/2013/02/17/shu-ha-ri-and-code-metrics/#comments</comments>
		<pubDate>Sun, 17 Feb 2013 11:37:56 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Quality Management]]></category>
		<category><![CDATA[code metrics]]></category>
		<category><![CDATA[code quality]]></category>
		<category><![CDATA[masterhip]]></category>
		<category><![CDATA[Shuhari]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1303</guid>
		<description><![CDATA[Code Metrics sure get mixed feelings by developers, especially when combined with thresholds to form checks that might make a CI build fail. Typical examples are: Line based code coverage  must not fall below 80%. A method must not be longer than 15 lines of code. Arguments against such rules state there are cases where [...]]]></description>
				<content:encoded><![CDATA[<p>Code Metrics sure get mixed feelings by developers, especially when combined with thresholds to form checks that might make a CI build fail. Typical examples are:</p>
<blockquote><p>Line based code coverage  must not fall below 80%.</p></blockquote>
<blockquote><p>A method must not be longer than 15 lines of code.</p></blockquote>
<p>Arguments against such rules state there are cases where such checks limit the freedom of a developer.<br />
During a discussion around these things it occurred to me that the metrics and checks come from a different skill level than the arguments against them.</p>
<p>Let me introduce <a href="http://en.wikipedia.org/wiki/Shuhari">Shuhari</a>: </p>
<p>Shuhari is a Japanese martial arts concept describing the stages of learning to mastery. </p>
<p>Shu describes the strict adherence to rules as one does when one begins to learn. This is where metrics live. They are strict rules. As a practitioner you just follow the rules without really thinking about them.</p>
<p>Ha describes the bending, changing and breaking of rules, as you might do when you are quite experienced.</p>
<p>Ri finally is described as transcendence, i.e. the rules don&#8217;t really have a meaning to a master on this level. She just knows what to do.</p>
<p>I think one can easily see how metrics get in the way of a master at the higher levels. Right? But there is an interesting point in the short  Wikipedia article for Shuhari:</p>
<blockquote><p>Shuhari can be considered as concentric circles, with Shu within Ha, and both Shu and Ha within Ri. The fundamental techniques and knowledge do not change.</p></blockquote>
<p>For me this means: While a master can and will break rules at will, most of the time she won&#8217;t because the rules align with what is the right thing to do &#8482;.</p>
<p>So if you think those code metrics are stupid and shouldn&#8217;t apply to your code, you are welcome to prove to me that you are a Ri level master (I&#8217;m certainly not). A first indicator would be that you can follow those rules without them actually being enforced.</p>
<p>But if you are constantly breaking builds due to Checkstyle, PMD and Sonar violations, you are not demonstrating mastership but sloppy working.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/02/17/shu-ha-ri-and-code-metrics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Who is Teaching Software Developers How to use a File</title>
		<link>http://blog.schauderhaft.de/2013/02/10/who-is-teaching-software-developers-how-to-use-a-file/</link>
		<comments>http://blog.schauderhaft.de/2013/02/10/who-is-teaching-software-developers-how-to-use-a-file/#comments</comments>
		<pubDate>Sun, 10 Feb 2013 03:46:31 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[software craftmanship]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1301</guid>
		<description><![CDATA[When I was about 14 I got a really interesting present from my uncle: A construction set for a ship. Not one of those plastic thingies that I often glued together in an hour at that time, but a wooden one, which meant I had to cut out every single piece with a saw, file [...]]]></description>
				<content:encoded><![CDATA[<p>When I was about 14 I got a really interesting present from my uncle: A construction set for a ship. Not one of those plastic thingies that I often glued together in an hour at that time, but a wooden one, which meant I had to cut out every single piece with a saw, file it until all the edges had exactly the right shape and then glue it together. This way attaching a single piece easily became half an hour or an hour of very concentrated work. I did this together with my uncle who learned in his youth the profession of a cartwright and is a perfectionist, so he knew how to do this right and wasn&#8217;t willing to accept anything less.</p>
<p>I learned a lot of stuff during my work on that ship model, but I remember one lesson especially well: How to use file.</p>
<p>You might think using a file can&#8217;t be that hard, but trust me you still need quite some advice and practice to do it well.</p>
<p>If you just use it without such practice, you will file of some wood.</p>
<p>The surface will become smooth.</p>
<p>But it won&#8217;t become straight.</p>
<p>And you won&#8217;t get perpendicular, sharp edges.</p>
<p>You might be able to replace the advice with more practice and maybe some books. But the advice will make progress much faster (and also more frustrating in the beginning because you&#8217;ll hear over and over again: &#8220;No, you are doing it wrong&#8221;).</p>
<p>So my question is who is teaching how to use a file to junior software developers? &#8220;File&#8221; doesn&#8217;t stand in for things like the usage of design patterns or practices like <a href="/2012/12/02/baby-steps-reverse-refactoring-and-dna/">Baby Steps</a>. I&#8217;m talking about very basic things that many people consider easy:</p>
<ul>
<li><span style="line-height: 13px;">Always start work with a fresh and clean checkout from version control.</span></li>
<li>What to do before checking in your code.</li>
<li><span style="line-height: 13px;">What to write into a commit comment.</span></li>
<li><span style="line-height: 13px;">How to write a bug report. </span></li>
<li>&#8230;</li>
</ul>
<p>Most developers learn this kind of stuff at some point in their career, but we as an industry waste a lot of time be forcing them to learn that really slowly. Most teams I have seen do discuss difficult stuff, like design questions and how to use version control to best support the teams work flow. But often there is very little done for teaching the very junior developers.</p>
<p>Often they only get a quick introduction into a tool and then they are left alone with their task.  They work along, do some stuff and only hours or days later they might get some feedback. That feedback often is unspecific and not very helpful like: &#8220;Who wrote this stupid commit comment?&#8221;</p>
<p>Basically this is a workflow that looks like this:</p>
<p>give task to junior that he might master -&gt; junior works on task -&gt; time goes by -&gt; if lucky junior gets feedback -&gt; repeat with possible adjustment of task difficulty</p>
<p>This might be comfortable for the junior, because he doesn&#8217;t get criticized very often, but it slows down learning and this is something we just cannot afford in IT. It also leaves traces of the failures in the results.</p>
<p>I therefore propose to a different approach:</p>
<p>give the simplest task to the junior that you can think of  that he hasn&#8217;t proven yet to perform well -&gt; watch him doing it -&gt; stopping him whenever he does something you don&#8217;t want to end up in the end result -&gt; explain what is wrong, why it is wrong and how to do it better -&gt; let him try again.</p>
<p>The obvious way of doing this is pair programming, but pair programming for this purpose has some problems. When two developers of very different skill levels work together the senior developer easily ends up doing the work while the junior is watching her. Not helpful. This kind of stuff is about learning, not so much about producing results.</p>
<p>Also with pair programming you have one senior training one junior. While this is awesome for the junior, it is also very expensive. With a little practice on the side of the senior it should be possible to supervise easily six juniors, maybe more.</p>
<p>This again might sound like the typical workshop or tutorial and it is indeed similar. But a typical workshop often stays on the surface of things, because it tries to cover as much as possible. What I propose is an intense training that goes slowly, but strives for perfection.</p>
<p>What do you think? Does this make sense? Is it already happening somewhere?</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/02/10/who-is-teaching-software-developers-how-to-use-a-file/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Coding Standards ARE Important</title>
		<link>http://blog.schauderhaft.de/2013/02/03/coding-standards-are-important/</link>
		<comments>http://blog.schauderhaft.de/2013/02/03/coding-standards-are-important/#comments</comments>
		<pubDate>Sun, 03 Feb 2013 06:30:02 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[coding standard]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1293</guid>
		<description><![CDATA[Zac Gery thinks when it comes to coding standards: in most circumstances the unrecognized pitfalls outweigh the benefits I strongly disagree! But lets go through his points one by one: Some team members equate coding standards to a lack of confidence in his/her abilities. Others find standards such as spacing and/or comments to be micro-managing. [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://zacgery.blogspot.de/2013/01/coding-standards-are-overrated.html">Zac Gery thinks</a> when it comes to coding standards:</p>
<blockquote><p>in most circumstances the unrecognized pitfalls outweigh the benefits</p></blockquote>
<p>I strongly disagree! But lets go through his points one by one:</p>
<blockquote><p>Some team members equate coding standards to a lack of confidence in his/her abilities. Others find standards such as spacing and/or comments to be micro-managing.</p></blockquote>
<p>Pardon me? If you have team members that have an issue adhering to simple team rules like &#8220;we want our {s on a separate line&#8221; and consider that a personal insult you have some serious issue in your team. Software development is a team effort. If you are working in a team you have to adhere to the rules of the team, no matter if they are written down or exist as implicit knowledge of the team.</p>
<blockquote><p>Coding standards stifle and discourage coding creativity. Some of the best code comes from an unfiltered mind.<br />
They create unneeded stress within a team as members disagree with various standards. These discussions can spiral into negative, unproductive debates.</p></blockquote>
<p>Hands up: Who considers it an important part of their creativity to decide on every line how far to indent it? That&#8217;s what I thought. Discussions about coding standards? Yup, we have those too. But there is no spiral involved. Somebody brings up a concern like &#8220;I think we should stop prefixing field access with <tt>this</tt>.&#8221; We exchange arguments and opinions. Then we decide. End of debate. Again, if you have constant fights in your team about this kind of thing, you have a serious problem in your team and its not the code style guide.</p>
<blockquote><p>Each new rule adds to the overall complexity of implementation, enforcement, and maintenance of coding standards.</p></blockquote>
<p>99% of all coding standards get implemented and maintained by your code formatter. The stuff that doesn&#8217;t gets enforced by tools like checkstyle. Therefor there really isn&#8217;t any relevant effort involved. Coding standards reduce these efforts because it prevents formatting wars and reduces the time needed for reading code.</p>
<blockquote><p>Each concession to a rule devalues the overall purpose of coding standards.</p></blockquote>
<p>That&#8217;s like saying we should legalize murder since every killing devalues the laws against it. Doesn&#8217;t make any sense.</p>
<blockquote><p>Coding standards distract from the larger goal of building, testing, and releasing functionality in a timely manner.</p></blockquote>
<p>I still don&#8217;t get it. How is it less distracting, when I have to check if a token references a class or a field just by checking if it starts with an upper case character? How is it less distracting, when I have to search for matching curly braces because the code is not properly indented?</p>
<blockquote><p>Deciding how to handle existing code that pre-dates the creation of a standard is a winless battle.</p></blockquote>
<p>Again, why battle? Have a discussion, make a decision, be done with it. Get used to it, this is an important part of working in a team.</p>
<blockquote><p>When a coding standard is not followed, what happens to that code? Must it be fixed immediately? How does that effect its testing, retesting, or release time lines? Some consider this code to be technical debt. That is a difficult label to apply to code if the violations are simply style related.</p></blockquote>
<p>Since coding standards should be trivial to follow they should break your build and get fixed. If you or team members have a problem with that: Have a discussion, make a decision, be done with it. What is the problem with the label technical debt? Violation of coding standards make it harder to read that code. That is the interest rate you pay for that debt until you pay it back. Fits perfectly. Of course how large that debt is when a single <tt>{</tt> is misplaced is a different question. But then again, paying that back should be as simple as opening the file and pressing a shortcut.</p>
<blockquote><p>Proper enforcement of coding standards can consume an unreasonable amount of time.<br />
The decision to enforce coding standards and its consequences must be embraced at all levels within a company. Most companies struggle to embrace doing something twice.</p></blockquote>
<p>Why is enforcing rules &#8220;doing something twice&#8221;? Don&#8217;t understand that. For the first sentence. Of course you can come up with coding standards that are hard to enforce. Just don&#8217;t. Use standards that play well with your tool setting. Automate it. And think again if your coding standard has to be company wide. This works well for small companies, but results in coding standards 1000 pages thick and completely useless. I have seen those. That shouldn&#8217;t keep you from having coding standards for your team.</p>
<p>Zac continues to recommend code reviews. A good thing! But not a replacement for coding standards.</p>
<p>You absolutely should have coding standards in any team consisting of two or more developers. Part of deciding on the standards to use should be the way to enforce them and this should be largely automatic.</p>
<p>Even more important than coding standards is a team standard on how to make decisions. If that standard fails in the trivial case of coming up with coding standards you have a serious problem.</p>
<p>And don&#8217;t go for compromises when it comes to coding standards (<a href="http://geek-and-poke.com/2010/06/simply-explained-1.html">by Geek&amp;Poke</a>)<br />
<a href="http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef0134832928a0970c-800wi"><img alt="coding standard compromise by Geek &amp; Poke" src="http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef0134832928a0970c-800wi" width="560" height="793" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/02/03/coding-standards-are-important/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The Importance of Packages</title>
		<link>http://blog.schauderhaft.de/2013/01/13/the-importance-of-packages/</link>
		<comments>http://blog.schauderhaft.de/2013/01/13/the-importance-of-packages/#comments</comments>
		<pubDate>Sun, 13 Jan 2013 05:06:41 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[modularity]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[structure]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1269</guid>
		<description><![CDATA[I remember approximately 15 years ago when I started learning Java. I read a lot about this &#8216;package&#8217; thing and &#8216;namespaces&#8217; and I totally didn&#8217;t get it. Sad thing is: While some aspects of package are understood by pretty much everybody in the industry others aren&#8217;t. So lets have a look what packages are good [...]]]></description>
				<content:encoded><![CDATA[<p>I remember approximately 15 years ago when I started learning Java. I read a lot about this &#8216;package&#8217; thing and &#8216;namespaces&#8217; and I totally didn&#8217;t get it.</p>
<p>Sad thing is: While some aspects of package are understood by pretty much everybody in the industry others aren&#8217;t. So lets have a look what packages are good for.</p>
<p><strong>Namespaces</strong>: By prefixing all your packages with a domain you control, you make sure that your class names are unique. This is essential for the success of an unbelievable number of open source projects. Every project can (and probably does at some stage) define a &#8216;Filter&#8217; class without having that class interfere with all the other classes of that same name (apart from the poor developer that copied some code without import statements from the web and now has to figure out which Filter class was actually referenced). This one is pretty well understood and I haven&#8217;t seen any relevant usage of the root package in ages.</p>
<p><strong>Organization</strong>: My son has a huge box of Lego bricks. Probably multiple thousands maybe tens of thousands of them. When he looks for a simple 2&#215;4 brick this is not a problem. But when he is searching for that special brick that only exists 4 times in the collection or even just once!? It might take a loooooong time to find it. Compare that to an apothecary cabinet. Hundreds of drugs and it normally takes only seconds to find the right one. And they don&#8217;t even use Google for that! They just have a strict ordering principle where each drug belongs, including a rule how the right box for a new drug is determined. Since everybody involved knows that principle it is easy to determine the correct box where the drug is to be found. Such an ordering principle is tremendously helpful when established early in a project.</p>
<p>When defining such a principle one criteria isn&#8217;t sufficient most of the time. But if you use more then one make sure they don&#8217;t interfere, by making the rules orthogonal. This means don&#8217;t have a rule saying: &#8220;All database access code has to go in package x&#8221; and another rule stating &#8220;All code related to customers has to go into package y&#8221;. Otherwise you won&#8217;t know where to put the CustomerDAO. Instead apply orthogonal rules on different depths of the package tree. My default package structure looks like this:</p>
<pre>&lt;organisational-prefix&gt;.&lt;application&gt;.&lt;deployment-unit&gt;.&lt;module&gt;.&lt;layer&gt;.&lt;optional further substructure if needed&gt;</pre>
<p>This results in package names like</p>
<p><tt>com.mycompany.theCoolApp.server.user.persistence</tt></p>
<p>or</p>
<p><tt>com.mycompany.theCoolApp.client.shoppingCart.presentation</tt></p>
<p>If you look at a package structure like this, it becomes pretty obvious where a new class belongs, or where to look if something like this already exists. It gets even better when you avoid names like <tt>util</tt> or <tt>misc</tt> which can hide more or less everything. Also you can look at these packages and immediately learn something about the architecture. As soon as you see a level of packages named <tt>client</tt>, <tt>webserver</tt> and <tt>batchserver</tt> you&#8217;ll form a model in your head how the application is structured and if the names are picked well it is probably close to the real thing. Since in each <tt>module</tt> the same rules for <tt>layers</tt> apply you can find out more about the structure of the application in the lower packages as well.</p>
<p>The <tt>module</tt>s in between communicate the kind of domain the application deals with. Quite naturally the important concepts get their own package and thereby make a statement to everyone inspecting the code: this is an important concept in this application.</p>
<p>I also like adding the rule &#8220;A package should contain <em><tt>a</tt>-<tt>b</tt></em> classes, but must not contain <em><tt>c</tt></em> or more&#8221; with appropriate values for a, b and c. This forces the creation of new packages as the application grows, keeping each package to a manageable size.</p>
<p>Of course on smaller applications the structure might get scaled down. For example if there is just one deployment unit there is no need for a separate package level for that classification.</p>
<p>The last usage for package is the most ignored: the <strong>intermediate modeling block</strong>: Joe Average Developer concerns herself mostly with classes and methods and single lines of code, while trying to come up with a code structure on that level that fits the needs of the application. Often there is some kind of architect who figures out how to deploy the application and thereby determines the necessary deployment units (think separate jars). If you look at the scale of these artifacts something interesting might catch your eye:</p>
<p>1 method consists of approximately 10 lines of code.</p>
<p>1 class consists of approximately 10 methods.</p>
<p>1 jar consists of approximately 100 &#8211; 1000 classes.</p>
<p>If nobody takes care of packages there is at least one, often two levels of structure missing! This gap can and should be filled with packages. This doesn&#8217;t only mean the packages should exist and be of reasonable size, it also means they should adhere to common design guide lines. Especially <a href="http://en.wikipedia.org/wiki/Single_responsibility_principle">Single Responsibility Principle</a> and proper handling of dependencies:</p>
<p><strong>Single Responsibility Principle</strong> With the naming scheme proposed above, a lot of work toward honoring the SRP is done. If the contents of the package does what its name says everything is fine on that front.</p>
<p><strong>Managing of Dependencies</strong> is a tougher beast. Java currently doesn&#8217;t offer a proper system to control dependencies between packages and especially super packages, i.e. packages that contain multiple other packages. There is <a href="http://en.wikipedia.org/wiki/OSGi">OSGI</a>, but I found it a pain in the neck to work with, especially since I never needed all the dynamic loading stuff but suffered from the resulting class loader issues. There is also <a href="http://openjdk.java.net/projects/jigsaw/">Jigsaw</a> but this is not there yet. Therefore I prefer homegrown tests for defining and verifying the package structure of applications I work with. My tool of choice is <a href="http://clarkware.com/software/JDepend.html">JDepend</a>. It gives you lists of dependencies between packages and you can use those to compare them to rules you define. Somebody creates a dependency from package A to package B that should not exist? Boom, the test turns red.</p>
<p>So what are useful rules for package dependencies? First: No cycles. Not on the package level, but also not on the <tt>layer</tt> level nor on the <tt>module</tt> level as used above. Second: Modules and Layers have a strict order in which they can depend on each other, everything else is forbidden.</p>
<p>These rules considerably limit the degrees of freedom one has as a developer. But in my experience it smokes out violations of the Single Responsibility Principle, which often surfaces as cyclic dependencies. For example if you have an Order module and a Customer module it feels like these two need to know each other. If you have an Order, you want to know the Customer it belongs to. If you have a Customer you must be able to tell her the Orders she placed. Right? Yes, probably. But do you need the full blown objects and functionality on both side? Probably not. By coming up with an interface package for example containing only the very core for the customer functionality needed by the Order module and and a separate full Customer module that has the references the orders <a href="/2011/07/17/breaking-dependency-cylces/">one can break these dependencies</a> AND achieve a stronger separation of concern in your package structure.</p>
<p>This in turn helps when you try to evolve your application. What today is a package might grow into a deployment-unit someday and if you have circular dependencies between deployment-units you&#8217;ll have some serious problems. Or maybe your team grows into multiple teams. With a clean package structure as described above you have a obvious bounds where you can split and also an obvious criteria when the teams have to sit together to discuss changes on a package used by multiple teams.</p>
<p>Take care (of your package structure).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/01/13/the-importance-of-packages/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Copying Objects in Layered Applications</title>
		<link>http://blog.schauderhaft.de/2013/01/06/copying-in-layerd-applications/</link>
		<comments>http://blog.schauderhaft.de/2013/01/06/copying-in-layerd-applications/#comments</comments>
		<pubDate>Sun, 06 Jan 2013 09:20:49 +0000</pubDate>
		<dc:creator>Jens Schauder</dc:creator>
				<category><![CDATA[Softwaredevelopment]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[copying]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://blog.schauderhaft.de/?p=1263</guid>
		<description><![CDATA[In my last post I wrote about the dependencies in a layered application. There is another antipattern going on in many layered applications: Obsessive copying. It might look like this: The User Interface has some representation of the data input by the user, it gets copied over into some kind of transport object (often suffixed [...]]]></description>
				<content:encoded><![CDATA[<p><a href="2012/12/30/dependencies-in-a-three-tiered-application">In my last post I wrote about the dependencies in a layered application</a>. There is another antipattern going on in many layered applications: Obsessive copying.</p>
<p>It might look like this:</p>
<p>The User Interface has some representation of the data input by the user, it gets copied over into some kind of transport object (<a href="/2012/09/02/naming-antipatterns/">often suffixed TO (Arrrrgh)</a>), which then gets copied over into the domain representation of the data, and finally gets copied over into the persistence representation.</p>
<p>That&#8217;s a lot of copying. Not good. In many cases this is just waste. Waste on the runtime side of things when all these objects have to get created and garbage collected and on the implementation side of things when all the stupid code doing the copying is created and maintained. If you look even closer you often see much more copying, when your nice objects get converted to XML, JSON or some other serialized form.</p>
<p>When you see something like this you should start asking questions: copied over?</p>
<p>There are cases where you need to do some copying. For example when you transfer data between layers that are physically separate you have to serialize and deserialize them. But if you want to go from <i>domain object</i> to <i>serialized data stream</i> do you have to go via a <i>transport object</i>? Sure it allows you to use some nice magic library to create your JSON or XML or whatever you want to use. But is it really easier to copy data into a TO and then magically convert it into a JSON structure instead of just creating the JSON structure in the first place, possibly using a little Builder pattern?</p>
<p>If you need different properties in your presentation layer do you have to copy all the stuff over from the domain object? Or maybe you can just provide a thin wrapper providing the additional properties?</p>
<p>I&#8217;m perfectly with you if you don&#8217;t want the Hibernate mapped entities in your domain logic, because it is bleeding persistence logic in your domain logic. But if you don&#8217;t use the Hibernate Entities, is Hibernate really offering a benefit for you?</p>
<p>And beware of reflection for copying. It looks promising in the beginning, but if copying makes any sense at all the structures are different and your reflection based code will become more and more complex and slow. Oh and you might note, that things like Hibernate make extensive use of reflection and/or byte code manipulation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schauderhaft.de/2013/01/06/copying-in-layerd-applications/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
