As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm learning this from a 'newish' book, but I'm wondering what the current standard is as to the use of the dot operator for things outside of setting property values.
As in method calls and whatnot. Obviously myClass.myMethod:value is syntactically correct, but is it an accepted norm nowadays?
The dot operator is much more 'human' feeling than [myClass myMethod:myValue] in my opinion.
Have you tried compiling this? Your example of myClass.myMethod:value is not valid as far as I understand it.
The dot operator is translated by the compiler to either -(void)setMyValue:(ValueType*) or -(ValueType*)myValue depending on if you are getting or setting it.
Read the apple documentation for more info:
http://developer.apple.com/library/ios/documentation/cocoa/conceptual/objectivec/Chapters/ocObjectsClasses.html#//apple_ref/doc/uid/TP30001163-CH11-SW17
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The syntax is legal. It'll save you about 2 seconds every time you alloc/init an object. Do you think this could be a new trend?
Again,
NSObject *obj = NSObject.alloc.init;
[NSObject new];
Saves even more and doesn't cause any religious wars.
Yes, it saves a few keystrokes, but I doubt it will catch on. See this blog post for a number of cases where using dot notation on methods rather than properties will not work. I think most people view this as a side effect of ObjC2.
Furthermore, I don't think it enhances readability at all. As soon as you want to send a message with an argument, you have to revert back to the original syntax.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to check my code has follwed a standard coding guidlines like naming conventaion or unused code etc for objective C.
If you guys used any such tool then how effcient they are and how was your experience while using those?
thanks in advance.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I seem to be coming across a lot of variable (boolean) for some Options that control whether something will be done, like:
GiveWarningEnabled
FeedbackEnabled (will provide feedback)
These will be used a lot and I"m trying to think of a good pre/suf fix that will indicted it's Boolean. My best thought so far was Enabled.
Perhaps: Will?
WillGiveWarning (or WillWarn)
WillGiveFeedback?
often times "is" will be used, such as isPlaying or isWifiEnabled.
Will, should, can, and does are also good ones to use because they express conditions. A verb such as "give", like the one you listed, seems to better fit a function declaration since it is performing an action.
I usally prefer flag.
Example:
warningFlag,
feedbackFlag.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Are there any design patterns that deal directly with configuration classes. Thats is, classes that are simply containers for configuration settings.
I usually tend to use constants for global settings. Not everything must be a class.
Some will tell you that a Singleton pattern is fit here, but I think different. Singletons are evil. See this question on Programmers
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've seen some great in-browser tutorials and/or practice exercises in other languages. To name a few:
Ruby: Tryruby.org
JS: Codeacademy.com
Rails: railsforzombies.com
I've also seen great Java algorithm challenges at codingbat.com.
I haven't found anything similar for learning C, or Objective-C (which is my real goal). Any suggestions?
go ahead with http://developer.apple.com/library/mac/documentation/cocoa/conceptual/objectivec/objc.pdf
for Objective-C. It works great on my browser- opens up the pdf.