Nick

19%
Flag icon
Another use for white space is to accentuate the precedence of operators.    public class Quadratic {      public static double root1(double a, double b, double c) {        double determinant = determinant(a, b, c);        return (-b + Math.sqrt(determinant)) / (2*a);      }      public static double root2(int a, int b, int c) {        double determinant = determinant(a, b, c);        return (-b - Math.sqrt(determinant)) / (2*a);      }      private static double determinant(double a, double b, double c) {        return b*b - 4*a*c;      }    } Notice how nicely the equations read. The factors ...more
The Robert C. Martin Clean Code Collection (Collection) (Robert C. Martin Series)
Rate this book
Clear rating
Open Preview