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

RMG style #278

Open
keceli opened this issue Nov 22, 2012 · 1 comment
Open

RMG style #278

keceli opened this issue Nov 22, 2012 · 1 comment

Comments

@keceli
Copy link
Contributor

keceli commented Nov 22, 2012

As we discussed in RMG meeting, it would be a good time to format the code once we come to the release stage.

Eclipse has a built-in formatter style named Java Conventions and if you don't have any objections, I plan to use it with modifications based on your suggestions. It has a mixed (both tabs and spaces) indentation, attached braces and 80 character line limit for code and comments. Let me know any of your preferences, if they differ from the default settings.

Currently, I plan to modify the default style by enabling:
Header comment formatting,
Never indent line comments,
Never indent block comments,
Off/On tags.

If you want to keep the original formatting for certain files, you can add //@Formatter:off line to the beginning of the code.

There is also a nice documentation on suggested Java conventions on Oracle web site for future reference. (http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html)

@jwallen
Copy link
Contributor

jwallen commented Nov 26, 2012

Establishing a coding convention is a good idea. I think the Eclipse defaults are generally fine. Some additional thoughts:

  • Hard vs. soft tabs. Over the years people have used both (with different numbers of spaces per tab), and the result is that many of the files are really difficult to read, no matter what your editor is set to. An informal poll of the people sitting around me and recent programming language style manuals suggests soft tabs (4 spaces per tab) is the way to go. This is also nice for the Fortran code, for which tab characters are not technically allowed.
  • File encoding. I suggest UTF-8 for everything, since most things are just plain text. This hasn't been as much of an issue, but still worth enumerating.
  • Function and variable naming style. I think everyone uses camelCase (as taught in most Java textbooks I've seen).
  • Comment style. Javadoc format seems like a good choice here.

If we were sticking with Java, I'd also want everyone to learn how to use JUnit to write unit tests, but since we're probably switching to Py I'd say learn it in Python instead.

Also, we should update the headers at the top of the source files when we clean up the formatting, e.g. to update the copyright date.

nickvandewiele pushed a commit to nickvandewiele/RMG-Java that referenced this issue Jul 1, 2014
The mixture of spaces and tabs was driving git crazy.
In anticipation of ReactionMechanismGenerator#278 (comment)
I have opted for soft tabs (4 spaces).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants