jump to navigation

What do you look for in Performance June 23, 2005

Posted by javafoo in java interview, javanotes.
add a comment
  • When selecting rows from database, is filtering being done by SQL or by java.
  • Referencing and de-referencing objects, especially in recursion.
  • File processing, are you buffering your reads or reading the entire file into a glob of String.
  • Cache read-only data.
  • See where the code is spending more amount of time
  • More to come…

What do you look for in Code reviews? June 23, 2005

Posted by javafoo in java interview, javanotes.
add a comment

We do a lot of this unconsciously during code reviews, but when asked we turn a blank face.

  • First the usual suspects, is the code doing what is functionally required, business logic, especially if the team member is new
  • See that there are no hard-codes, standards are being followed.
  • Is there chance to make something configurable, like lookups. See that these are being read from properties files or the database, that way any new additions don’t need a code release.
  • Are connections, jndi lookups being cached.
  • Code re-use, both classes and methods.
  • Kludge.
  • Performance considerations, StringBuffer vs String and so on.

Pass by value vs. Pass by reference June 23, 2005

Posted by javafoo in OOAD, java interview, javanotes.
1 comment so far

Always pass by value, if you ever say pass by reference, you will be rejected for sure. (in the interview that is)
You don’t believe me, this guy explains it far more better than I ever can.

Checked vs. Unchecked Exceptions June 23, 2005

Posted by javafoo in java exceptions, java interview, javanotes.
1 comment so far
  • Checked exceptions are checked at compile time (not exactly checked, but the compiler knows will occur since they are declared as being thrown during compile time), so the compiler will crib if you don’t handle them.
  • Unchecked exceptions only occur at runtime, mostly extend RuntimeException, these can’t be checked, usually occur due to program errors, such as NullPointerException
  • There have been holy wars waged over this topic.

Difference between Abstract and Interface June 23, 2005

Posted by javafoo in OOAD, java interview, javanotes.
1 comment so far
  • Interface only provides the contract, does not add default behaviour, whereas abstract classes provide default behaviour (not necessarily, only if you want to, but that is the point)
  • You can implement as many interfaces as you may want, but only extend from one abstract class
  • You cannot have private, protected variables in an Interface.