11/21/2017, 2:18 PM
"Do not sort the method declarations alphabetically or by visibility, and do not separate regular methods from extension methods." I was thought to sort methods by visibility and I think that it is really important because public functions are forming class interface! If someone is reading the class then he is first reading this functions. override functions should be placed before because they are even more important - they specify characteristic class behavior. I am from Android world and over there nearly all guidelines are stating that Activity/Fragment lifecycle should be placed before other public methods. protected functions are also specifying some kind of an interface - inheritance interface. This is why they all should be separated. Also all this functions should be as short as possiblie and ant their logic should be moved to private functions with behavior-explanatory names. This way someone that is reading the class clearly see that is happening and how he can use class, and he can understand it without reading implementation details that are placed in the private functions. About keeping close methods that are working together: I agree, but it is not as important as general class readability because is developer want to read specific function then he can quickly jump to it using Ctrl or using Ctrl+F on Github.


11/27/2017, 3:33 PM
the public functions may be public because they form the class interface, or they may be public because the class needs to implement some interface for some reason and the implementation methods are required to be public. and I totally disagree that override functions are always important.
override fun handleThisSmallCornerCase() = doNothing()
is not important at all.
placing the Activity/Fragment lifecycle methods before other public methods is a good rule for Android apps, and I don’t see how it contradicts anything the style guide says