TIP : Having issues with loading classpath resources using java ?

I almost spent a day trying to understand why my unit test case was able to load a resource where as once I deploy the jar failed to load the same. In the end I came across something very basic : Some.class.getResource behaves differently than Some.class.getClassLoader.getResource. There is no simple answer like use this always. It depends on which class loaded loading that particular class. So if you are facing such issue try checking both options.

Improve development speed by right work environment not JUST by new technologies

How many times have you banged your head against the monitor or seen others doing so when the poor dumb machine goes dumb literally!? Must be a lot of times for most developers. If not, you are a blessed child and you need not read further :).There is no use if you keep hitting the ENTER button or keep yelling at your machine when the machine cannot support what you want it to do… Now-a-days, companies are after new languages and technologies like RoR, Scala etc to improve developer speed. They have started following agile methodologies and hiring expensive coaches; paying a lot for agile certifications (really a lot :( ). Yes, all of these have actually improved efficiency. But in the thick of such ‘big’ things, aren’t they missing out basic stuff which will enhance developer efficiency? For instance, is it not a basic necessity to have a proper work environment, proper infrastructure that can support such ‘big’ things?

Continue reading

The biggest myth of quality code : 100% Test coverage

How many of you believe you have quality code because you have good test coverage? Or how many of you feel you are working with bad quality legacy code because it doesn’t have any test coverage? Recently every organization started focusing on quality especially automation. Started putting people to increase unit test coverage. But did you question : Did you gain anything out of it? Is your code quality improved? How long these test cases will be relevant ? Do you think developers would be comfortable modifying it when code changing?

Continue reading

Tip : Exclude trivial getters/setters/constructors from cobertura code coverage report

When it comes to quality first thing we say is “90%” code coverage. To me whats important is 100% coverage for code that is doing some non-trivial work. For java code you can avoid trivial code and classes easily . Just use following configuration.

<plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>cobertura-maven-plugin</artifactId>
		<version>2.6</version>
		<configuration>
			<formats>
				<format>xml</format>
				<format>html</format>
			</formats>
			<instrumentation>
				<ignoreTrivial>true</ignoreTrivial>
				<excludes>
					<exclude>**/some/trivial/classes/**</exclude>
				</excludes>
			</instrumentation>
		</configuration>
		<executions>
			<execution>
				<goals>
					<goal>clean</goal>
					<goal>check</goal>
				</goals>
			</execution>
		</executions>
	</plugin>

Code Snippet of the Day : Developer friendly environment specific code

// This is used in the local environment. comment this when deploying to Unix box 		
//	File propertyFile = new File("Some.properties");
		
// This is used when deploying in Unix this is used.
File propertyFile = new File("/home/mr.x/secrtet/prod.path/some.properties");	

Above code is self explanatory. Too good code and superb documentation ;) .

For God’s sake, “keep it simple”

If someone asks me what is the best practice to finish a software project successfully, I say “Keep it simple”. Well you heard it many times. But actually did you follow it. In fact its quite simple to keep things once you leave your ego and selfish thoughts away. If you think I am just bullshitting I can make you agree by the end of this blog. Continue reading

Google web designer : is it actually for designing web?

Today Google has announced beta release of “Google web designer” – “Create engaging, interactive HTML5-based designs and motion graphics that can run on any device.” Like any other google product, webdesigner is quick to download and install. Quite amazed with the ease of installation and I have immediately started building small web page with it. But after just 10 mins I realized that this tool is not a web design tool but “Ad Designer” or you can call it as “Ad Studio”. This is not at all for developers. This is a tool for advertisement agencies to design animated ads to publish on google ads.

Google continued to be the master of simple and most user friendly design. Tool UI looks awesome and it has a light weight feel. But my excitement ended here :(. I was expecting a good tool to quickly build html pages. But its timeline , 3D drawing and color palette features are clearly suggest this is not for creating a web page which is more of contents than animating things around.

googleWebDesigner

Except some simple animations, most of the animations are nothing but a match (geometrical) function. Not sure how much this tool can help developers to create animations even. Lets see what google would add to make it more web designer tool.