Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App (iOS7) Refactoring into a Model Understanding @property

Dot Notation

Could we have also used dot notation instead of the underscore? For example: (self.predictions == nil) instead of (_predictions == nil)?

2 Answers

Rutger Farry
Rutger Farry
10,722 Points

Some developers recommend using underscores in init methods, as the class is not yet fully initialized and there is a tiny chance that the setters and getters haven't been created yet. Everywhere else in your code though, you should use the dot notation, as this utilizes the setters and getters which might have added functionality.

Rashii Henry
Rashii Henry
16,433 Points

Yes you can use those interchangeably.

Its just a preference on which one you'd like to use.