<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>@InitBinder</title>
	
	<link>http://initbinder.com</link>
	<description>My thoughts, notes and ideas as a passionate software engineer</description>
	<lastBuildDate>Wed, 23 May 2012 03:16:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/initbinder" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="initbinder" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Measure amount of WTFs per package or project</title>
		<link>http://initbinder.com/articles/measure-amount-of-wtfs-per-package-or-project.html</link>
		<comments>http://initbinder.com/articles/measure-amount-of-wtfs-per-package-or-project.html#comments</comments>
		<pubDate>Tue, 22 May 2012 03:59:31 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[off topic]]></category>
		<category><![CDATA[code quality]]></category>
		<category><![CDATA[custom junit runner]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[junit runner]]></category>
		<category><![CDATA[measure code quality]]></category>
		<category><![CDATA[wtf]]></category>
		<category><![CDATA[wtf per minute]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1562</guid>
		<description><![CDATA[I created a library that measures amount of WTFs per package or project. This library is a by-product that derived from what I was doing few days ago: I was dabbling with Java and decided to take a break. I &#8230; <a href="http://initbinder.com/articles/measure-amount-of-wtfs-per-package-or-project.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I created a library that measures amount of WTFs per package or project. This library is a by-product that derived from what I was doing few days ago:</p>
<p>I was dabbling with Java and decided to take a break. I came across a well know image that depicts code review session behind closed doors. The image called &#8220;The only valid measurement of code quality: WTF/minute&#8221;. I decided to make an extension to the latter concept.</p>
<p>This library brings you the ability to mark code smells in your source code (Classes, methods, fields etc.) with &#8216;WTF&#8217; annotation. The WTF annotation accepts an arbitary message, if none provided, the default message &#8216;Dude.. WTF?!&#8217; is used instead. When source compiles, the compiler generates a warning using the message from the detected annotation(s) and information about annotated element. The following is a sample output from compiling a class containing WTF annotations:</p>
<blockquote><p>Warning: : In CLASS [wtf.per.project.model.DummyPojoImpl] :CLASS level =&gt; WTF?! Are you for real?! This naming convention is bad!<br />
Warning: : In CLASS [wtf.per.project.model.DummyPojoImpl] : FIELD &#8216;SOME_CONSTANT&#8217; =&gt; WTF?! What is this non-descriptive name?<br />
Warning: : In CLASS [wtf.per.project.model.DummyPojoImpl] : CONSTRUCTOR &#8216;DummyPojoImpl(java.lang.String)&#8217; =&gt; WTF?! Dude.. WTF?!</p></blockquote>
<p>The library also provides a custom JUnit test runner class. The runner consumes package name, annotation class and search filter through @Grep annotation (used in conjunction with @RunWith). The runner scans .class files under the given package, its sub-packages and JARs for the given annotation (for example WTF.class) occurrences. If String regex pattern provided in @Grep, classes are filtered out from being scanned based on the filter. The runner uses a test class internally to assert whether the code is still infested with WTFs (or any other annotation class set in @Grep).</p>
<p>The analysis of .class files within given package, its sub-packages and any JAR files found is done using reflection. At first I was using third party library called &#8216;Reflections&#8217; for this task (which is a very good tool btw!), but I ended up not using it anymore. I did not want to have third party dependencies and implemented my own meta data analysis in order to keep the library size small and lean. In the near future, I will extract the metadata analysis logic into a separate library. It should be quite flexible since there different .class file scanners in place. For example, scanner for constructors only or for method parameters, fields only etc.</p>
<p>So, if runner&#8217;s test assertion fails (given annotation like @WTF found present in the code), the test class generates metrics about how many WTFs are there and where. These metrics appended to the assertion failure message. For example, the following is the example of the custom JUnit runner:</p>
<blockquote>
<pre><code>@RunWith(WTFsPerProject.class)
@Grep(packageName = "wtf.per.project.model",
classNameFilter = ".*", annotationClass = WTF.class)
public final class WTFsPerProjectRunner { }</code></pre>
</blockquote>
<p>I have few POJOs marked with WTF annoation, the following is the produced output after running the above runner:</p>
<p><a href="http://initbinder.com/bunker/wp-content/uploads/2012/05/junit-output-one1.png"><img class="aligncenter size-full wp-image-1571" title="junit-output-one" src="http://initbinder.com/bunker/wp-content/uploads/2012/05/junit-output-one1.png" alt="" width="708" height="412" /></a>Another example of the custom JUnit runner:</p>
<pre><code>@RunWith(WTFsPerProject.class)
//Grep only inner classes
@Grep(packageName = "wtf.per.project.model",
classNameFilter = ".*[$].*", annotationClass = WTF.class)
public final class WTFsPerProjectRunner { }</code></pre>
<h2><a href="http://initbinder.com/bunker/wp-content/uploads/2012/05/junit-output-two.png"><img class="size-full wp-image-1568 aligncenter" title="junit-output-two" src="http://initbinder.com/bunker/wp-content/uploads/2012/05/junit-output-two.png" alt="" width="610" height="174" /></a>Disclaimer</h2>
<p>I created this library for fun. Nothing more. If someone actually decides to use it &#8211; great.</p>
<p>If you want you can <a href="https://github.com/azagniotov/Amount-of-WTFs-per-Project">fork it on Github</a></p>
<p>Please report if you experience any problems <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/measure-amount-of-wtfs-per-package-or-project.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brainteaser: DevOps</title>
		<link>http://initbinder.com/articles/difference_between_continuous_deployment_and_continuous_delivery.html</link>
		<comments>http://initbinder.com/articles/difference_between_continuous_deployment_and_continuous_delivery.html#comments</comments>
		<pubDate>Sat, 24 Sep 2011 10:45:45 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>
		<category><![CDATA[brainteaser]]></category>
		<category><![CDATA[continuous delivery]]></category>
		<category><![CDATA[continuous deployment]]></category>
		<category><![CDATA[dev ops]]></category>
		<category><![CDATA[devops]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1222</guid>
		<description><![CDATA[What is the difference between continuous deployment and continuous delivery? Please describe in one-two lines]]></description>
			<content:encoded><![CDATA[<p>What is the difference between <em>continuous deployment</em> and <em>continuous delivery</em>? Please describe in one-two lines</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/difference_between_continuous_deployment_and_continuous_delivery.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unfamiliarity Causes Rejection</title>
		<link>http://initbinder.com/articles/unfamiliarity-causes-rejection.html</link>
		<comments>http://initbinder.com/articles/unfamiliarity-causes-rejection.html#comments</comments>
		<pubDate>Wed, 21 Sep 2011 10:38:35 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1214</guid>
		<description><![CDATA[Recently I listened to a talk given by an ex-ThoughtWorker, Simon Harris. One of the things that Simon talked about was how we, developers (and generally speaking &#8211; human beings) sometimes tend to reject what is unfamiliar to us. Within &#8230; <a href="http://initbinder.com/articles/unfamiliarity-causes-rejection.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I listened to a talk given by an ex-ThoughtWorker, <a title="Simon Harris - Haruki Zaemon" href="http://twitter.com/haruki_zaemon" target="_blank">Simon Harris</a>. One of the things that Simon talked about was how we, developers (and generally speaking &#8211; human beings) sometimes tend to reject what is unfamiliar to us. Within software development context it can be an existing/legacy application or a module that we need to extend, and which is difficult to understand.</p>
<p>Really, how many times we looked at someone else&#8217;s work (eg:. a developer that has left the company a long time ago) and thought &#8220;Dude, this is so weak &#8230; come one&#8221;?</p>
<p>Instead of just pointing fingers, maybe we should stop for a moment, try to think and understand, what were the reasons for producing that mediocre piece of code? Look at the current software&#8217;s state from a different angle. Sure, sometimes a poorly written software is simply just that &#8211; a poorly written software without a particular reason. But at other times, perhaps there were unknown variables in the equation that prevented developers produce something of a higher quality: technical limitations? Some internal politics? Tight deadlines? Environment?</p>
<p>Understanding the historical/current state of an application, can only help us to come up with better results in the long run. I really enjoyed <a title="Simon Harris - Haruki Zaemon" href="http://twitter.com/haruki_zaemon" target="_blank">Simon</a>&#8216;s talk, he clearly draws from his extensive experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/unfamiliarity-causes-rejection.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LateX – Transparent Watermark Image</title>
		<link>http://initbinder.com/articles/latex-transparent-watermark-image.html</link>
		<comments>http://initbinder.com/articles/latex-transparent-watermark-image.html#comments</comments>
		<pubDate>Sun, 04 Sep 2011 07:27:03 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[eso-pic]]></category>
		<category><![CDATA[graphicx]]></category>
		<category><![CDATA[latex watermark image]]></category>
		<category><![CDATA[semi opaque background]]></category>
		<category><![CDATA[semi transparent background]]></category>
		<category><![CDATA[tikz]]></category>
		<category><![CDATA[transparent image]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1205</guid>
		<description><![CDATA[If you want to add a watermark image to your LaTeX document, you can achieve it easily using three packages: graphicx, tikz and eso-pic: Graphicx package allows to load images into documents. If you want to add transparency to your &#8230; <a href="http://initbinder.com/articles/latex-transparent-watermark-image.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to add a watermark image to your LaTeX document, you can achieve it easily using three packages: <em>graphicx</em>, <em>tikz</em> and <em>eso-pic</em>:</p>
<p><em>Graphicx</em> package allows to load images into documents. If you want to add transparency to your image, you need also to use <em>tikz</em> package. <em>Tikz</em> is used for producing vector graphics from a geometric/algebraic description, but is also allows to play with opacity levels.</p>
<p><em>Eso-pic</em> package provides hooks to inserts the images on one or more pages as a background (in other words &#8211; a watermark).</p>
<p>[xml]<br />
\\usepackage{graphicx}<br />
\\usepackage{tikz}<br />
\\usepackage{eso-pic}</p>
<p>\\newcommand\\BackgroundPicA{\\put(270,440){{%<br />
\\begin{tikzpicture}\\node[opacity=0.1]{%<br />
\\includegraphics[scale=0.80]{letter-watermark.jpg}};%<br />
\\end{tikzpicture}%<br />
}}}</p>
<p>\\newcommand\\BackgroundPicB{\\put(-80,-40){{\\reflectbox{%<br />
\\begin{tikzpicture}%<br />
\\node[opacity=0.1]{%<br />
\\includegraphics[scale=0.80]{letter-watermark.jpg}};%<br />
\\end{tikzpicture}%<br />
}}}}</p>
<p>\\makeatletter%<br />
\\AddToShipoutPicture{\\BackgroundPicA}%<br />
\\AddToShipoutPicture{\\BackgroundPicB}%<br />
\\makeatother</p>
<p>\\begin{document}<br />
.<br />
.<br />
\\newpage<br />
.<br />
.<br />
\\end{document}<br />
[/xml]</p>
<p>I have attached a final result as PDF, so you can see the output: <a href="http://initbinder.com/bunker/wp-content/uploads/2011/09/opaque1.pdf">PDF with semi-opaqued watermark</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/latex-transparent-watermark-image.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>LateX – Style Section Title With a Color Filled Box</title>
		<link>http://initbinder.com/articles/latex-style-section-title.html</link>
		<comments>http://initbinder.com/articles/latex-style-section-title.html#comments</comments>
		<pubDate>Sat, 27 Aug 2011 12:09:40 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[color box padding]]></category>
		<category><![CDATA[colored box]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[section]]></category>
		<category><![CDATA[section styling]]></category>
		<category><![CDATA[section title]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1197</guid>
		<description><![CDATA[I was playing with LaTeX in order to create a resume template for my self. I was looking for a way to style title generated by the \section command. My goal was to generate color filled box with some text &#8230; <a href="http://initbinder.com/articles/latex-style-section-title.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was playing with LaTeX in order to create a resume template for my self. I was looking for a way to style title generated by the \section command. My goal was to generate color filled box with some text inside and some padding.</p>
<p>This is what I have came up with:</p>
<p>[java]<br />
\\definecolor{gray}{RGB}{186,186,186}<br />
\\section{\\fcolorbox{black}{gray}{\\color{black}%<br />
{\\parbox{6.5in}{\\vspace{.03in}\\hspace{.03in}\\LaTe X{ is really cool}\\vspace{.03in}}}}}<br />
[/java]</p>
<p>Which produced the following result:</p>
<p><a href="http://initbinder.com/bunker/wp-content/uploads/2011/08/paddedbox.jpg"><img class="alignnone size-full wp-image-1202" title="paddedbox" src="http://initbinder.com/bunker/wp-content/uploads/2011/08/paddedbox.jpg" alt="LaTex - Style section title with a colored filled box" width="736" height="41" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/latex-style-section-title.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Have Joined the ThoughtWorks Camp</title>
		<link>http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html</link>
		<comments>http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html#comments</comments>
		<pubDate>Mon, 25 Jul 2011 10:13:48 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[off topic]]></category>
		<category><![CDATA[thoughtworks]]></category>
		<category><![CDATA[working for thoughtworks]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1186</guid>
		<description><![CDATA[I have some good news: I am going to be a ThoughtWorker. After two or three weeks of interviews, I have recently accepted their offer and going to start with the company in August. I am really looking forward to &#8230; <a href="http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have some good news: I am going to be a ThoughtWorker. After two or three weeks of interviews, I have recently accepted their offer and going to start with the company in August.</p>
<p>I am really looking forward to it, since many bright, passionate and talented people work for <a title="ThoughtWorks - Global Leader in Enterprise Agile Developement Services" href="http://www.thoughtworks.com/" target="_blank">ThoughtWorks</a>. The company is known for its cutting-edge technology development and being one of the global leaders in enterprise Agile development services. In other words, I am really happy <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I will keep writing updates from time to time about my experience at <a title="ThoughtWorks - Global Leader in Enterprise Agile Developement Services" href="http://thoughtworks.com/" target="_blank">ThoughtWorks</a>. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write Operations in DWR</title>
		<link>http://initbinder.com/articles/write-operations-in-dwr.html</link>
		<comments>http://initbinder.com/articles/write-operations-in-dwr.html#comments</comments>
		<pubDate>Thu, 21 Jul 2011 11:41:50 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[servlets]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=1061</guid>
		<description><![CDATA[Write operations are not allowed with the default session setting for the OpenViewInSession filter which is commonly defined in web.xml as a hibernate filter. If you want to enable write operations when using DWR (Direct Web Remoting), one of the &#8230; <a href="http://initbinder.com/articles/write-operations-in-dwr.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Write operations are not allowed with the default session setting for the <em>OpenViewInSession</em> filter which is commonly defined in web.xml as a hibernate filter. If you want to enable write operations when using <a title="Direct Web Remoting" href="http://directwebremoting.org/dwr/index.html" target="_blank">DWR (Direct Web Remoting)</a>, one of the ways is to declare a filter for DWR urls. Put the following configuration in your web.xml, also please note the url pattern in <em>filter-mapping</em> element.</p>
<p>[xml]</p>
<p>&lt;filter&gt;<br />
&lt;filter-name&gt;dwrWriteHibernateFilter&lt;/filter-name&gt;<br />
&lt;filter-class&gt;<br />
some.package.name.OpenWriteSessionInViewFilter<br />
&lt;/filter-class&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;singleSession&lt;/param-name&gt;<br />
&lt;param-value&gt;true&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;sessionFactoryBeanName&lt;/param-name&gt;<br />
&lt;param-value&gt;sessionFactory&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;/filter&gt;</p>
<p>&lt;filter-mapping&gt;<br />
&lt;filter-name&gt;dwrWriteHibernateFilter&lt;/filter-name&gt;<br />
&lt;url-pattern&gt;*.dwr&lt;/url-pattern&gt;<br />
&lt;/filter-mapping&gt;</p>
<p>[/xml]</p>
<p>The filter class as follows:</p>
<p>[java]<br />
// more imports<br />
import org.springframework.dao.DataAccessResourceFailureException;<br />
import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;</p>
<p>public class OpenWriteSessionInViewFilter extends OpenSessionInViewFilter {</p>
<p>protected Session getSession(SessionFactory sessionFactory)<br />
throws DataAccessResourceFailureException {<br />
Session session = super.getSession(sessionFactory);<br />
session.setFlushMode(FlushMode.COMMIT);<br />
return session;<br />
}</p>
<p>protected void closeSession(Session session, SessionFactory factory) {<br />
session.flush();<br />
super.closeSession(session, factory);<br />
}<br />
}</p>
<p>[/java]</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/write-operations-in-dwr.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is TDD Only for … Junior Developers??</title>
		<link>http://initbinder.com/articles/is-tdd-only-for-junior-developers.html</link>
		<comments>http://initbinder.com/articles/is-tdd-only-for-junior-developers.html#comments</comments>
		<pubDate>Sun, 24 Apr 2011 03:05:45 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=1027</guid>
		<description><![CDATA[Just before the Easter holidays, I had a discussion with two senior developers from my project about TDD. These guys are experienced software engineers that have been around for some time: they have 11 and 20 years of experience in &#8230; <a href="http://initbinder.com/articles/is-tdd-only-for-junior-developers.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just before the Easter holidays, I had a discussion with two senior developers from my project about TDD. These guys are experienced software engineers that have been around for some time: they have 11 and 20 years of experience in software development under their belts.</p>
<p>I don&#8217;t claim to be an advocate for TDD. Currently, I do not practice it (yet), but I do recognize and appreciate its importance. TDD really &#8220;forces&#8221; you to have clear understanding about the business requirements to be implemented. You cant implement what you do not understand, right? Because you have to write the test first, your code becomes more solid, less bug prune and you have better test coverage.</p>
<p>Sure, writing the test first its an interesting concept: You start writing a test, and you discoverer that you need a class, and possibly a function. You create the class, function and keep writing the test. Basically, you write few lines of test, and few lines of code, few more lines of test and few more lines of code etc. etc.</p>
<p>Ok, I think I diverted a bit, back to the topic <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The discussion took an interesting turn, and I still keep thinking about it. My question to them was &#8211; what do you think about TDD? The responses I received totally surprised me.</p>
<p>One of the claims supported by them, was that TDD does not serve much purpose, and a developer will end up re-factoring the unit tests eventually anyway as a result of re-factoring the concrete classes as the development goes on. So if latter is the case, my colleagues argued that there is no point writing unit tests first. Its better to finish writing concrete class, before attempting to write any unit tests.</p>
<p>Also, one of the developers claimed that many books and articles written on TDD discuss examples that are quite simple to implement, and in reality it is quite difficult to use TDD for complex business scenarios.</p>
<p>Another claim was that TDD should be used to teach junior developers the importance of unit testing, the experienced developers don&#8217;t really need to use it. The developers should follow KISS principles instead.</p>
<p>I respected their opinions about it, but it seemed fundamentally wrong to me that such experienced developers claim that TDD is basically overrated. The feeling that I got from them was that a lot of developers and software engineers in IT industry really got it wrong.</p>
<p>It got me wondering how, after more than ten years of experience in the industry, one does not appreciate one of the best software engineering practices around &#8230;</p>
<p>Offcourse, having said all that, I must point out that TDD is not suitable for every case. TDD can be effective only when it is clear what need to be implemented and there is a deep understanding of requirements.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/is-tdd-only-for-junior-developers.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Jquery UI: Add a Shadow Line Around a Dialog Box</title>
		<link>http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html</link>
		<comments>http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html#comments</comments>
		<pubDate>Sat, 23 Apr 2011 13:13:39 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[css dialog]]></category>
		<category><![CDATA[css modal dialog]]></category>
		<category><![CDATA[css popup]]></category>
		<category><![CDATA[css popup box]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=1000</guid>
		<description><![CDATA[I really like the style of Facebook (or LinkedIn) Javascript popup dialogs &#8211; a thin semi-transparent shadow line around the dialog. It looks nice and from the usability point of view it has a purpose, as it is attracts user&#8217;s &#8230; <a href="http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I really like the style of <a title="Facebook" href="http://facebook.com/" target="_blank">Facebook</a> (or <a title="LinkedIn" href="http://linkedin.com/" target="_blank">LinkedIn</a>) Javascript popup dialogs &#8211; a thin semi-transparent shadow line around the dialog. It looks nice and from the usability point of view it has a purpose, as it is attracts user&#8217;s attention to the important component on the screen.</p>
<p>There are many examples of custom Javascript dialogs on the Internet that explain how to achieve this. While many solutions are really good, I wanted to make use of the dialog provided by jQuery UI library by default.</p>
<p>I have came up with a solution that works, but I don&#8217;t think it is the most elegant way to do it (CSS is not my strong side). The solution is quite simple, and pretty straight forward (I think <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). The following are the final results as tested in FF3, IE8, Opera 10 and Chrome 10, please note the shadow line around the dialog:</p>
<div id="attachment_1010" class="wp-caption aligncenter" style="width: 310px"><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/ff-3.6.16.png"><img class="size-medium wp-image-1010  " title="Firefox - jQuery dialog box with semi-transparent shadow around it" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/ff-3.6.16-300x116.png" alt="Firefox - jQuery dialog box with semi-transparent shadow around it" width="300" height="116" /></a><p class="wp-caption-text">Firefox 3.6.16</p></div>
<div id="attachment_1011" class="wp-caption aligncenter" style="width: 310px"><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/ie-8.0.76.png"><img class="size-medium wp-image-1011  " title="Internet Explorer - jQuery dialog box with semi-transparent shadow around it" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/ie-8.0.76-300x136.png" alt="Internet Explorer - jQuery dialog box with semi-transparent shadow around it" width="300" height="136" /></a><p class="wp-caption-text">Internet Explorer 8.0.76</p></div>
<div id="attachment_1047" class="wp-caption aligncenter" style="width: 310px"><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/opera-10.63.jpg"><img class="size-medium wp-image-1047" title="opera-10.63" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/opera-10.63-300x124.jpg" alt="opera-10.63" width="300" height="124" /></a><p class="wp-caption-text">opera-10.63</p></div>
<p><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/chrome-10.0.648.jpg"><img class="aligncenter size-medium wp-image-1048" title="chrome-10.0.648" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/chrome-10.0.648-300x126.jpg" alt="chrome-10.0.648" width="300" height="126" /></a></p>
<p>First I defined a CSS class that&#8217;s going to have properties for the background shadow (the <em>bg_dialog_modeless_mask.png</em> is an 8&#215;8 gray square image)</p>
<p>[css]<br />
.dialog-mask {<br />
 -moz-border-radius:5px 5px 5px 5px;<br />
 -webkit-border-radius: 5px;<br />
 border-radius: 5px;<br />
 background:url(&quot;../images/bg_dialog_modeless_mask.png&quot;) repeat scroll left top transparent;<br />
}<br />
[/css]</p>
<p>Somewhere on my HTML page, I defined a DIV that&#8217;s going to be the dialog holder:</p>
<p>[html]<br />
&lt;div id=&quot;popup-holder&quot;&gt;&lt;/div&gt;<br />
[/html]</p>
<p>I added jQuery dialog init statement in my global JS file:</p>
<p>[javascript]<br />
$(document).ready(function(){</p>
<p> $( &#8216;#popup-holder&#8217; ).dialog({<br />
       autoOpen: false,<br />
       height: 350,<br />
       width: 530,<br />
       modal: true,<br />
       resizable: true,<br />
       draggable: false,<br />
       buttons: {<br />
         Cancel: function() {<br />
            $( this ).dialog( &quot;close&quot; );<br />
            $( &#8216;#dialog-wrapper&#8217; ).remove();<br />
         }<br />
      },<br />
      close: function() {<br />
            $( &#8216;#dialog-wrapper&#8217; ).remove();<br />
      },<br />
      open: function() {<br />
            wrapJqueryDialog($( this ));<br />
      },<br />
      resize: function() {<br />
            wrapJqueryDialog($( this ));<br />
      }<br />
   });<br />
});<br />
[/javascript]</p>
<p>The <em>#dialog-wrapper</em> is the ID of the DIV that holds the semi-transparent shadow which wraps the dialog. The <em>wrapJqueryDialog</em> function creates the shadow when dialog is opened, and handles the shadow resize when dialog is resized (it is also possible to add an event to drag the shadow when dialog has <em>draggable </em>option set to true).</p>
<p>Now the important part, the <em>wrapJqueryDialog</em> function:</p>
<p>[javascript]<br />
function wrapJqueryDialog(dialogWidgetObj)  {<br />
	//The width and height of the shadow line wrapping the dialog<br />
        var shadowWidth = 20;</p>
<p>        //Lets remove the shadow holder to start clean<br />
	$( &#8216;#dialog-wrapper&#8217; ).remove();</p>
<p>        //Gets the current dialog widget<br />
	var widget = dialogWidgetObj.dialog( &quot;widget&quot; );</p>
<p>        //Create the shadow holder DIV that has the background shadow CSS class<br />
	var dialogwrapper = $(&#8216;&lt;div id=&quot;dialog-wrapper&quot; class=&quot;dialog-mask&quot; /&gt;&#8217;);</p>
<p>	//For IE, the holder must be appended to the body first before any manipulation.<br />
	$(&#8216;body&#8217;).append(dialogwrapper);</p>
<p>        //Lets copy default inline styles from the dialog widget to the shadow holder<br />
	dialogwrapper.attr(&quot;style&quot;, widget.attr(&quot;style&quot;));</p>
<p>        //Lets position the shadow holder before and above the dialog widget<br />
	dialogwrapper.css(&quot;top&quot;, parseInt(dialogwrapper.css(&quot;top&quot;)) &#8211; shadowWidth);<br />
	dialogwrapper.css(&quot;left&quot;, parseInt(dialogwrapper.css(&quot;left&quot;)) &#8211; shadowWidth);</p>
<p>        dialogwrapper.css(&quot;position&quot;, &quot;absolute&quot;);</p>
<p>	//Make sure that the dialog widget is infront of surrounding shadow box and overlay (if there is one set)<br />
	widget.css(&quot;z-index&quot;, (parseInt(widget.css(&quot;z-index&quot;)) + 1));</p>
<p>	//Add to the shadow width default padding value from the class &#8216;.ui-dialog&#8217; and<br />
	//default border width from the class &#8216;.ui-widget-content&#8217; (1px times two)<br />
	var finalShadowWidth = shadowWidth + parseInt(widget.css(&quot;padding-top&quot;)) + 2;</p>
<p>	var widgetHeight = parseInt(widget.css(&quot;height&quot;));<br />
        //Lets extend the shadow holder height<br />
	dialogwrapper.css(&quot;height&quot;, widgetHeight + (finalShadowWidth * 2));</p>
<p>	var widgetWidth = parseInt(widget.css(&quot;width&quot;));<br />
	//Lets extend the shadow holder width<br />
        dialogwrapper.css(&quot;width&quot;, widgetWidth + (finalShadowWidth * 2));<br />
}<br />
[/javascript]</p>
<p>That&#8217;s all when it comes to code (don&#8217;t forget to add to your HTML/JS code a dialog trigger, it can be a link or a button). I am really interested to hear your comments about it and suggestions. If you can suggest a better way of implementation &#8211; please do so, I am really keen to know <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Java, Good Ways – A Book of Unwritten Rules, Tips and Gotchas</title>
		<link>http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html</link>
		<comments>http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html#comments</comments>
		<pubDate>Tue, 19 Apr 2011 06:37:49 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[java book]]></category>
		<category><![CDATA[java tips]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=996</guid>
		<description><![CDATA[A colleague of mine, who is currently my tech lead, wrote a book. The book Java, Good Ways is a collection of unwritten rules, tips and gotchas collected over a long period of time. The book comes to minimize the &#8230; <a href="http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A colleague of mine, who is currently my tech lead, wrote a book.</p>
<p>The book <a title="Java, Good Ways" href="http://javagoodways.com/" target="_blank">Java, Good Ways</a> is a collection of unwritten rules, tips and gotchas collected over a long period of time. The book comes to minimize the gap between university studies and what Java developers actually need to know.</p>
<p>Have a look, read through, let me know what you think or simply leave a comment on Java, Good Ways <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- This Quick Cache file was built for (  initbinder.com/feed ) in 0.52848 seconds, on May 27th, 2012 at 2:31 am UTC. --><!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 27th, 2012 at 3:31 am UTC --><!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --><!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for (  initbinder.com/feed ) in 0.00066 seconds, on May 27th, 2012 at 3:20 am UTC. -->

