The only thing that stays the same, in our field of Computer Science, is change itself. Do not try to predict what will happen in the future; instead know that the future will bring change, and that you will need to adapt to it.
Design systems which are capable of change, and you will be much more ready for the future.
Read the rest of this entry »
After reading a recent article on logging, and when you should and shouldn’t do it, I asked my father for his views. He has about 25 years of experience in both small companies and large corporations, and got me thinking about some things that I hadn’t before.
Read the rest of this entry »
Tagged Under : Logging
Today’s subject is a well commented square root approximation method. Imagine that this method is buried deep in a very messy Java class. How can we make sure that this code is reusable and that our comments don’t become out of date as our code changes?
/**
* Approximate the square root of n, to within the specified tolerance,
* using the Newton-Raphson method. This method takes two arguments:
* @param Double n The number to be square-rooted
* @param Double tolerance the error tolerance
* @return Double result of square root operation
*/
public Double approximateSquareRoot(Double n, Double tolerance)
{
Double root = n / 2;
while (Math.abs(root - (n / root)) > tolerance)
{
root = 0.5 * (root + (n / root));
}
return root;
}
Read the rest of this entry »
Tagged Under : Java