[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Code analyze

adrian@jboss.org do-not-reply at jboss.com
Mon Oct 2 07:28:38 EDT 2006


In general only make these changes if it improves the
readability/maintainability of the code.

e.g. removing dead/unnecessary code gives less to maintain
in future.

Removing temps doesn't change the semantics of the code
so it doesn't really change anything.
In some cases, temps are more optimal.

e.g. code that doesn't use a temp that should:

  | doSomething(getSomethingLotsOfWork());
  | doSomethingElse(getSomethingLotsOfWork());
  | 

Also temps are useful for tracking down NPEs.

  | object.getSomething().getSomethingElse();
  | 
should be

  | temp = object.getSomething();
  | temp.getSomethingElse();
  | 
So you know which part was null when you've only got the line number.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975464#3975464

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975464



More information about the jboss-dev-forums mailing list