<?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>Iván Pazmiño</title>
	<atom:link href="http://www.pazmino.ec/feed" rel="self" type="application/rss+xml" />
	<link>http://www.pazmino.ec</link>
	<description>software design &#38; building</description>
	<lastBuildDate>Fri, 03 Feb 2012 21:12:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Solving the Right Problem</title>
		<link>http://www.pazmino.ec/engineering/solving-the-right-problem.html</link>
		<comments>http://www.pazmino.ec/engineering/solving-the-right-problem.html#comments</comments>
		<pubDate>Wed, 01 Feb 2012 22:43:37 +0000</pubDate>
		<dc:creator>iapazmino</dc:creator>
				<category><![CDATA[engineering]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[teaching]]></category>

		<guid isPermaLink="false">http://www.pazmino.ec/?p=205</guid>
		<description><![CDATA[Education on computing science at under degree level should rely on specialization during the last years.]]></description>
			<content:encoded><![CDATA[<p>Have you noticed how many books on software development have a chapter/section devoted to guide the reader on how to spot the right problem to solve and avoid wasting time and effort? They are many I would say, and they tackle the issue from different angles &#8211; when gathering requirements, when planning next sprint/iteration, before coding &#8211; and providing several techniques &#8211; using examples, polishing user stories, avoiding to polish user stories.<span id="more-205"></span></p>
<p>This makes you feel a little bit like for fifty+ years there have been many of us struggling with the same problems and several have succeeded in their quests and have documented their findings. Making a software bible out of the best titles doesn&#8217;t sound right. Just to propose choosing the &#8220;best titles&#8221; should unleash the <a title="Wrath_of_God" href="http://mtg.wikia.com/wiki/Wrath_of_God">Wrath of God</a>. But we still need this one source where to concentrate knowledge and if there were someone to guide in the learning process&#8230; Dreamy.</p>
<p>These books you usually would read after you&#8217;re finished becoming an engineer. You know, after five years of preparing your brain to solve problems with Mathematics, Geometry and Physics, and, learning generalities on computing-related matters like networking, programming, IT auditing, etc, won&#8217;t get you too far on your first programming job when you discover you should not use JDBC but some JPA layer in the JEE architecture to make that query. Difficult.</p>
<p>Adding more years to school is not a solution. Actually everybody is trying to make it shorter and easier to become an engineer so more people want to be one, regardless of the sucky professionals they might spit out to the market. Plain irresponsible.</p>
<p>What if universities teach basics and generalities for three years and then you have to choose an specialization, let&#8217;s say on software development, so that you spend two years learning the many ways to point at and solve the right problem. This is not new, it&#8217;s what they do in Psychology. Mastering all about computers nowadays reaches far beyond the eyes can see and competitivity won&#8217;t forgive those who know a bit of everything. That&#8217;s knowing nothing.</p>
<p>Spending two years learning structural, object oriented, functional and more programming and how to test it will sure make a better programmer. Learn formal and agile methodologies to track your project growing will make you at least aware of the tools at your disposal. Learn TDD, BDD, specification by example and you will aim your effort to the right problem. Have a teacher assisting you in the learning process of something you chose to get good at and those two years will be a delightful journey.</p>
<p>What I mean is education on computing science at under degree level should rely on specialization during the last years.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pazmino.ec/engineering/solving-the-right-problem.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To consider when arquilling</title>
		<link>http://www.pazmino.ec/tools/to-consider-when-arquilling.html</link>
		<comments>http://www.pazmino.ec/tools/to-consider-when-arquilling.html#comments</comments>
		<pubDate>Tue, 13 Sep 2011 10:48:52 +0000</pubDate>
		<dc:creator>iapazmino</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[arquillian]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.pazmino.ec/?p=192</guid>
		<description><![CDATA[A few things to consider when building integration tests with Arquillian.]]></description>
			<content:encoded><![CDATA[<p>After a few weeks of real world testing with Arquillian I&#8217;ve noticed a few things to consider when building integration tests. These items should grow or evolve, here or in other post, as experience is gained.</p>
<p><strong>To manage provided dependencies.</strong> The building of a project most of the time considers dependencies to libraries, toolkits, frameworks, etc., and for each of them you define a scope. You find some to be provided-scoped as your company&#8217;s login jar, the jee6-spec.jar library, etc. What&#8217;s to consider here is that these libraries are provided by the environment, so they don&#8217;t need to be in your deployment file. If you just drop them in your deploy or lib folders when you start the container, without your test file yet, you can make sure the can actually deploy by them selves. Then, if your test-deployment-file fails to deploy it&#8217;s less likely because of the provided dependencies.<span id="more-192"></span></p>
<p><strong>To separate logs.</strong> Test-code logs too. So the least you should do is to drop a configuration file in your test resources to make sure the test log is separated from the production and server logs. A good place to relocate this file is to the target folder, maven speaking, or wherever you place your binaries. If you can make a log file per test class and save them into the test-reports folder, that&#8217;s heaven. This way, in the unlikely scenario your test fails, you won&#8217;t be searching the cause inside a 5 MB+ file which rolls every hour at best, but in a 1 KB ~ 1 MB test-only log file which is deleted next time you run your tests, build the project or just clean it up.</p>
<p><strong>To isolate persistence.</strong> When data is involved you should always have a test-only schema or catalog, or whatever your DBMS calls it, where you can create and drop objects as you need. Once you grant this, you could tune up a little your test persistence.xml file to provide better data isolation. Ideally, a create-drop configuration for every test-case over a schema in the same DBMS where the development schema resides helps keeping a closer production-like isolated environment, but much time will be consumed to drop and create DB objects and purging might be needed. A quick fix is to move the test schema to a local light DBMS, like the JBoss AS embedded HSQLDB, which can be maintained as long as you don&#8217;t use DB-specific syntax. Another, is to configure the persistence to only update changes instead of dropping and recreating the schema every time; hibernate for this would be hibernate.hbm2ddl.auto = update. Using both fixes really cuts-off some time.</p>
<p><strong>To package light.</strong> Adding a whole package to a testing deployment is not the best choice even when easier. Consider this integration tests as unit-integration tests; you want your component isolated but standing over the environment where it will perform in production. So, next time you are going to test the ClientSuscriber.java class use <code>addClass(ClientSuscriber.class)</code> instead of <code>addPackages(ClientSuscriber.class.getPackage())</code> This will reduce the potential failure points to your test.</p>
<p><strong>To default to off maven profiles</strong> When building with maven, it&#8217;s a good idea to turn off integration tests for regular building. An integration test besides testing components on the real environment also helps making sure you don&#8217;t break co-workers code and usually are developed and run after unit tests. So, setting them up in a non-active-by-default profile helps keeping them out of the way till they are needed because they cost time and running only a specific one reduces its efficiency. You may enforce the running of these tests by a CI system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pazmino.ec/tools/to-consider-when-arquilling.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Target Entity</title>
		<link>http://www.pazmino.ec/design/target-entity.html</link>
		<comments>http://www.pazmino.ec/design/target-entity.html#comments</comments>
		<pubDate>Wed, 31 Aug 2011 23:46:14 +0000</pubDate>
		<dc:creator>iapazmino</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[convariant return]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>

		<guid isPermaLink="false">http://www.pazmino.ec/?p=178</guid>
		<description><![CDATA[Lately I&#8217;ve been fighting with some teory vs practice which refused to cooperate and that&#8217;s become a bit frustrating. My problem was an API which looked OK but when time came to persist it with JPA entities it needed so much tweaking, pushing and pulling generics to get that covariant return to work that really [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been fighting with some teory vs practice which refused to cooperate and that&#8217;s become a bit frustrating. My problem was an API which looked OK but when time came to persist it with JPA entities it needed so much tweaking, pushing and pulling generics to get that covariant return to work that really felt something was terribly wrong. The point was to write an API which would allow the persistence layer implement it and still be manageable and targeted by the entity manager, but something wasn&#8217;t fitting.<br />
<span id="more-178"></span></p>
<p>First approach was to define types together with class declaration.</p>
<p><code>public class Application  &lt;T extends Applicant&gt; {} </code></p>
<p>This led to a very complex to design API because it kept extending the generic types as relationships appeared, which in time caused the API to be hard to understand because the attention on what it was trying to solve was caught by the types definition and declarations growing larger and larger as a second and a third type needed to be defined. Clear bad smell, so first refactoring took place. This first approach is depicted in package <a href="https://github.com/iapazmino/generics-api/tree/master/src/main/java/ec/pazmino/sandbox/generics/api/interfaces">ec.pazmino.sandbox.generics.api.interfaces</a> and its JPA entities implementation in <a href="https://github.com/iapazmino/generics-api/tree/master/src/main/java/ec/pazmino/sandbox/generics/api/jpa">ec.pazmino.sandbox.generics.api.jpa</a></p>
<p>To solve this I decided to declare generic types inline so interfaces would look cleaner. </p>
<p><code>public class Application {<br />
    (&lt;T extends Applicant&gt;) T applicant;<br />
}</code></p>
<p>They did look cleaner. But the API got even harder to use and made me realize how much left I had to learn on generics. It&#8217;s a lot. These are packages <a href="https://github.com/iapazmino/generics-api/tree/master/src/main/java/ec/pazmino/sandbox/generics/api/interfaces/inline">ec.pazmino.sandbox.generics.api.interfaces.inline</a> and <a href="https://github.com/iapazmino/generics-api/tree/master/src/main/java/ec/pazmino/sandbox/generics/api/jpa/inline">ec.pazmino.sandbox.generics.api.interfaces.jpa.inline</a>. So I started reading some more on generics and was about to start a new approach, which should lay an easier way to sub-classing by declaring types as self-referenced &gt;.</p>
<p>But then I re-read the problem: a &#8220;covariant return which would allow the persistence layer implement the API and still be manageable and targeted by the entity manager.&#8221; All the magic remained calm in one word: &#8220;targeted&#8221;. <a title="The truth" href="http://twitter.com/#!/iapazmino/status/108457319595118592">This truth</a> was revealed to me at 3:30 am. All I needed was telling the entity&#8217;s relationship what the specific target was implementing the defined contract. That&#8217;s it. The covariant return is given by the definition of the interface itself; anyway typing is going to be deleted after compilation. These are packages <a href="https://github.com/iapazmino/generics-api/tree/master/src/main/java/ec/pazmino/sandbox/generics/api/interfaces/clean">ec.pazmino.sandbox.generics.api.interfaces.clean</a> and <a href="https://github.com/iapazmino/generics-api/tree/master/src/main/java/ec/pazmino/sandbox/generics/api/jpa/clean">ec.pazmino.sandbox.generics.api.interfaces.jpa.clean</a></p>
<p>Such an easy thing became a mess because I was trying to solve it with the wrong tool. Covariant return is not necessarily solved with generics because a</p>
<blockquote><p><a href="http://download.oracle.com/javase/tutorial/java/javaOO/returnvalue.html">covariant return type, means that the return type is allowed to vary in the same direction as the subclass.</a></p></blockquote>
<p>Code repo <a title="generics-api[at]github.com" href="https://github.com/iapazmino/generics-api">https://github.com/iapazmino/generics-api</a><a title="generics-api repo [at] github" href="git://github.com/iapazmino/generics-api.git"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pazmino.ec/design/target-entity.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code auditing with Maven</title>
		<link>http://www.pazmino.ec/tools/code-auditing-with-maven.html</link>
		<comments>http://www.pazmino.ec/tools/code-auditing-with-maven.html#comments</comments>
		<pubDate>Fri, 22 Jul 2011 01:00:15 +0000</pubDate>
		<dc:creator>iapazmino</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[findbugs]]></category>
		<category><![CDATA[jxr]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[pmd]]></category>

		<guid isPermaLink="false">http://www.pazmino.ec/?p=170</guid>
		<description><![CDATA[Auditing code in every build to make sure your technical debt doesn't get even bigger]]></description>
			<content:encoded><![CDATA[<p>Every time you code and promise you&#8217;ll eliminate duplicated code later, replace System.out.println with a proper logger tomorrow, refactor that 15-options-if before the weekend you get into a <a title="Technical Debt" href="http://www.martinfowler.com/bliki/TechnicalDebt.html">debt</a> you can&#8217;t pay. Even worst, your already big debt gets bigger. So, there are not more loans for you. Here&#8217;s a code auditing profile to be run in every build.<span id="more-170"></span></p>
<p>So, the build process is going to execute a <a href="http://maven.apache.org/plugins/maven-pmd-plugin/">PMD</a> check and a <a href="http://mojo.codehaus.org/findbugs-maven-plugin/index.html">Findbugs</a> check. In order for these reports to be able to navigate through the code it&#8217;s necesary to enable this cross-reference with <a href="http://maven.apache.org/plugins/maven-jxr-plugin/">JXR</a>. Later I will add CheckStyle when I can import the code conventions and formatting I&#8217;m already using with Eclipse IDE.</p>
<p>JXR is not executed during the build because browsing the code is something you would do from a report and not from a text file or the errors in the console, but you can enable this by executing it before the PMD and Findbugs goals are executed, maybe in the process-classes and process-test-classes phases when you know the code compiles and before it&#8217;s verified by the other plugins.</p>
<p>PMD will run a check in the verify phase of the build and make a report in the site phase of the reporting. The difference between these two is that check will fail the build if violations occur, and the report won&#8217;t. Checking in the verify phase gives you the chance to compile, test and package without worrying yet about your pending tasks on code quality. Findbugs will run in the verify phase as well. If you have your own rules-file for PMD you can add it inside a ruleset tag.</p>
<p>Finally, all three plugins are included in the reporting tag so the appear in the project&#8217;s site.</p>
<pre name="code" class="xml:nocontrols:firstline">&lt;profile&gt;
&lt;id&gt;auditoria-codigo&lt;/id&gt;
&lt;activation&gt;
&lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
&lt;/activation&gt;
&lt;build&gt;
&lt;plugins&gt;
&lt;!-- Referencia cruzada al codigo fuente --&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-jxr-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.jxr.version}&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;cross-reference-source&lt;/id&gt;
&lt;phase&gt;pre-site&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;jxr&lt;/goal&gt;
&lt;goal&gt;test-jxr&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;!-- PMD --&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.pmd.version}&lt;/version&gt;
&lt;configuration&gt;
&lt;targetJdk&gt;${java.jdk.version}&lt;/targetJdk&gt;
&lt;rulesets&gt;
&lt;ruleset&gt;
rules/path/file.xml
&lt;/ruleset&gt;
&lt;/rulesets&gt;
&lt;includeTests&gt;true&lt;/includeTests&gt;
&lt;verbose&gt;true&lt;/verbose&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;check-pmd&lt;/id&gt;
&lt;phase&gt;verify&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;check&lt;/goal&gt;
&lt;goal&gt;cpd-check&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;execution&gt;
&lt;id&gt;report-pmd&lt;/id&gt;
&lt;phase&gt;site&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;pmd&lt;/goal&gt;
&lt;goal&gt;cpd&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;!-- Findbugs --&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;findbugs-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.findbugs.version}&lt;/version&gt;
&lt;configuration&gt;
&lt;includeTests&gt;true&lt;/includeTests&gt;
&lt;relaxed&gt;true&lt;/relaxed&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;check-4bugs&lt;/id&gt;
&lt;phase&gt;verify&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;check&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;reporting&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-jxr-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.jxr.version}&lt;/version&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.pmd.version}&lt;/version&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;findbugs-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.findbugs.version}&lt;/version&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/reporting&gt;
&lt;/profile&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pazmino.ec/tools/code-auditing-with-maven.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code coverage with Maven and Cobertura</title>
		<link>http://www.pazmino.ec/tools/code-coverage-with-maven-and-cobertura.html</link>
		<comments>http://www.pazmino.ec/tools/code-coverage-with-maven-and-cobertura.html#comments</comments>
		<pubDate>Wed, 20 Jul 2011 23:07:46 +0000</pubDate>
		<dc:creator>iapazmino</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[cobertura]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.pazmino.ec/?p=164</guid>
		<description><![CDATA[Setup a maven3 profile to run cobertura code coverage tool and generate an HTML report in the site phase]]></description>
			<content:encoded><![CDATA[<p><a title="Cobertura" href="http://cobertura.sourceforge.net/index.html">Cobertura</a>&#8216;s usage is covered in its page so that you can install the plugin and run it separately from the build lifecycle. This how-to integrates it with maven3 to run as part of the site lifecycle.<span id="more-164"></span></p>
<p>This configuration has a few lines so it&#8217;s probably a good idea to group them inside a profile which executes by default so we check coverage all the time. In order to check code coverage and report it, cobertura needs to instrument the code, test and generate reports. All this can be done with cobertura:cobertura goal. You might want to clean up everything before starting, so you get cobertura:clean goal too. The point is when to execute what, so you should checking at <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference">maven&#8217;s lifecycle reference</a> for the site phase pre-site looked like a good place for clean up and site for checking coverage and reporting.</p>
<pre name="code" class="xml:nocontrols:firstline">&lt;profile&gt;
&lt;id&gt;auditoria-codigo&lt;/id&gt;
&lt;activation&gt;
&lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
&lt;/activation&gt;
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.cobertura.version}&lt;/version&gt;
&lt;configuration&gt;
&lt;check&gt;
&lt;haltOnFailure&gt;false&lt;/haltOnFailure&gt;
&lt;/check&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;clean&lt;/id&gt;
&lt;phase&gt;pre-site&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;clean&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;execution&gt;
&lt;id&gt;check-coverage&lt;/id&gt;
&lt;phase&gt;site&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;cobertura&lt;/goal&gt;
&lt;goal&gt;check&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;reporting&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;${plugin.cobertura.version}&lt;/version&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/reporting&gt;
&lt;/profile&gt;</pre>
<p>By default cobertura checks for a minimum coverage of 50% or fires an error. So, in order for this error to do not stop the site generation you need to set haltOnFailure to false.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pazmino.ec/tools/code-coverage-with-maven-and-cobertura.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

