WWDC2003 Session 412

Transcript

Kind: captions Language: en thank you all for joining us today uh the use a user interface programming session for 12 one quick note there's another session coming up later on on friday which is an in-depth version of this 419 it's not on your schedule after seeing this you will want to go to 419 consider this a requirement if you don't sit through this you can't sit with 419 thank you I appreciate that today we're going to talk about some of the coolest additions to building cocoa applications out there and to take his fluid Andres Wenger good afternoon so my name is andreas Vanka and I manage the web updates engineering team and if you know one over technically I am doing here and by the year in the right session then don't run away this really is a cocoa session koko already is the best and the fastest way to give out a desktop applications from echoes 10 and as you saw in the introductory session on Monday you will make it even better to take a look at the existing cocoa applications out there you will find there's actually a lot of code being written simply to keep the user interface in sync to the underlying data object what you have to do is you have to pretty much write a lot of repetitive glue code you have to edit out the outlets to deprive deficit targets and delegate and you have to implement a lot of methods simply to react to user interface input let's very straightforward and routine work but also takes a lot of time and frankly it's really boring so we decided to do something about that and a panther we are going to introduce a complete new layer of functionality a controller layer this controller layer will automate the ending of the user interface and it will add a lot of features that you've been asking for and of course the extended interface data so you can make use of these new features without writing code and the effect will really be the developing cocoa applications will become a lot faster and a lot easier this is a screenshot of fine words our code dipping to it and I put it here to give you an impression of what impact this technology we have on your own applications if you imagine if your current Coca application for the left side of the picture and the way you will be able to write that same application and Panther on the right side and as you can see in the bottom there there's only one difference your coat your blue coat baby gun to the next hour I'll give you first of all an overview of how the new API work and I will show you that the concepts of this new technology are based upon the rain on model-view-controller paradigm which I believe most of you are familiar with and we also show you how it can use interface data to use the new features and throughout this session I will get a lot of help from my colleague james Dempsey and he's not only going to drive the demos for you he also brought his guitar well if you attended about success in the past years you know this will be good and it's not stay few minutes after my summary slide and I can say this often enough session number four hundred nineteen video follow-up session to this one there simply so much to talk about in the context of the controller there but we fed you need a second session so for not nineteen friday morning at nine o'clock so the dance let you bring up james for first demo and people give you a system of how you can use interface data it's a new key good afternoon my name is james Dempsey and i right in-house cocoa and web objects applications for apple and what I'm going to show you today is some of the new features in interface builder that allow you to access the new controller layer features in cocoa so let's make a new nib file new Koko application don't need that menu and so let's start out by dragging out a good old-fashioned check box here we're going to use it to hide or show something so i'll label it appropriately the first thing you'll notice in interface builder is that we have our familiar attributes and connections attributed or excuse the inspectors but we also have the addition of this new bindings inspector and the bindings inspector shows all of the attributes that the selected view item are are exposed or have exposed to the controller layer so they're all things we can configure with this controller layer you'll notice they're all grouped by category so their availability whether it's enabled or hidden all different items about the font display and of course the value so we've got this little roll over we click that and we can configure everything about this binding now every application has a shared user default controller and user defaults have values and within their we're going to define an arbitrary key we're going to call it flag ever popular and we have just configured that checkbox to now stuff its value into shared user defaults under the key flag now let's have something that actually reacts to that will drag out a text view which of course is enclosed in an NS scroll view which has one available binding hidden we'll hook that up to the same shared user defaults values and interface builder remembers we defined a key so we can just pick it from the list and I head into test interface mode and of course when I click the checkbox a way it goes my text view and so as opposed to just having attributes that are suitable in interface builder we now have attributes that are dynamic and propagate through the UI on the fly now um no I be demo would be complete without a scroll thing in it of course so let's hit its value is going to go into user defaults of values and we're going to have it set some font size and let's head on over to the attributes inspector the two are not mutually exclusive you can use both in conjunction with each other and 0 is not a very reasonable font size so we'll change that 24 for the sure 25 great font size all right let's head on over type some text into our text view 2003 to yeah whatever and multiple answer aloud so we have 1 fonts go to bindings and set the font size up shared user defaults going to pull from those values again that font size going to test interface mode and while I move the slider and something happens in the user interface you've seen that before but in the past you've you know left teste interface mode and everything you did went away but when you're binding up to a controller object this one's a shared user default controller object behind the scenes is the actual nsuserdefaults object that is pushing things into the data but database so when I a rerun i persist so that kind of gives you an idea of how little code your preferences panels might need in the future now back to Andreas Thank You Jane so how did you come up with this technology some of you might know that you currently have a technology called eof oh and the price optics framework which is part of the web objects product and is used for database access in the US has the layer that we call the interface layer and it's used to automatically populate java swing applications the content from databases so what we have done is we've taken the ideas and concepts of lead layer not the lessons we learn from it and deep implement the next generation of this technology in objective-c for cocoa so when we set out we started dissented falling gold for us first of all we wanted to support a large variety of use cases and application you certainly did well just limited to databases we wanted to be used for preference of standard so applications like mail address book and all the applications you are familiar with we wanted to integrate easily into existing applications so that you don't have to rewrite your applications completely just as you want to make use of our features and you wanted to be flexible and extensible that you could have good mileage out of it wanted to be fast and we won't have great in the face reservation and wanted to be easy to learn or in other words you wanted it to kik app so i hope that is the end of the session we actually agree with me that be achieved what we set out to do so let me now give you an overview you get this right let me access recap quickly about the model-view-controller paradigm is about the model-view-controller paradigm you essentially stick your application in three parts the model that represents your data object and the underlying logic and rules and to view the tender to the input and the output of your application should consist with all the windows and views utility assembly in interface builder and the controller which glows blues you to pieces together the controller is the glue between the model and the view and for the purpose of this session we keep the interaction and the roads and the respondent edges of these three pieces fairly simple all I wanted to keep in mind is that when the user enters the new value in the user interface the view will notify the controller that change has happened and to control it and apply the change to the appropriate model objects but not all the changes in an application have been the user interface sometimes you have to you have to script running in the background or you might have different views for the same model so you might have merged with windows open the show the same data because of that controllers also listen for changes from the model object they will observe the model objects if they are told that the model has changed they will automatically update the view so what are the advantage of this model you control a paradigm essentially the model-view-controller paradigm makes the applications code will be usable and easier to extend for example since the model doesn't really isn't really concerned with the details of the view it's fairly easy for you to add an additional window of a different type of user interface that shows the same data you might even be able to use the same model officers in different applications and also since the view isn't really concern for the details of the model objects you can easily switch data representation and for example can easily change the class that you used to presented data objects without impacting the code written for the view so in the past you had to ride the controller by hand the new code that I talked about in the beginning pretty much form the control area of layer of your applications going forward in Panther you can provide you with a reusable component but the reason we control the layer out of the box I would like now to give you just an overview of the most important features of our control delay let's start with using any model object you can apply the new functionality of our control layer to pretty much any problem domain but you want to display in this document whether you want to work on preferences planners and store preference on the user defaults they use ms dictionaries of generic data containers or whether you use your own custom model object you will be able to apply our control day to all these models and the trees that they're using a common data access project color that you called keel a decoded p recording is actually part of nexus 10 4 why now but it has only been used in the context of the school of scripting so you unless you have made the application scriptable you're probably not familiar with it k value coding is a unified way to access properties of model objects by name or as refer to it by key and we talk a lot more about this in session number 419 through the essential to understand this protocol second feature automatic user interface refresh our controller they ever make sure if the commodity prepared on promises the different parts of the user interface will obviously in sync so if you have documented modular windows for the same document open you do not have to ride any line of code to keep the content of those windows in since that the data object and we achieve that by using a common observing project ecology called key value observing the Kaveri observing allows interested object our controllers to register for change notifications from the model objects and then they are told that something has changed if you use that information to propagate the change throughout your complete education so they will always keep all the views that display the same data in sync and that would have an independent of how the change was triggered so independent of whether the user and that's something you'll be user interface or whether script was running in the background and if you don't use much with windows for the same document another area but it's really very visible between the Preferences panel with our control area changes the preferential standard bit apply immediately to the complete application this thing and editing all standard Coco data types the remaining event for the first breath of functionality in cocoa whether you do the strings numbers they colors images fonts are fewer aids and whether you want to say the text field in a slide and image view d pretty much have bindings available for all coca vigils and give excellent support for table use to display object rates the one thing that you probably not get to in the Panther time frame it supports the previews so and about land use in this browser support of those would probably have to wait for the next release being about hey reviews I will control the layer to manage selected for you at the track which rose do you have selected in the table views and again it will synchronize the content of other widgets dessert selection so if you have text fears or other widgets that are dependent on the selected row that shows the values of the selected roll you make sure that those bitches always stay in physical selection in the table views and of course we will allow or you will handle editing of multiple objects the right way this is something actually requires a lot of code to get right or do you say that it makes applications really more user-friendly we put the right in the controller layer so the features are listed so far are pretty much the essential features you would expect from any control earlier but we wanted to go further you want to make sure that our features really have to create polished great applications and one area that we found that we could head to grade it when it comes to handing all these different states you encounter and user interfaces so the states will hand it for you first of all deny various state which pretty much means that a value has not been specified in the model so far we also handed multiple selections you handle the state of North selections and we even came up with a not applicable state which is intended to be used if you display different kind of object in a table you in those cases not all table columns might apply to all the objects you display so you don't want the application crash in that case you want to be handled T so if you do that for you what will happen is that when you square in the controller and they asked for the way is to be displayed our controllers would indicate those states to special object values because of object various markers and for all the states that are listed on the slide you have a marker object and then the views are informed about the stage you can handle it clean and what you is the developer will be able to do you'll be able to specify place or the values let me give you an example said if you ever used address book or mayor's to configure new mail accounts you might have noticed that these forms you have to sit out for some kind of informative text in gray in the in the text view until you specify a complete value so now over that simply is a place order for the Nile Valley State so you can sort of really help you to create informative user interfaces and I read encourage you to make use of that new feature manipulated manipulating objects relationships most editing in applications stress-related the simple values like strings the numbers if you want to assign a new name to a person object for example all you do is to creating the string and you assign it to that person object but the identity of that string doesn't really have a specific meaning to your education many models are more complicated little and sometimes you have complete graphs of objects you might have to graph a person object to group objects and if these groups and persons are assigned to each other you don't want to reference them indirectly to rename or an ID or something like that you want these objects as quite as to each other to each other so we call these pointers that have a real meaning in your model a relationship and we typically distinguish between too many relationships which are just arrays of references and 21 relationships which are single object references and I will controller layer will give you all the mechanisms you need to manipulate these relationships and to traverse them unit they are modular levels deep so one example could be a UI where you have two tables a table with all the groups in tables of the persons in those groups so the content of the second table the person table depends on the group that is selected and the kind of this populated centric through a relationship from the group object may transformers survey transformers represent an effort on our side to make simplification of our controller layer simply for you they are very small a powerful object that you attach to the bindings of the view object and variance formats are given the opportunity to modify to convert values before they are displayed and promote them back in a different representation after days being edited so essentially you can apply expressions to the values in your model object the probably something a bit like a formatter but it's not limited to string it works with arbitrary data type and also we have a name registry global name registry for various transformers so that you can easily reference them from the nib file so you can register your own very transformers in our registry and under specify them by name is a nip files and then does reference really a result at one time so you give an idea of what you can do you're planning to ship a few default place orders for you and Panther wonder just negate boolean that would be very helpful than you give enabled flags and things like that do you have transformers the test values familiar or not needed so what we will do is spiritually created boolean depending on whether value has already been specified or not and we also have a very transformative archive values in an NS data that last one will be very handy when you actually talk to the user defaults database some of you might know that the user defaults can only store p list object so the experience numbers raise diction is an NS data object but they can't store things like a name is color so what do you do with now avoid the been transformed you can simply use of a transformer to encode or to archive the color object internet is data and store that in the user defaults and Eminem thread and actually displayed in the UI it's on a college again so these very transformers we expect would probably be the most important way for you to customize our function key the last piece that feature i want to mention is controlling this state parameters you've done a lot in this area a bunch of different things and most importantly probably we have added automatic sorting in table use for you this is something that a lot of you have been asking for and you're finally adding it in Panther so what you'll be able to do is to be able to click on the table column headers and we ultimately saw the content of the table according to their table column and to take a second time you reverse the sort order and things like that we show that to you in the next demo and beyond that we simply allow you to manage a large variety of user interface state for example with this take solace is funky want to use how large windows are the window positions the width of table columns which item in its have you selected what windows are visited what draws a visible and you'll be able to collect all that state and store that in the user defaults database of it in your document so then users leave the application or reopen documents it kills before the application comes up in exactly the same state has been lifted so now dr. oz drinks again come on stage and show you an applications that we make use of most of the features that are just listed all right have a little address manager application here and it basically is using the address book framework to import everything in our dress book and going to show you basically a demo of all the features Andres just talked about so first let's take a look at the table view you'll notice as I select items in the table view the current selected item all of its data gets updated as you would expect I can sort of Walla as you might expect notice when I do sort and do not have a particular row selected I get that no selection indicator in the text fields down here and of course if I have multiple items selected I get the multiple selection aundrea said mentioned well let's take a look at groups here we can add a new group call it my bridge club very exciting life i lead and make that blue and let's select 0 for random people notice I'm not in my own bridge club and pick that and obviously that selection gives me all of the selected items take on that value and now the pop up displays that value and I've connected those people to a group object not just a string called bridge club alrighty let's go take a look at the inspector so I have an inspector that also is changing all everybody works in five infinite loop that's not very interesting there we go let me bring up a new document you'll notice as I switch between documents the inspector changes on the fly let me import from dress book in this one voila we'll go to contacts I'll leave it on image now hit preferences as well and in preferences we can crank up the row height crank up the font size and you'll notice that in both table views it's happening live as we update let's save this document save document and quit the app when we relaunch and get that document back you'll notice that we get the state we are in it remember that we did indeed have this cold out and it's back to the way it was so that's a sampling of what's in this control layer Thank You Andre do you understand project which one the project do you want to show the project oh goodness gracious them the kicker I I completely forgot that I had to come here at all since I did so much in project builder documents go to the source code so let's take a look at the source code for that entire project it's some this much and it mainly deals with grabbing stuff from address book and getting in setting the values into the file system we that's 69 lines of code including the imports in the comments now back to you Andre thank you okay so next step I'd like to give you an overview of the API so you're introducing the context of the controller layers and the api's can be grouped in three groups some utility classes some control the classes and a few protocols the utility classes community decals you find at the foundation layer and the first one is and its index set and NS mutable index set and it's in accepted to collect you to efficiently manage index information and to store them in a compact form so that's something we haven't had a constant we haven't had before but it turned out to be really important in the context of the controller layer that we manage a lot of index information selections and what in excess changed in table view etc so you will see the slab and linux that is a bunch of our API but it will probably useful for many other cases outside our control earlier so I think we really like this guy the second one is and the sort descriptor and the sort descriptor facilitates our automatic sorting in table use and the sort descriptors essentially represents sort criteria so they specify the key that is used for sorting they specified how the values are compared by the case sensitive or case insensitive and they specify the direction of the sort ascending brothers descending and typically you assembly marginal sort descriptors in an array to specify a sort or a Down Majda level so when you click at the table you you did pretty much create an array of sort descriptor for you and pastor to the controller layer to actually perform the sort now always talked about in this very transformer they're very annotations formats a very simple API you typically only implement two or three methods and it's just a method to convert a value from one direction to the other one and another method to do the opposite and you can attach them to the binding to customers or control earlier the controller class isn't answer they will be first of all in ennis controller class which is just the superclass an abstract superclass of all the controller severe shipping and if you want to implement your own controller you should subclass that class is there there's going to be an energy user defaults controller and it's usually force controller is specialized to talking to the user defaults database typically use only one single instant a shared instance of the user defaults controller in your application and we made sure that the unit across Victoria is to make it really easy for you to access the user default we made sure that the user defaults has a shared user defaults controller is so easily accessible to the nipride that's why was the one controller that showed up in the first demo so usually fall to be really simple and transparent to you in the future editions just talk to the user defaults database you can also use the users across which were to specify specific initial values so the user never went to the preference of 10 and never specified preference of values you can transparently specify the initial values for those and then you know every just say we just used throughout the application and its object controller and in this array controller and this object controller will be used or it's used for display in editing in seeing an object in your user interface and NS array controller is used for just in your editing an array of object and typically you use a combination of those two classes nsobject controllers and energy very control of you typically bind the content of those controllers to each other so if you have you know Taylor or let's say document for person object you could create an end its object controller and place certain objects within that controller and if you don't want to display the groups that person is in it created array controller and binds the content of that array controller to the parents of trip to the object controller which contains the person object and we then traverse the relationship for you the protocols that will be important in the context of the control area will be further and its key value coding also mentioned that in the beginning is our data access protocols and key value observing is our observing mechanism so it's the one that we used to receive changed applications from the model object and you talk about both these protocols in great detail in session number 4 19 and edit subtracting is a product whether they have mentioned so far but it will be also very useful for you most Coco applications don't immediately submit changes in the use of the face to the model objects most of the time you wait until the user presses the tab key or the return key and leaves the text field and only then apply the value there's nothing wrong with that you just need to make sure that if you save a document you capture those last edit so the editor tracking views will be able to tell the controller that they have uncommitted changes right now and then a single method called you'd be able to commit those changes to the model of you gave it to force the views to submit their changes to the model object or to avoid editing for something or you want to divert so bringing up this picture again Kaveri coatings the product code used and the view talks to the controller two different to ask for values and also going to control the talk to the model object so this the arrows in this diagram don't represent the data flow to present who initiates the method card and on the way back use key value observing to tell the controller and the views that something has changed and edit attracting we go back and forth between the controllers and reviews so the views to register visit controllers that they have uncommitted changes and then the controller's before safe or words they did commit the changes so that we have bought the editing so those are the protocols I'd like to now specify I'll give you energy of a few more API is we encounter when you start working with our controller there the first one is our key value binding API which is used to create bindings there are two methods and these are methods on the view objects that you want to bind so the first method is bind to objects is key pass options and there's an unbind method to do the reverse let's take a look at the power the arguments to the method the first argument to the bind method method is the name of the binding so it typically represents the property that you want to control something like text color enables or value the second argument the object you observe simply the controller that you bind to and the key path the third argument specifies what when you treat we use then we can show the property and then the fourth argument is simply in victory of options 20 an intersection with several parameters that you can specify to influence behavior of the binding what you typically put in this options dictionary is for some of the basic transformer name and you can also specify the placeholder for the various states i mentioned a few minutes ago in this office dictionary you typically don't have to invoke these methods by hand these are the methods that interface builder uses when bindings are established but you might have to use them by hand if you want to bind objects from different lip files to each other I just talked about specifying the placeholders in the office dictionary and that is important that you can for each individual binding specified place orders but we expected most of the time you were going to use generic term something like no selection magical selection etc so to make that easier for you be defined an API where you can set default rates or the values for your completed application and these are class methods again methods that you invoke on the view classes for some honors text here and they are called set default place order for marker of this binding and default placeholder for market is fine so the arguments here offers about the place for the value then the marker and for the marker you will either pass in new syndicate deny value state or one of the three object values are listed here and it's my to the various marker and it's no selection marker and it's not applicable marker so these are the the marker objects that we define to indicate the different states to the view object and you simply pass the marker object to be a set default date for the method and then the third argument is the binding name so / binding you can define different place orders another API that would be very useful for you is sleepy eyes batik or if you have subclasses of views that have additional parameters that you want to expose to the controller there then as long as you have a key vary according compliant as long as if Q basically complying methods for this parameter pretty much just a simple set and get method assigning have that you can expose the parameters simply by invoking the class methods expose binding you typically do that in the initialize method of your class and once you invoke them to the parameter name the binding will show up automatically in interface builder and everything else will be taken care of there was an instance method expose finding which returns all the available bindings for an object including the ones that we provide and optionally you can implement the method value class for binding which is pretty much used in interface builder to match other objects against the binding so for example you can sit out what they transform us do not apply to given binding so it's absolutely for you but if you do it's a before interface builder if you implemented if you need to go beyond a simple key value coding binding then you will have to override the bind method at this time and in the bank message we have to pretty much register the state that you need for your binding by hand and track that you're safe so simply queue vary according bindings are very simple to expose the singing method cause beyond that override the bind method and pretty much manage data set the last API want to list here is the API that you use to populate the content of the object in the raid controllers the method is simply called set content and you can invoke it by hand manually or more commonly you'll probably use bindings to bind the content of the controller's through relationships for the names of the bindings our object relationship enter a relationship ok so I'd like to ask James to come up on stage again and give you a third mo of interface theater between more advanced features ok let's make another new nib file huh wrong app there we go another new nib file and this time let's go a little bit deeper into how I set up and can figure these bindings so if we take a look we have a new palette in interface builder the binder palette has the user defaults of controller the object controller and the array controller that Andre is talked about and we'll start with an array controller if we look at the attributes of an array controller you'll notice that by default data rate controller is going to be holding on to NS mutable dictionaries which we can use as a generic container to hold any key value pairs however you can use an NS array controller to hold an array of any key value coding compliant class in your model let's add a few T's of course we can add them on the fly but it's just a little easier to do it all at once for demo purposes we're going to put in a flag a string and an aptly named number as our items there now let's hook this array up to a table view there we go so we'll add another column drag that on out make that a little wider sit for multiple selection now how do we hook this up select the table view let's call this one flag go to the bindings and set the value of this instead of pulling from shared user defaults will pull from the NS array controller the controller key the array controller has a key that will let us get at all of the arranged objects or just the items that are selected we want all the objects so we'll pick that and choose flag for this column fact we're going to make this one of these handy dandy checkbox columns you can clap feel free for the string will hook that up shared users excuse me that Anna's cancer a controller arranged objects will go for the string and this time if somebody hasn't typed in something we'll put in an old placeholder so we'll say no value and then the last column will display a number but this time will display it using on these handy-dandy slider cells and we'll set that value up to be hannahs array controller arranged objects notice a pattern number and we're also going to just make sure that excuse me that those cells click that little widget to get to the cell has reasonable min and Max values there we go great now let's add an add and remove button again option drag line them up all aqua like okay we can use regular old target action if NS array controller has an add action that we can hook up to and a remove action that we can hook up to let's get a little more room here and add a textview to show the selected object and the check box to show that selected flag again go to the bindings hook that value up shared user d excuse me that NS array controller and this time we want the selection not all the arranged objects and we're going to hook that on up to the string and this time around if there are multiple items selected will say multiple items selected that might be clear enough if there's no selection will say no selection and if null will say we just type wacky stuff like nothing and then for the flag will hook that up to the array controller selection and flag finally let's just bring color into this here and we're going to have this color going to shared user default values as a font color and we'll hook that up to the font color where are we there it is text color shares user default values font color alrighty should it work on drinks I think though okay I didn't I'll call it alrighty so first things first we hit test interface mode and we can ship pretty much ready at this point so we got that no value hanging out there because there is no value if I select it obviously type in there Bob let's add some people what I do oh dear I broke it it alright for just such an occasion I did the cooking class thing and worked one out so let's add a few items here honest to god come see me it works on my powerbook put in fill some Jerry misspelled Jerry and Yolanda of course we do all of this fun stuff give some settings we select along and obviously we guess what we're selecting we do a multiple selection we get the mixed state for the checkbox we get Bob's are both the same values so it puts the value in there we add Phil to the mix it jumps to multiple selected now of course maybe a that's one Bob too many so we'll get rid of him we can sort this is so tough to do oh it's it's killer let's say is that pretty much the whole pup I know what I did dagnabbit i think i know what i did and i'm going to show you i forgot one handy thing that many beginning cocoa programmers forget which is on that you can't just put it in its color into the user defaults why it has to go in as an NS data so I'm going to use this transformer to do that and then when it comes back out i have to turn it from an NS data into a color now this was not pre-planned I just screwed it up but let's see if that now works yeah [Music] that's fixing continue I believe that is all that I have and thank you very much for your kind indulgence thank you thank you James so a few more things before wrap-up I wrote about performance you spend a lot of time on queuing our refresh logic and if you get digit enough observer notifications yekta tuned to refresh down to sing it says in table view the only redraw the minimum area in the user interface that you have to redraw and of course we added a few caches in the right places to further enhance that to make a curious obsession imma 419 through the introduction of key very cooling or two key very cooling we introduced a level of indirection you're not invoking methods directly anymore you're referring to various by name Sookie very coding cause a tiny bit slower than a direct method vacations nothing that you have to worry about ready but if you get into millions of objects on the screen at the same time you need to know how to be a decoding works so you need to use it the way it is intended and set for 119 we talked about all the details so if you like this new functionality and you want to stop using it the good news is you don't have to rewrite your application we have made sure that our controller layer can easily coexist with the traditional igloo code that you wrote so far we recommend that you start using the function is you soon you'd probably get a better user experience because of our selection handling the automatics torching the place orders the user default you might even see improved performance because our Pew Research leader logic and since you'll be able to space out a lot of your view code you would simply reduce your maintenance costs less code is all this bill and also if you start using a controller layer you would be much better prepared for future leaders if me at features in cocoa in the future in future releases you just be able to get them for free you just need to start using the controller layer now but the seed that you have your hands is a better version so there are few things you need to know if you want to play around to the seed that you have in your hand first of all there's unfortunate very little documentation available for the control area right now the documentation is the forthcoming so at this time is we have to point you only to the header that you find in the foundation of the applicant framework and also there are few pieces missing in the implementation most importantly the controller's of the seed do not use the key very observant mechanism yet so when I talked about the automatic propagation of changes to the users of thesis that won't work but we will refresh automatically use all the pieces of the UI that are controlled by the same control it you saw on the nipple eyes see it or work but if you go across magical control that for the same model object we won't the automatic propagation of changes won't work also please treat the available bindings and the names of the bindings preliminary it might make a few more changes in there and another thing that you need to know is that when you start using our value and content bindings for individuals we are starting to take over the targeting delegates at this time so if you use a checkbox do bind the very binding you will not be able to specify a target action anymore for it do you take ownership of that so we resolve that for the GM you fix that of course but it might impact how fast you can adopt the new technology and then I'd like to recommend that you use to tend to inmate a nipride format in interface builder because that's greatly enhances compatibility so this is all the granting implementation it's a brand new feature and so please submit back reports it's in your own interest and also if you have ideas and thoughts you'd like to know about them so please use the cocoa feedback a trooper the effort of car mailing list we won't guarantee a response that we promise that you will read all your input and take it into concern so in summary and pants are we adding a great new functionality for you a controller layer that we automate a lot of your user interface handling if you get rid of a lot of code that you had to ride so far and you thought a lot about customization the bay transformers to make that easy and as you saw the extended interface videos that you can use the new functionality without writing a single line of code and that for what you've been waiting for so um I guess it was just a little while ago and I had the good fortune to see this technology before it was rolled out here at WWDC and as sometimes happens with technologies that I get stoked about the first thing I do is go to the iTunes Music Store and type in some keywords see if there any songs about it and there weren't any not one song about model-view-controller so then of course the next step is I tend to write one so this year song is a model view controller song and once again I thank you for your kind indulgence are we are we good to go am I good to go and we're going to switch over to demo machine the one Victor's in front of one or two all right and it goes something like this model view controller [Music] MVP the paradigm of factor in your code to functional segments so your brain does not explode to achieve reusability you gotta keep those boundaries teen model I'm alongside you on the other the controllers in between models it's got three layers like oreos do model too creamy controller model object represents your applications raised on d'etre custom classes that contain datalogic and etcetera you create custom classes in your ass problem domain then you can choose to reuse them with other views but the model objects see the taste you can model or throttle in a manner full bottle love a two year old model the bottle of fine Chardonnay model all the swaddle stops people today model to coddle in a boiling eggs models to waddle in head please lay 1 2 3 4 bottles to you can toddle all the models of pose for GQ model do [Music] you object tend to be controlled as you and edit cocos got a lot of those well written to credit big ananas text you hand it any old unicode string user interacts with it it can hold most anything but if you don't know about the model that string could be a phone number all the works of Aristotle keep the couple in mood so it seems this massive level of reuse models already very nicely an aqua blue models controlled on you'll probably wondering now you're probably wondering how data flows between model in view the controller has to mediate between each layers changing state synchronize this data of the two it pulls and pushes every change value yeah modeling mad props to the small talk crew for my love you model too it's pronounced 00 not super model view Cola there's a bit more this door if you know miles upon this road well nobody seems to get much glory right controller could well the model is mission critical and gorgeous is the view but I'm not being lazy but sometimes just crazy how much food I rather just clue and it wouldn't be so tragic with the curry doing magic is improving valued through now I wish I had a dime for every single Thomas and it makes feel string value bottle how we going to keep sticks all that slew model controls know the model in view very intimately they often are hard coating which is very foreboding for reusability but now you can connect in a value you to let you in it you proper TV and I think a stop sign and then you'll be fine unless code and your costs three yeah i know i was astounded i arrived but I think it bears repeating all the code you won't be needing when you hook it up can I be bottle it even manage multiple selections to model model hope i get my g5 before you [Music] [Applause] if you haven't heard already now's the time to buy one of those whoo so that the creaky wrap up this is the roadmap for the cocoa sessions make the short so for not 19 again and the cocoa feedback forum is probably the other one that we important this is a usual contact again send feedback to cocoa feedback at group that every calm and for more information documentation is forthcoming please check the headers at this time and we also need to have demo code available but we try to do this to the next one or two weeks so please check the ABC member side again and we try to put some demo code there and that adds actors if you call you come up on stage and take some Chris you