Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

(warning) Under construction

API design guidelines

The following guidelines are meant to make the user experience more pleasant. They are aimed to help the user make use of existing tools and increase productivity. As a first guideline, keep in mind that somebody other than you will use your code.

...

(thumbs up)

(thumbs down)

Code Block
class SimpleParameterClass {
public int spaceX;
public double tanPolarPhi;
public float cosLine1Line2;
}
...
SimpleParameterClass parms = new SimpleParameterClass();
parms.spaceX = 17; // you can simply set it
...
System.out.printf("%f", parms.cosLine1Line2); // or get it -- no need for encapsulation
Code Block

double[3] parms = new double[] {17, 3.4, 2.5};
parms[2] = 2.5; // Which one is it ???

|

Optimization

Optimization obfuscates code. It also forces you to change your intuitive approach.
Rule: First, write your code. Then profile it. Then, if necessary, optimize it.

...