Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code standardisation #27

Open
ehkropf opened this issue Aug 4, 2014 · 2 comments
Open

Code standardisation #27

ehkropf opened this issue Aug 4, 2014 · 2 comments

Comments

@ehkropf
Copy link
Collaborator

ehkropf commented Aug 4, 2014

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
Copy link
Collaborator Author

ehkropf commented Aug 8, 2014

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
Copy link
Collaborator Author

ehkropf commented Aug 8, 2014

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

  • Variable/property names are all lower_case_with_underscores.
  • Class names are all lowercase.
  • Method names that get a lot of command line use should be short and all lowercase.
  • Method names used mainly internally by the classes are lowerCamelCase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant