-
Notifications
You must be signed in to change notification settings - Fork 12
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
Types and variables naming #12
Comments
Acronyms: for me it is all about readability: fromBbcode is damn weird... BBCode is part-acronym, part word...fromBbCode would be weird as well... just like the recent UI issue: e.g. ButtonUI or ButtonUi. As I said, MS has a standard for acronyms: if 2 letters acronym only, then both in the same case. So we have UI, BBCode (BB + Code), CData (C + Data), but Html, Xml, Wysiwyg. Sounds good for me. Variables: agree - lowerCamelCase Types (Classes): agree - UpperCamelCase Internal namespaces: lowerCamelCase Root global namespaces: ALLCAPS |
+1.
|
I see your point. I'm fine with such approach.
This is actually good point, that did not get attention.
I would go with this approach for module names.
That should be exactly the same as for module names. No matter what decission is taken. |
I've been just thinking about test files names. I've got a file in v4 which is called |
On the second thought... maybe |
As for file/directory names, we're not any more talking about code. We must have a fit all solution because files/directories can have any kind of content. Btw, we're blocking this this issue uselessly. The convention for file names will not in any way impact in the convention for in-code names. We have already issue #3 for that purpose so we should not discuss it here. |
I think we reached a common agreement when it comes to the name conventions in code. Do you guys see any pending topic? |
I think that there's still a lot of details that we need to clarify but they will come out with time. E.g. whether we use underscores to mark protected/private stuff, whether we use plural or singular names for stuff like the "smiley" plugin? Do we always create We agreed about the most important basics, but I would keep this ticket open to track other related decisions. I know that it's not necessarily the same subject as how to format names, but I feel that if we won't generalise this subject, we just won't have anything more written down later. |
I've updated the documentation, aligning it to the stuff that we agree here so far: |
I'd add one more thing regarding module dependencies - when we're requiring multiple dependencies, then the module definition should look like this: CKE.define( [
'ckeditor',
'tools',
'mvc/model'
], function(
CKE,
tools,
Model
) {
'use strict';
...
} ); It looks cleaner and reads better than a huge one-liner. |
I agree, but let's wait for opinions as this is one of the few weak points of AMD. Other options:
|
I don't think limiting lines to 80 characters makes sense these days - nearly every screen is in 16:9(10) ratio, so I'd propose going with something bigger, 120 characters maybe? |
80 chars is mainly because of console. I never use console for code stuff, so I'm definitely fine to go with 120 chars. Others? |
I would like to start splitting issues, otherwise the discussions around them start getting too long and confusing. Therefore I've opened #15 and #16 for the remaining naming things. |
I've opened #18 for this. |
I've opened #19 for this. |
Considering that missing topics have been moved to dedicated issues, I'm asking for review on the docs so we can close this one: |
As for for what has been discussed so far, I'm closing this one. |
Overview
We should conclude the way that we want to name types / variables.
Common rules
There is no doubt that we want to use camelCase, that's cool. There are few details that needs to be discussed:
Acronyms
How to use acronyms? Do we use them like a word, or all uppercased?
Just off the top of my head, I can name one monster:
XMLHttpRequest
.CKE4: Generally we're doing really good job treating acronyms as a words, I had really to look deep down to find some examples of violating such rule.
So we commonly have members like:
getHtml
,getInnerXml
,addContentsCss
.Violating members are:
onCDATA
,fromBBCode
.I think that we should treat all acronyms (no matter what) as a word.
Variables
Camelcase, starting with lowercase, eg.
addItem
,requestType
,getCount
,select
.Types
The same rules applies as to Variables, with the exception that they're uppercased, so:
Editor
,ContentFilter
,FocusManager
,MenuButton
,Command
,XmlParser
Namespaces
How do we want to tread namespaces? Do we want to name them as variables, or like types?
Naming it as variables would make sense, so it would make chains like:
dom.Element
,ui.button.Handler
,ui.dialog.JumpingDialog
How do we name main CKEDITOR global variable?
I believe for compatibility sake we should stick to capitalized? So
CKEDITOR
remains.I ask politely for making a conclusion as I want to apply our new standard to the AC right away.
The text was updated successfully, but these errors were encountered: