Saturday, November 29, 2008

Finding Patterns in how things work


I've recently been getting exposed to various techniques or patterns used by programmers to solve specific problems, and have wondered if there could have been better ways of designing it. TOday I lay my hands on some material on design patterns and it brought back to me the thrill of solving puzzles and problems! Sometimes when you're looking into the nitty gritty details you lose sight of the wonderful bigger picture. These design patterns have been evolved from years of learning of one's own and others' mistakes and successes, and most existing problems already have a suitable design pattern ready to be used. For most usecases, designing the software can become as simple as fitting the requirements to an available design pattern.

Composition is better than inheritance.
I was going to take an example of a Strategic design pattern, but decided against it as I didn't want my blog to read like a textbook! Essentially, the difference between using inheritance to 'implement' a property, and composing the object with it, is that in the first case, the implementation function has to be defined in the base class itself. In the second case, the design is cleaner and more maintanable, in a separate class.

This Strategic pattern is very commonly seen in code. Whether you use design patterns during the design phase or implementation phase will only depend on how good you are at anticipating/recognizing common functionality!

Do we really need to know design patterns to be a good programmer? What you see in any of the design patterns is basically, solid OO design. Given an existing system, knowing design patterns will help us understand them real quick, as they inevitably implement one of the design patterns or its variations. If you are building a new system too, this knowledge can prevent you from re-inventing the wheel and improve your productivity!
'Write once, run anywhere!'

Sunday, November 23, 2008

Many technologies, one platform

A couple of links every java developer needs to bookmark and visit :

http://java.sun.com/javase/technologies/
http://java.sun.com/javase/reference/index.jsp

'Write once, run anywhere!'

Thursday, November 20, 2008

Finding bugs the easy way

eBay uses its own version of FindBugs ( a static analysis tool) to run a check before any of its code goes LTS ( Live to site). This has been made a a part of eBay's business unit project lifecycle itself. Recently I moved into a team that owns some of eBay's internal tools related to build and release of its code. As these don't affect live ebay code directly, much of it has bypassed strict coding guidelines that the rest of ebay follows as their mantra of living.

Yesterday I ran eBay's own version of FindBugs on one of these tools and came up with a bunch of findings! Just studying the potential bugs reported could make you a great programmer ;)

Did you know that a simple s.o.p in your java code could bring down your app server? Or for that matter, an e.printStackTrace() at the wrong place? You can even integrate FindBugs with your ant build. For more info check out the findbugs website! Sometimes you may want to ignore certain types of bugs. You can make in eclipse to filter out these.

Tuesday, November 18, 2008

Welcome home!

Hello folks!

Thanks for visiting my blog! Join me at home for a steaming cuppa java everyday as I share my experiences of fun & discovery

Keep dropping in!