HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
New Coding Standards?
@Kasper said:
- Migration to new coding standards
4-space indentation, camelCase for methods and properties, underscore_case for functions and variables (camelCase for existing functions), lowercasetrue
,false
andnull
, and some more. As new code in Garden is being written using similar coding standards, I'm moving my own projects to these standards as well.
This was taken from that discussion because I didn't want to go offtopic there.
Wouldn't that affect also existing plugins? Class names and method names are not case sensitive, so that wouldn't be the problem, but what about common array or variable names? Starting from $PluginArray
with all its values to FormPostValues
or even DiscussionID
, CommentID
and the like? Will the db column names also change? So that DiscussionID
will always be discussion_id
?
To put in a short question: will the switch to new coding standards make nearly all existing plugins incompatible with Vanilla 2.2?
5
Comments
The coding standards would apply to new code and plugins. Notice it doesn't mention models at all. I can't see the business case to switch legacy code over to new style in a way that would break a metric crap ton of plugins (their proprietary ones included).
In my mind, keep your code self consistent with the existing codebase. Save any major style changes for new projects or rewrites.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Existing code won't be touched for a good, long while – nothing will break. So far, we've merely added a couple of new functions that I've personally used in a few projects: https://github.com/vanillaforums/Garden/blob/master/library/core/functions.compatibility.php
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
these 'stardards' are more styles. Consistency is more important.
I thought Kasper was talking about JSON at the time, in which case is a standard.
true
is correctTRUE
is not correct.in php it is case insensitive.
http://uk3.php.net/language.types.boolean
grep is your friend.
Okay, thanks for the answer: new code is the key! I was kind of surprised why someone would want to rewrite an existing software just for the sake of maybe/maybe not "better" coding standards. My fault
I think the problem can be mixed styles.
The current style is CamelCase
http://en.wikipedia.org/wiki/CamelCase
the style often called CamelCase is camelBack.
grep is your friend.
@x00: at first I was shocked when I thought about all those functions that will not work in future times, but then I've googled and found out that classes and functions in PHP are not case sensitive, but variables are.
Immediately I had to think of you posting the Cargo Cult Coding link and I felt somewhat guilty. (Nevertheless I still believe in my plane-gods!)
styles aren't cargo cult, cargo cult would be ritually including something that doesn't need to be there without understanding of what it does, but believing it is necessary.
grep is your friend.
thats what i think about cell phones.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.