complexvariables / conformalmapping

Conformal mapping toolkit for MATLAB
Other
11 stars 9 forks source link

Code standardisation #27

Open ehkropf opened 10 years ago

ehkropf commented 10 years ago

The development guide needs to be revisited to cover coding style. The Chebfun style guide is a decent place to start. I'm also partial toward the Python style guide.

Existing issues this covers:

ehkropf commented 10 years ago

How enamoured are we of the idea that things should be "matlab-like" in their behaviour? (Like in the discussion for #12.) Should we just move to the structure style syntax for class properties and away from the old style?

If there is a need for an external type property access -- I'm thinking in particular of the angle() method in the polygon class -- we just make sure the property has a different name (without my infamous trailing underscores). Thus polygon.angle_ might then be polygon.angleList or something. Then in the class methods if we're worried about variable and property name clashing, and some of us are because OCD, we can adopt a trailing underscore for a method variable.

I guess the bottom line is that I'm now sold on @tobydriscoll's initial suggestion that names exposed to the user as public properties shouldn't have underscores. I'm willing to dig through the code and get this sorted.

ehkropf commented 10 years ago

For name style (variable, method, class), I propose the following.

I generally like UpperCamelCase for class names, but class names here sometimes get a lot of command line use, so should probably be short and lower. I also like the idea of the lower_with_underscores for variable names, since it's easy to quickly distinguish them from method names, but maybe that's not so important in matlab.