Subscribe to
Posts
Comments
NSLog(); Header Image

MVC and Accessor Methods

maildropicon.gifI was bored tonight, so I began work on MailDrop 2.0. Essentially, MD2 (unlike MD1) will follow a very MVC model. It's the easiest way towards eventual AppleScripting, easier document archiving, and a lot more.

Essentially, MVC is "The Right Way™" and our current method is, uhhh, well it's a hack. We learned a lot about how things should work, what we did wrong, and where to go from here. Nick's experiencing those issues right now in FTPeel and, like us, he'll be a better developer for having been through it. Our third app in production, PulpFiction, is going to be nicely MVC as well.

Anyway, I got what I'd say is about 5% of the code done tonight, and it's perfect. It's flawless! It's… purely accessor methods! The view calls a setter in the controller, the controller calls a setter in the model, the controller then says "view, update yourself" and calls a getter in the model for the latest data (the stuff we just set), etc. It all works. Yay. Perfect code. So far, anyway.

2 Responses to "MVC and Accessor Methods"

  1. Keep us posted on how long you're able to to stick to the paradigm. In my experience it works until you think of that one little feature you could add that'd take only minutes if you hack it in and much longer if you adhere to MVC.

    If you're a good guy, you'll have the self-control to use MVC - but if you're more of an instant gratification type (or working under a looming deadline), that's where all good resolutions will break dwon... 🙂

  2. Well man, I've already put in time on those lame, boring parts. My UI triggers a method in my controller, which sets something in my data model. The controller then "updates" the UI to match the model, and so it asks the model what the values of some things are (including what was just changed) and sets it. I could have done this in 0 lines of code, and I've writen about ten per widget now, so… I'm off to a good start as you say. 🙂