Homework 5 — Properties & Protocols

Due Monday, March 29, 2010

NOTE: The hard copy of this assignment, like others in this class, is due at the beginning of the class period. This means that if you are even a minute late, you lose 20%. If you are worried about potentially being late, turn in your assignment ahead of time. Do this by submitting it to me during office hours or by sliding it under my office door. The electronic copy of this assignment is due at 9:00pm on the due date. Submit the electronic copy using the appropriate dropbox in D2L. Do not send assignments to me through email or leave them in my departmental mail box.

As discussed in class and in your readings, Objective-C allows you to declare properties, use the @synthesize compiler directive, specify protocols, and have classes adopt protocols.

The assignment.

  1. Does the capability to declare properties add any functionality to Objective-C that it wouldn’t otherwise have? If so, what is that functionality? If not, what is the point of declaring properties?


  2. Does the @synthesize compiler directive add any functionality to Objective-C that it wouldn’t otherwise have? If so, what is that functionality? If not, what is the point of this directive?


  3. Does the capability to decorate properties with attributes add any functionality to Objective-C that it wouldn’t otherwise have? If so, what is that functionality? If not, what is the point of property attributes?


  4. Explain the difference between a formal protocol and an informal protocol.


  5. Describe the mechanism in Java that is most similar to specifying a formal protocol and the mechanism is Java that is most similar to adopting a formal protocol. Explain why you see these mechanisms as being most similar.

What to turn in.

Turn in both printed and electronic copies of your answers.