December 28, 2012

“Be careful of …

Filed under: Uncategorized — khangharoth @ 1:59 pm

“Be careful of what you ask, because you may get it”

If I get a chance to relive my life that’s one thing I want my younger self to imbibe deep in  subconscious mind.

The problem is Butterfly effect , its hard to imagine all probable scenarios where you might be worse off when you actually thinking about a specific problem.

Its not really great time to be a central banker neither its for  a common man who puts faith in these masters of universe to do what’s right ……for the mankind !!

I don’t much about economics to say whether Pual krugman idea’s are stupid or not but when Mark Carney  (slated for BOE job) talks about nominal  GDP or BOJ trying desperately to have some inflation – I know  something is not right.

Can we do anything about it ?  Don’t think , so eat , code and be light on debt !!

January 7, 2012

Come On America ! – Do the right thing, Choose Ron Paul !!

Filed under: Uncategorized — khangharoth @ 2:30 pm

I don’t really write about anything which is non technical but this is something which I feel we should raise our voice  –  Its not that Capitalism has failed ! , its the Socialism (In western world)disguised as Capitalism  which is failing .

I live in India and actually quite sad about the kind of politician we have .

Over the years hearing Ron Paul on Federal Reserve , Gold other economic issues used to give comfort feeling that developed countries ,Do have politicians who understands current issues and are ready to fight for better tomorrow  .

Made me  hopeful  that as India would progress we would also have politician like Ron Paul.

After  Iowa caucus , Ron paul is now considered more and more mainstream candidate who is in race to make a difference to current economic system which is already moribund.

Come on America ! people across the world are looking at you.

October 16, 2011

TDD Red-Green-Refactor – Missing Refactor step

Filed under: Software Design — khangharoth @ 3:24 pm

The code base of our project does not  look any bit like Uncle Bob’s  clean code examples – Why ?

This question was in my mind for long –

In spite of doing TDD where everyone writes tests first then why our code base is still sub standard ? Why we have lots of disjointed test cases and code base which is not cohesive ?

Initially the answers I was getting from myself were :

a) May be what works for  a simple one class problems don’t scale for big projects.

b) But then their are parts of our System which are beautifully written(done by a individual ) – So this process is working for  some and not for others .

What if those guys would anyway write better code than rest of us – be TDD or not ?

With all these questions in mind – I took  a SVN update to start on a Jira (bug) . When I looked at the relevant class  – It took me around 10-15 mins to understand what it was doing and the fact that it had test cases made no difference in my ease of understanding that piece of code.

How can we invariably ends up with something like this – Even though we are doing everything right ? – I went through svn check-in history something  struck to me – We Are Missing The All important step of Refactoring !

When we learn about TDD – its being taught as Three Simple Steps

RED – Green -Refactor

But when we started using it , we reduce it to just two step !

Red-Green  , Red-Green , Red-Green – The important step which binds everything together and which gives shoulder to the Simpleton Advice (do the simplest thing to make the test pass) to stand on , Refactoring, is actually being forgotten .

If you and your team is new to TDD process – Make sure that you are also not missing the integral step of Refactoring !

October 29, 2009

Intelij Idea : One more Casulty of Open Source

Filed under: Uncategorized — khangharoth @ 8:45 am

You might be already aware of the fact that JetBrains have released core Intelij framework as free and OpenSource.

Although am happy with Eclipse and contrary to many people who blasts Eclipse for flaky behaviour , Eclipse have worked very nicely for me .I am quite happy with eclipse (especially with Galileo) and huge plugins for almost everything .

Still I decided to try Intelij and see what’s all are in for offer , also to see what’s new have come in since 3 yrs (last I used Idea ).

Recently I have to come up with a small desktop GUI to demonstrate an idea and thought best possible way is to use NetBeans for Swing GUI builder capabilities . Even saying that NetBeans is a good IDE is kind of understatement.

So now we have 3 very good IDE’s in java world and all three are Open Source ! This only augurs well for Java related technologies,as sometimes not the technology but the support tools around it make the last mile difference between its adoption and rejection.

So high five for Open-Source and its has kind of proved that selling commercial products in era of Open-Source would be really tough and challenging , Even if you have a superior product.

September 29, 2009

FrameWork: Spring-JPA-Hibernate (Annoation Based)

Filed under: Architecture,Java,JEE — khangharoth @ 4:56 pm

This skeleton web framework I wrote for Quarks , as they wanted a core framework on top of which they can build the applications.

As I had a luxury to design a Framework from scratch and so decided with these technologies.This dev stack is now becoming a vary dominant framework or to say in developers words “The next Popular Stack”.

Testing env I have used in this framework is TestNg , which I feel is much more suited to present day testing needs than our old JUnit(even after realese of Junit 4).

And with JDK 5+ , Spring 2.5+ which give support for Annoatations , you can have a very Simple yet very powerful framework to work with.So with this what we have is

  • Spring as a Application Framework
  • JPA as Persistence Framework (Hibernate as JPA impl)
  • Annotation based Transactional Control.
  • Spring Dependency injection with Annotation.
  • Spring MVC : This can be changed if you want to use something else.
  • Annotation based Validation framework.

These all elements give us enough power to create a generic and robust framework ,which can be customized for various needs.

Now let’s get to the actual work ……

Core Design Principle : The whole framework is desigend in Layers.Each Layer can only be called by layer above it and no skip hierarcy call’s are allowed.

Various Layers are

  • Web : Comprises of Spring MVC & JSP , this is due to the fact that most developer in quarks are quite familiar with JSp and so we wanted to start with this.Although I am not really happy with technology choice and wanted to have GWT or Flex based GUI.
  • Delegate : This is logical seperation between Web(Front End) and Service (back End).If you think that GWT or you something else suits you then this is the place where you should take a detour.
  • Service : Spring based beans, annotation based Dependency & Transaction management.
  • DAO : Db access layer , based on JPA and using hibernate as Persistence provider.
  • Persistence Domain model : Java Beans on lines of JPA Entities.

So the principle is that a layer can only call layer below it so in this Web —-> Delegate and any call direct to say services or DAO’s should be discourged.

Another way to see this is that if we just delete a particular Layer then code below it should compile just as fine without any problem.

I wanted the package structure to reinforce this idea  .Also its easier for a new person to see as how the packages are organized . The package structure is

  • com.quarks.a.web.controller
  • com.quarks.b.delegate
  • com.quarks.c.service
  • com.quarks.d.dao
  • com.quarks.e.persistence

Used a,b,c,d,e so that packages are shown in order in project view and aslo it gives clear idea of dependency in project.

Now looking at this I can easily say that DAO is only dependent on persistence pacakge.

Note : Still in edit , I’ll upload code as well . Please do give your valuable opinion about how can we have a Generic framework on this Dev Stack .

September 28, 2009

Type Safety in Api’s

Filed under: Uncategorized — khangharoth @ 2:26 pm

As of now am working on a fairly big  project which intended to have impact on entire bank level architecture and should be in use for more than 10 yrs .We didn’t got number 10 yrs from any mathematical calculation but it was a way to convey the message, that return on this sort of project typically comes after 5-6 yrs.

So after knowing very well that their will be many systems using your System and for  fairly long lifesapn , How do you design you Api’s ?

This particular  system is supposed to be a Cluster on Distributed Grid and will give option to other Systems to get data from Cache rather than hitting RDBMS and going forward the plan is that all System just work on top of this grid and so for them no Db calls !!

Now this systems will have fairly big outward facing Api’s and question in our mind was how to design these sort of Api’s. One important aspect of this design analysis is

What level of type safety we should have ?

Although with introduction of Ruby etc in mainstream programming , java static type saftey is preety much under attack.But my experience suggest that if you have a project on which more than 10 people will code than this is really a very important aspect to see while choosing a language . And this can be seen in Java’s success in big server side projects.

Now coming back to the point , how important is Type Safety in you Api’s which are exposed to outside world(other than your team) ?

Well answer from my side is very much , don’t give user a chance to call your Api’s with Generic Arguments.So while designing you Api’s try to be as as type safe as possible .

  • Don’t take generic String as argument’s for everything and then do conversion’s .
  • It really difficult to find a usecase where a method takes a argument as Object or return’s a Object.
  • If you have such methods then examine them closely or this may be perfect case to show your Generics knowledge.

While pondering over this i came across this article and really enjoyed reading it ,as it reinforces the concept that your api’s should be type safe and this should happen at compile time.

Also its a good news that Criteria queries will be part of JPA 2.0 which i think was most missed feature in JPA especially when you have hibernate as persistence provider.

September 11, 2009

Evolvoblity in Software System …

Filed under: Uncategorized — khangharoth @ 4:20 pm

Right now working on this and its kind of really interesting problem

So what’s the problem we want to solve :

  • Say We have a central Server/Cluster/DataStore.
  • Many Clients accessing this Central thing.

Let’s take a specific case for better understanding.

You want to have a trading platform : It will consist of

  • Trade booking applications : We can have mutiple apps say for Equity/Derivatives/FX etc.
  • Central Data store : Resonsible for data storage and single source of data for other applications
  • Middle office Systems like Confirmation Systems ,Settlements Systems etc.
  • Back Office Systems.

And in out System we have a class defination of Trade : a,b,c as attributes.

Currently everybody has this Class defination and they are able to Read/Write happily.

But what if  a Client want’s to add a new field( d )to this Trade class and want to use that ?

Do all the other Clients/Central thing needs to be Upgraded as well ? For practical purposes this may not be desirable.

So then how do you design your System where a Single client upgrades to new version and its using new fields but other clients are still running on older version , its just that they don’t see the d field but can work with a,b,c .

It turned out that this is not so difficult to achieve!

The real problem is if a Client adds a New SubClass (new trade type,having extra field d ) and still other clients can read this ,same as before ,able to work on as Trade class (on  field a,b,c without knowledge of d).

August 23, 2009

Generating Java Code on the fly!

Filed under: Java,JEE — khangharoth @ 3:31 pm

Currently I am working on a Grid based Cache (Coherence) in my regular job.

The concept is that differenct System can just use the Cache and do the stuff and its very easy and fast to share information.No XMl’s being excahnged and no bickering on XSD’s etc.

The thing  is in this process we were end up writing so much similar code for Serialisation purpose (PofSerialisers) and thought the this code can be auto generated.

And with this thought in mind when we looked at the problem that our Cluster needs to support various version of our core Domain model ,let me explain this problem better :

Let’s assume we have a class with 2 attribute and we call this versionV1 so we have T-V1.Now some new attributes are added and we have T-V2 and henceforth.But its very likely that some clients of this Cluster would not like to upgrade and would still be using T-V1 .


To code and maintain multiple versions of Data model is big task and so we decided to go ahead with concept of auto-generating the java code giving a schema file.

This is the first time i am doing something like this.Its ok to generate Stubs/Skeletons which we use in Web-Services to get auto generated but to use auto generated domain objects and this is used everywhere in project is something first time for me.

So initally our project just have Classes having business logic and these are not compilable becuase all domain classes which they use are just not their ! and when we invoke compile goal of Maven pom file ,these domain classes get generated with their Serialsers and now we have fully fuctional code 🙂 which can be deployed.

June 16, 2009

How Agile turns into Fragile

Filed under: Uncategorized — khangharoth @ 3:19 pm

I really like Agile  methodologies  especially because of its focus on  iterative development which encourages frequent inspection and adaptation.

But i would have been very happy if this was incorporated in normal working practises rather than giving a new fancy name.Now it gives a license to Managers to change requirement at any point in time and if you get back to them ,they will teach you about Agile way of doing work.

So how people have changed Agile to Fragile.

  • Requirement evolves  (To)  Reguirements can change anytime and to anything.
  • Document what is necessary (To) E-mail’s are good enough documents.

May 23, 2009

Book Review of “Java Power Tools”

Filed under: Uncategorized — khangharoth @ 7:24 am

I am currently reading Java Power Tools , came across this book on John Ferguson Smart blog.I quite regularly read his blog as he generally writes about current java landscape and good overview of problems faced in current set up say release management,branching strategy ,continuous integration etc.

So on weekend just went out and got a copy of it from nearest Book store ‘Landmark’ in gurgaon.

After going through the index i noticed that we were using mostly all the technologies in various projects barring

a) Continuum,LuntBuild : I am happy with Hudson and no itention of switching to another CI server.

b)Openfire : Haven’t heard of it ,will try to dig deeper into it.

c)JunitPerf ,Jmeter ,Jupiter etc:We are using something else but would like to know more about them especially JunitPerf and Jmeter.

After going through couple of Chapter i noticed that this book is written in very simple and clearly demonstrated the rational behind using these technologies .May be its due to the fact that  i was already familiar with most of the technologies mentioned in the book .

In all i would recommend this book to java developer for a reference book for what’s all tools available for their arsenal.

Few things standout for me :

a) TestNG :

Author pointed this as Next-generation Testing and in my view this is very apt definition for TestNG.Junit has not kept pace with growing demands in testing space and Junit4 is also bit of disappointment.It still lacks on many features and i think way behind TestNg.

One thing i find missing in TestNg chapter is migration strategy and examples for Migrating to TestNG from Junit.But otherwise other aspects of testng were well explained like Test LifeCyclye,managing dependencies in test cases,parallel testing etc.

b) Continuous Integration :

This book cover this topic quite well and give a good overview of various tools available for this like hudson,cruise-control,continuum etc so well covered topic.

c) Profiling and Monitoring using Sun JDK tools:

Its really good to see that this book pointed out some very handy tools available to developer right under their nose ex: Jconsole is really good tool for thick client application monitoring.

I still don’t know why the tools which come bundled with JDK are not so popular inspite of such a  great use.

What this book missed :

a) Aspects :

Aspects is a mainstream concept now and could have been incorporated in this book.AspectJ have now really matured and now comes with good support in IDE like eclipse and Idea.

b) Design analysis tools :

Some insight about determining health of your current project.Some tools which can be discussed are CAP ,JDepend .

c) UML and Reverse Engineering tools :

I think this is also a topic worth considering in this book .Their are some good offerings from IBM which integrated well with Eclipse (although paid).

eUML2 from Soyatech is another good tool for UML and comes with very good eclipse plugin .

In all its a good book for getting a feel of Java landscape. (more…)

Next Page »

Create a free website or blog at