PDA

View Full Version : [OPEN] Categorize class properties and methods by access specifier



LesJ
4 Jul 2017, 9:42 AM
Currently, all class properties and methods are listed alphabetically. The doc would be more useable if class properties and methods were first categorized by the access specifier (public, protected and private) and then sorted alphabetically within these categories.

As a result, there would be at most two labels attached to each property or method name: static or chainable. Having up to three labels (as it's done currently) looks quite busy.

56558

slemmon
12 Jul 2017, 11:11 AM
Hey! Thanks for the suggestion.

I'm not sure I personally agree that the type-category > alpha approach makes the members list more discoverable than just a pure alpha (with badges). A quick survey internally seemed to suggest I was in good company there.

But, I won't say definitely no either - let's leave this thread up and see if we get any other users weighing in with +1's either way before we look at changing the layout of the member quick-nav (or the member rows themselves, for that matter as that would be the next logical target for overhaul if the popup nav were to evolve).

LesJ
12 Jul 2017, 12:27 PM
This is interesting that the surveyed developers would prefer a strictly alphabetical order since in the class the various class members are usually organized into groups: privates, statics, etc.

mitchellsimoens
12 Jul 2017, 12:38 PM
If you're talking about the privates and statics objects like below:


Ext.define('MyClass', {
statics : { ... },

privates : { ... }
});

That's only done so the class system can easily handle those. For example, privates object has functionality to handle if you extend a class and have a private method outside the privates object:

236j

That will throw the error "MySubClass: Public method "myPrivateMethod" conflicts with private framework method declared by MyClass"

LesJ
12 Jul 2017, 12:56 PM
My initial example wasn't the best, but I tend to categorize class members in my classes by the intended access level. I first list public, then protected and finally private methods.

I avoid mixing methods with different access level as much as possible. It's confusing and annoying if this pattern is not followed.

slemmon
12 Jul 2017, 1:15 PM
I went ahead and pushed up a ticket internally so we can look at this request further. Thanks again for sharing your thoughts on how the docs can be improved for everyone!