-
Notifications
You must be signed in to change notification settings - Fork 9
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
Coding Style Standards #36
Comments
Thanks for volunteering! I think the best way to handle this would be to enforce one of the styles that can be enforced via gnu |
I am sure that @ProtractorNinja has an opinion on this. |
As for latex, I don't think that there is an equivalent tool unless we write one. |
OK... |
Err... I don't think we need to I am against using Instead, I think that we should adopt Google's C++ Style Guide, as it is well known, already complete, and easy to introduce. There are other style guides for other languages, including Python and Bash, but not LaTeX. Of course, LaTeX hardly needs a style guide to the degree that C++ does, so it may suffice to just enforce the LaTeX-relevant bits from Google's guide, like indentation and custom naming conventions. Or, even simpler, this Stack Exchange question suggests basing the code on one piece of advice: "Use whitespace to make your code readable." |
I completely disagree about the use of automated tooling to enforce coding conventions. Enforcing coding conventions is hard enough if you remember them (forgetting, code that doesn't read clearly following the standards, ease of accidentally messing it up). When the code base becomes sufficiently large this can become something of a pain without automated tools. I also think that using an automated tool can assist with someone who is just entering the project and wants a lower barrier to entry. For experienced developers it saves time. As for I think that the Google C++ style guide covers several things that are quite excessive for contest programming environments. For example, the sections entitled Namespace, static/globals, and access control simply don't make sense in competition environments. While the Google C++ guide is optimizing for reading, we are (at least trying to) optimize for typing. I am not sure that their style guide is appropriate. I agree regarding the LaTeX style with the exception of trying to apply Google's guide to LaTeX. We may be able to write a quick perl/python script that does what we want with regards to indentation, or we could just rely on vim's '=' operator, which does a decent job(provided that white space options have been set). |
Austin does bring up a good point about there being more to coding style than just indentation. Even if we don't have tools to do everything for us, I don't see it being a big problem to write them to at least check for us (or maybe I haven't finished generating the possibilities in my head). As for the LaTeX part, I want to see rules regarding indentation (of course), graphics importing, indexing, etc. Another thing that I would like to see outlined is how we lay out our sections, what is mandatory for each section, and what goes where among other things. I'm currently working on the segment tree and it's currently under the 'Basic Data Structures' section. This will have to change, but what defines a 'basic data structure'? One that is included in the STL? Properly made arbitrary judgement? I don't think it would be much of a problem to author our own style guide to include in the repository. We could just collaboratively list the things and discuss how we want them handled. This is clearly something that we must deliberate on for a bit. So how about this? I will find some time to draft up a list of topics we want to consider and we can start there perhaps? |
I also agree with Austin's point that there is more to coding style than indentation, I just think that using a tooling to help enforce even a portion of the style guide is better than none at all. "Basic Data Structures" is kind of a deceptive name. We have graphs there, and they are not trivial. We should probably put the segment tree there also. The section should probably be renamed "Data structures." I agree @mdclyburn, a rough draft would be a good place to start. I would put it in |
Since we're likely to discuss both LaTeX organization and code styling rather extensively, why don't we split the LaTeX discussion into a separate issue to better encapsulate both topics? Marshall's points made it obvious that there's actually a lot to cover in terms of document organization. Let me first clarify that I think using a checker tool of some sort would be awesome, but only after we've decided what it is that we want to check for. I don't like the idea of With that said, I don't quite understand the downsides of using Google's Style Guide -- or at least using it as a foundation of our own guide.
Meanwhile, I certainly understand the advantages of composing a new guide from scratch -- we're able to pick out what's important to us, and we're allowed to feel independent. But someone else has already done this work for us. Adding our own style guide is one more obstacle in the way of generating useful content for the Hack Pack. There will be things left out, things important to one person but to nobody else, and things we can't agree on. Are there any real benefits to doing so when a simple solution already exists -- picking out the relevant bits from Google's guide and going from there? As for automated tools -- that's another thing that's already been implemented almost in full. |
'tis done. Issue #38 is for LaTeX. |
@ProtractorNinja That actually sounds like a good idea. It's always nice to take advantage of others' work. That's what it's there for. I'll look at it sometime soon and get back to say how I feel about it. |
@robertu94, can you summarize some of the pros/cons of either of those that you mentioned? |
All style standards have roughly the same goal in mind, to improve readability. These standards accomplish this without the poor case choices and unnecessary use of name-spaces/conventions that lengthen code to improve reliability for large enterprise deployments that a standard like Google's would provide. |
Looks like I asked the wrong question. For the Linux, FreeBSD, and Google guidelines, could you separately itemize some of the pros and cons of each? Breaking each guide down in such a way will help us to figure out which one fits our needs the best, and should also help succinctly clarify why the Google style guide is probably not the best choice. |
Pros:
Cons:
LinuxPros:
Cons:
BSDPros:
Cons:
|
Hmm.. after looking at all these options again and coming back to what we really started this conversation for, I think we're falling victim to scope creep. All the style guides cover more than we really need, and it's been made clear that isolating the relevant bits of any of them won't cut it. It seems to me that we're not going to need to clarify much more than (my opinions in parentheses):
Addressing these topics will resolve the majority of inconsistencies without us having to deal with blotting out the extras. |
While I agree with the kernel of the style guide defined in the previous comment, I still think that it would be beneficial to adopt an external style guide. I think that the external style guides:
I do not advocate for the Google Style guide because I feel that we would have to very extensively strike sections and rewrite large parts of sections to be in line with the goals that we have (conciseness, etc). I personally think that the Linux Kernel Developer Style guide is the most aligned with our goals with the exception of sections 10 (Kconfigs), 13 (Kernel Messages), 14 (Memory Allocations in the Kernel), 17(Kernel Macros), and 19 (Inline assembly) which could be stricken in their entirety with out editing sections as they are entirely specific to kernel development and noticeable as such. |
I will go ahead and write a rough draft of this so that we have something a bit more concrete to review. |
( see #61 ) |
This isn't a project on the scale of something like Linux or *BSD, but we should have some standard of coding style enforced on submitted code (camel-case, curly brace placement, tabs vs. spaces). The LaTeX should probably have some standard as well. Something more than what is given in the README.
The text was updated successfully, but these errors were encountered: