0

In projects which need heavy SDK usage, like Android and iOS development, I want the methods/functions I write to be obvious and since the whole framework is written with lower case method names I would like to have my method names start with upper case.

However is this a good approach if there are going to be other programmers included in the project? Would this create mental overhead & confusion or would it really simplify things?

{
    didReceiveMemoryWarning(); // obviously a framework method
    MemoryWarning(); // obviously custom method

    item.height(); // obviously a framework method
    item.SeventhDimensionOfItem(); // obviously custom extension
}

closed as primarily opinion-based by Bart van Ingen Schenau, GlenH7, user40980, Dan Pichelman, Rob Jan 5 '15 at 3:12

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    This makes your code unreadable as methods look like classes ... If you think this is necessary use a pre-fix. – dogsgod Jan 2 '15 at 13:10
  • Isn't this one reasons to use namespaces. – user877329 Oct 7 '16 at 9:46
3

Unless you have any compelling reason, it is usually recommended to stick to the code conventions of the programming language you are using. Changing method naming conventions could make developers think that they might be consuming some external service or maybe crossing some other boundaries.

If you would like to point out that the method is not available from the default SDK, then I think that the best place to point that out is to include it in your method documentation. Most IDE's nowadays are able to show documentation such as JavaDoc and NDoc through their intellisense capability.

3

Stick to the naming conventions specific to the platform you're using.

It's easy enough for any developer with an IDE to see if a method or class comes from the SDK, a third party library or your own code. It's usually as easy as mousing over the code and seeing a qualified name.

Besides, I don't think it's really that important for a developer to tell the difference between framework code and custom code. As long as they know the API and what the method is supposed to do, it shouldn't really matter. I very much prefer for it to be obvious (and indicated by naming conventions) which piece of code mentions a name of a class, a method, invokes a constructor, accesses a field or a static nested class.

These conventions will be different across languages but in my opinion, you should keep your code consistent with them.

Would this create mental overhead & confusion or would it really simplify things?

I would certainly perceive this as a source of confusion.

Not the answer you're looking for? Browse other questions tagged or ask your own question.