Giter Site home page Giter Site logo

Comments (7)

 avatar commented on July 24, 2024

Your example about using an instance variable with a name like _alpha is not a problem with using English, it's a problem with using names of common properties. Anytime you subclass an existing class, you need to be aware of its existing makeup.

I have coded for 16 years on some extremely large codebases, and in my experience using English has solved more problems than it has ever caused. But if it helps in your own code, you could try prefixing variables with something exotic, like _mySpecialPrefixVarName, much like Apple recommends prefixing class names for the same reason.

from objective-c-style-guide.

ColinEberhardt avatar ColinEberhardt commented on July 24, 2024

I totally agree with @elephantronic obfuscation of all your variable names to avoid accidental collisions is not a good idea. This is a problem that is rare, and when the case arises, should be solved on a case-by-case basis.

from objective-c-style-guide.

John-Lluch avatar John-Lluch commented on July 24, 2024

It's funny to regard the use of a Language different than English as "obfuscation". I suppose you realize I am not English native. Wow, this remains me of something, lol.

Anyway, is there actually a way or tool to determine which variable names are taken by superclases?. There must be cases where a variable or property is used that is not documented. I faced this problem in the past (when using English) more often than I had liked. As far as I can tell the compiler does not warn on this, or does it?

Thanks

from objective-c-style-guide.

ColinEberhardt avatar ColinEberhardt commented on July 24, 2024

It's funny to regard the use of a Language different than English as "obfuscation"

Reading my comment back, it probably does sound like that. I really don't regard languages other than English to be an obfuscation!

It just feels like an odd proposal, to write our code in Italian, Spanish or French to minimise the potential collision with the Apple APIs that are written in (American) English.

from objective-c-style-guide.

John-Lluch avatar John-Lluch commented on July 24, 2024

Hi Collin, no offence taken. That was just a comment not a proposal. I fully understand the benefits of adhering to a particular language for consistence, and English is the de-facto standard in this field. I formerly worked on a team that found English to be less productive and harder to document because it was not their everyday language. That's not odd, just depends on the team.

from objective-c-style-guide.

ndubbs avatar ndubbs commented on July 24, 2024

US english is used because it matches the names of properties and methods in the programming language. This decision is based to help beginners and non-english speaking readers. It can be challenging enough to learn a new programming language without intertwining the nuances of multiple spoken languages.

from objective-c-style-guide.

John-Lluch avatar John-Lluch commented on July 24, 2024

Hi ndubbs. I understand this is off-topic, but is there actually a way to tell which properties or variables might be used on a superclass to avoid using the same names on a subclass. I had once a hard time finding a bug on a third party code that had _alpha as a variable in a UIView subclass.

from objective-c-style-guide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.