While migrating an e-commerce application (piqchocolates.com) from Grails and Tomcat to an AngularJS, Java EE (JAX-RS), and JBoss WildFly stack, I had to make sure that the new platform has feature parity in all areas that are valuable to our business. Search Engine Optimization (SEO) is crucial for us because we primarily market our business on-line. In short, we need search engine optimized URLs, and deep linking; this article will show you how to implement both.
When developers choose to enforce Static Analysis tools (i.e. JTest or PMD) they might have the best intentions at heart, but are actually making the code worse in the long run. The value of the programmer’s experience and expertise on the code is not considered.
Static analysis tools are automated programs that run a set of rules against source code to produce metrics, and give advice on best practices.
So why does using these tools lead to bad code?
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.
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.
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));