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 Objective-C Basics (Retired) Introduction to Objective-C From Structs to Objects

Austin Lopesilvero
Austin Lopesilvero
11,081 Points

Confused how "the implementation" was made

I don't understand how the code magically changes from: ```Objective C

import <Foundation/Foundation.h>

@interface Sphere : NSObject {

NSArray *_center;
float _radius;

}

 -(void)setRadius:(float)radius;
-(float)radius;

-(void)setCenter:(NSArray *)center;
-(NSArray *)center;
to:

 ```ObjectiveC
#import "Sphere.h"

@implementation Sphere

-(void)setRadius:(float)radius {
     _radius = radius;
}

-(float)radius {
     return _radius;
}

@end

This video and the next seem very confusing and fast compared to all of the other Treehouse videos I've watched

5 Answers

I find this course poorly taught with heavy use of jargon and prose of a emotionless robot, definitely not well-suited for beginning programmers. I too got stumped at first with the quick transition of files. I don't understand why he chose to use a shortcut without explaining it. I also realized he talks about classes without ever explanation to us what a class even is. This course is probably better suited for people already with a background in programming.

I mean, some Treehouse instructors just sound like they're reading off a book with a blank face staring at the screen. In this lesson, he's even crossing his arms. It's quite unbearable sometimes.

Check out this pointers lecture at a university and compare it to Treehouse's:

https://www.youtube.com/watch?v=Rxvv9krECNw

Clearly, this guy has PASSION.

Stone Preston
Stone Preston
42,016 Points

Those are 2 different files. the first is the .h file (interface file) the second is the .m file (implementation file). The instructor is magically switching between the 2 files using a keyboard short cut (command + control + up/down arrows)

Austin Lopesilvero
Austin Lopesilvero
11,081 Points

I guess I was confused becaused the .h file was still selected in the file menu on the left. I guess his shortcut does not affect that. Thank you for your quick reply!

Austin Lopesilvero
Austin Lopesilvero
11,081 Points

Stone Preston , is there another resource that I could look at to go over for content convered in Structs to Objects, Syntax Overview, and @Property videos. I took the quiz but I feel like I still don't have a grasp of what is going on.

Stone Preston
Stone Preston
42,016 Points

Id probably watch the videos again a second time. Pause the videos when you start getting confused. Think about the code you just wrote and what each line does.

Objective C can be a tricky thing to understand, if you still feel lost with things I would maybe check out http://www.raywenderlich.com/ Here is a tutorial specifically covering properties.

Keep in mind this first course is just a brief introduction to the language, and is by no means the end all be all of understanding the language itself. That takes years. So its ok if you feel a bit lost, we all do sometimes.

Austin Lopesilvero
Austin Lopesilvero
11,081 Points

Cool! I appreciate your help again.