CodingConventions

From Eigenpedia

Jump to: navigation, search

In the primeval days of Eigenbase development, there was a very simple rule for code style: "When in Rome, do as the Romans do." In other words, as long as you make your code look like what is already there, everything will remain uniform by induction, and if you want to do things some other way, well, you're always free to start your own open-source project somewhere else and make up your own conventions.

It's still an excellent rule and deserves to be followed, but the project has grown to the size where it's a good idea to spell out exactly what it is that these "Romans" are doing. So our anthropologists have been busy, and the result of their research is written up on these wiki pages:

If you feel you simply cannot abide by something you read here, or if you'd like to suggest a new convention, please edit the page, add and sign your comments, and then post to the appropriate mailing-list requesting review. If you are able to achieve consensus on a change, then update the page to remove all review comments and make the change permanent. Otherwise, move the discussion to a separate wiki page for archival purposes, link to it from the convention under dispute as a rejected amendment, and follow the original rules in your coding.

What should you do if you see existing code which doesn't match these conventions? If it's in an area you're working on anyway, and it's a small change, it's OK to fix it in passing. For anything else, avoid mingling cosmetic changes with functional changes, since that can lead to unnecessary merge conflicts. Instead, create an entry in the IssueTracking system to flag the code that needs to be cleaned up. If you know who the original author is and that person is still a project contributor, assign the issue accordingly. Otherwise, take care of it yourself in a separate change, or ask your project lead who should handle it.