Comments (7)
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.
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.
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.
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.
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.
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.
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)
- Init section contradicts Golden path section HOT 2
- Can we lint to enforce some of this style guide? HOT 6
- Symbol prefix: 2 vs. 3 characters HOT 26
- What's the point on using properties instead of instance variables? HOT 8
- Direct access to properties. HOT 5
- License for this guide? HOT 1
- Not linking to Official Apple Style Guide HOT 1
- RWT prefix typo in constant definition HOT 1
- What is the recommended line width for Objective-C?
- Use style guide principles in examples
- arrayCount should be named something else HOT 4
- Contradiction between Init Methods and Golden Path
- Error handling
- I want make new branch for Korean ver.
- Google style guide URL is broken HOT 2
- Should self keyword should be used in init methods ?
- How do I indent something like this??? HOT 3
- Xcode behavior regarding indenting block
- 关于枚举(Enumerated Types)的想法
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objective-c-style-guide.