Recap of this evening

0 views
Skip to first unread message

John Trupiano

unread,
Sep 3, 2009, 9:02:01 PM9/3/09
to bmore-...@googlegroups.com
We held our session in the Beehive this evening.  

Two useful pieces of information that came about today:
  1. When autocompleting a function in Xcode that has multiple parameters, the proper key combination to tab to the next variable is ^/ (control-forward slash).  I've been searching for that one for weeks.
  2. Here's a very handy comprehensive list of Xcode shortcuts: http://cocoasamurai.blogspot.com/ (originally dug up by Ed)
Tonight I completed part 1 of the Presence program while Sinclair caught up on some of the past lectures.  This assignment starts out with a walkthrough but then finishes fairly open-ended.  I took the opportunity to build out a model class (though not instructed) to represent each Person in our list (I suspect this will come in handy for the next assignment).  It was a good exercise in having to think about how to design the classes and data interaction.  The PersonListViewController has a static UI layout, but I dynamically populate it with my Person objects.  A Person object is passed into the child view (PersonViewController) via a custom constructor before we push the PersonViewController onto the NavigationController stack.  I used a separate nib for the PersonView and populate its contents from the viewDidLoad() function.

All in all, I'm starting to get a pretty good feel for how to build useful apps.

Next week's session will also take place in the Beehive as Mp3Car has reserved the conference room for a separate meeting.  I will out of town next week and consequently unable to make it.  I propose that we don't actually schedule any new lectures for next week and give folks an opportunity to catch up.  In the meantime, you can check out my code on github ( http://github.com/jtrupiano/stanford_cs193p/tree/master ) and I'm always happy to field questions on this list.

-John

Tony Amoyal

unread,
Sep 4, 2009, 12:45:11 AM9/4/09
to bmore-...@googlegroups.com
Thanks for the update and sorry I couldn't make it out tonight.  I agree that it would be useful to have a catch up week and I should be there next week.  I completed HW3 (minus a weird polygon clipping issue...has anyone had this?) but haven't gotten to Presence yet.

One thing that bothered me about my implementation of HW3 is that I think my first implementation was violating MVC.  I maintained a count of the "current sides" in PolygonView because I didn't have access to the PolygonShape instance from the PolygonView.  For example, in my Controller's updateInterface I had
[polygonContainer drawPolygon:[poly numberOfSides]];
instead of just calling
[polygonContainer drawPolygon]
without a sides parameter and then getting the number of sides in the drawPolygon method. 

Looking at John's code, I realized I could create an outlet from the PolygonShape to PolygonView using the interface builder.  This allowed me to call [myPolygonShapeInstance getNumSides] in my PolygonView and solved the issue.  Just thought I would share this in case anyone else struggled with it.

Also John, I am not sure why the bolded lines are in your code.  Would you mind commenting on that?

@class Controller;
 
@interface PolygonView : UIView {
 
   IBOutlet Controller *myController;
   IBOutlet PolygonShape *myPolygon;
   IBOutlet UILabel *polygonName;
}

-Tony
--
Tony C. Amoyal
www.tonyamoyal.com
www.dailysongfix.com
(240) 417-3112
corga...@gmail.com

John Trupiano

unread,
Sep 4, 2009, 8:14:46 AM9/4/09
to bmore-...@googlegroups.com
Hi Tony,

On Fri, Sep 4, 2009 at 12:45 AM, Tony Amoyal <corga...@gmail.com> wrote:

One thing that bothered me about my implementation of HW3 is that I think my first implementation was violating MVC.  

I wouldn't say it's a violation of MVC.  In fact, I think it's just a stricter interpretation of MVC where the View layer has no knowledge of Models whatsoever.  Sinclair and I chatted about this a bit, and there really are different implementations of MVC.  In rails for instance, views know about models all of the time.  Controller pulls some models and proxies them into your views as instance variables.  A strict implementation of MVC could use a Presenter pattern to hide the Model implementation layer.  Sinclair pointed out that he's starting to add localization to his project at work, and he's finding himself adhering to this stricter interpretation of MVC.  Without the complexity of the problem domain, you can get away with Views knowing about Models. 

The Stanford guys cover this to some extent in the followup notes for lectures 4 and 5 ( http://www.stanford.edu/class/cs193p/downloads/0405-FollowUpNotes.pdf ).  I believe they also cover it at the beginning of lecture 6.
 

Also John, I am not sure why the bolded lines are in your code.  Would you mind commenting on that?

@class Controller;
 
@interface PolygonView : UIView {
 
   IBOutlet Controller *myController;
   IBOutlet PolygonShape *myPolygon;
   IBOutlet UILabel *polygonName;
}


They are extraneous.  I created an outlet to the Controller from the View, but you'll see that I don't actually end up using it.  The first line (@class Controller;) is required to support the outlet. Without it you get build errors relating to a circular dependency (between PolygonView and Controller).  So the @class declaration is really just a promise to the compiler that some other file is going to define an interface for a certain class.

-John

Paul Barry

unread,
Sep 8, 2009, 9:41:27 AM9/8/09
to bmore-...@googlegroups.com
A catchup week does sound like a good idea.  I won't be able to make this week either, I'm gonna go down to Alexandria to see Kevin Smith's Erlang talk:

http://www.meetup.com/erlang/calendar/11052302/

I should be able to attend next Thursday, the 17th though.

On Thu, Sep 3, 2009 at 9:02 PM, John Trupiano <jtru...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages