---
title: WWDC2001 Session 603
framework: wwdc
role: article
path: wwdc/wwdc2001-603
---

# WWDC2001 Session 603

## Transcript

Kind: captions Language: en good afternoon how's the show going for y'all good looks like we got another very pretty good crowd here today my name is Barry Janssen buried Toolman Janssen and welcome to tool time we're going to go over the web objects tools today before I do that though I've got some good news and some bad news the bad news is that I don't talk as fast as earning proper curb and I'm not as funny nor do I demo as quick as Steve Heymann that's the bad news the good news is that Ernie told me that we could give away a titanium laptop with web objects on edge and the way we're gonna give it away is and this is all the standard disclaimers please didn't invoke all the standard disclaimers and this is a joke okay but what we're gonna do is we're gonna count to three and when I say three the first one to stand up is gonna get the laptop okay so here we go everybody's seated please one two okay now that I've got your attention let's talk about tools the trickiest part of this presentation is gonna be trying to get through it without using this number otherwise it's gonna cost me so we're going to talk about web objects tools today if I can there we go so here's what you're going to learn we're going to go over this session is an introduction to tools there are many other sessions that go into tools in greater depth but we're going to we're going to go over the tools that web objects developers will use in building a typical application we'll build a very basic application more specifically we're going to build an application that uses direct to web as a starting point along the way we'll expose all the tools that typically in the web objects developers Arsenal and will also expose some of the things that are new in web objects 5 a little bit of project builder in that so for some of you I know that will be will be quite new so what are the tools if you go online and you read web objects tools and techniques you'll see that there are three oh I made it five minutes okay you'll see that there is this trilogy there's this trilogy of tools in project builder remodeler and web objects builder okay if you go somewhere else on the web if you look in Ernie's free in there in Ernie's presentation if you look at tools and techniques it actually adds direct to web in there and doesn't talk as much about project builder okay so what are the tools we always kind of refer to those three but there's two others we'd like to talk to you about today as well and that's direct to web assistant and direct to Java client assistant okay and those are tools that allow us to rapidly build these direct to web and direct to Java client applications and direct to web it's a Java applet that connects up to your running application and modifies it indirect to Java client it's a swing UI can interface with a connection to modify your swing UI applications that are based on web objects so we'll talk about five today okay first of all the tasks I'll go over the tasks that we're going to go through so if you're a new developer this is really targeted at you but what we want to do is start from easiest to hardest a lot of times we come out here when systems engineers when we go out and do demonstrations on web objects it's a tremendously powerful and flexible set of frameworks and powerful tools that go with it and a lot of times we go very broad and very wide and very deep very quickly and we lose a lot of people okay so we're going to kind of go through a process here that isn't too hard to get started mean if you're not a rich experience what about its developer that's been doing this for years and years you should feel a place right right at home during this presentation if you are an experienced web objects developer and perhaps you haven't seen some of these other technologies or use these other technologies extensively my guess is you know a manager or you know somebody you work with who asks you about web objects and you get the idea that maybe they're not going to drill to the depths of insert objects into both sides of relationships with key in relationship with key and so they need something a little easier to get started with once they're started you can help them out or you can call a police services and we'll help you out so there's lots of places to get help once you get started on web objects but the trick is to get you started so that's what our goal is with those technologies okay nice okay so the tasks are project builder we're going to start a new project we'll look at what is involved in the project where do things go how do we handle them we'll compile a project project builder does this for you we'll set some runtime parameters show you where that is it's a little different in the new project builder and it will launch the application director web will launch the director web assistant will customize both tasks and entities with the director web assistant and then we'll save and make changes on the fly if some of you saw Scott Forstall in the keynote you see you saw one of the hallmarks to our way of developing technology and that is when you have live object systems you can do some pretty cool things dynamically on the fly and that's what we're going to try and do today well objects builder we're going to take some standard components to come in our application we're going to modify those a little bit Steve did Steve Heymann yesterday in section 601 went over this quite a bit yesterday so we won't go too into it quite as much as he did in their other sessions as well so you'll mod ler we'll talk about EO modeler and what it does first we have to explain what a Neal model is so you kind of need to understand what it's what it's working on and and then we'll actually go into a demonstration on EO modeler and lastly director Java client there are other sessions on this as well so what we're going to do is simply launch an application show you where the director Java client assistant is and just do some browsing of some information that that will use early on earlier on in the presentation okay we'll also put this slide at the end with some of the some of the key other sessions but we think you should know this now because other sessions we'll talk about some of these things in overlap a little bit and if you want to find out if you find something in this presentation that you really like you may want to come to one of these following following sessions so project builder there are a number of sessions going on with project builder I believe the first ones already completed but there will be a couple other ones on debugging there will be a session on direct to web with Miguel here web objects builder will be covered again a little bit in getting the most out of web objects tools the île modeler will be touched upon at a couple of other sessions because it works with EOF so the sessions on on EOF we'll be covering that as well and direct to Java client as I mentioned there's a direct to Java client session and an advanced java client session so mark those down if as we go through this and we'll try and give you the sample platter here of the web objects tools okay so let's build a common web app a common question I get when I meet with customers is his web objects hard to use and I used to say well there is a steep learning curve and yes you know and I'd say what Steve same--and said you learn a lot in a short amount of time and you know buh-buh-buh-buh-buh buhbuh now I stopped and asked them before I jump into that and say well it depends what problem are you trying to solve and when when customers start explaining what kind of problems they're trying to solve it all depends on you know and a typical thing they're doing is they're looking at a database and they're creating reading update deleting the standard kinds of things not a lot of business logic a little bit of customization in the HTML and that's about it so you look at them and say well we we have some frameworks and we can probably do that with no code I think oh really well but it goes across this table and it has a too many relationship and it goes across here on a many-to-many and it does this and that and here's our whole scheme on see how hard it is and web objects has frameworks in there to help you do that to help you build an application that does all this without having to write code to do it it's only when you solve the hard and the difficult problems that you really have to drill to the depths of web objects to do these kinds of things okay so the following session intro to EOF we'll begin to talk about that a little bit we'll go into greater depths of how do you use uof to solve these hard problems that are out there in the industry okay but a lot of these problems aren't that hard so we'll show you the the get started way on how to do that the other thing I want to point out is if you don't know by now wizards are bad okay if you haven't heard that from Steve Heymann or earlier or if you haven't heard they're from somebody else wizards when we think of wizards we think of code generators wizards are okay to kind of get you started and help you out a little bit and project builder has a little one just to sort of ask you a few questions and just kind of help you get started but if a wizard is going to generate a lot of code that's typically a bad thing because who ends up supporting that code yeah who's got to support all the lines of code to this gin and the first thing you're gonna do is you're gonna look at that and you're gonna go oh my gosh who wrote this stuff and now I'm stuck here supporting it okay so wizards in general are bad what is better is two views pre-built frameworks and to hook those and wire those up so you see that metaphor in interface builder you'll see that metaphor in web logics builder you'll see that metaphor in a lot of places and things we do of hooking them up we we traditionally use things like keyless well now the in thing to say is obviously XML but that's how we hook these things up that's how we get started with these so rather than you doing a wizard we're gonna start a directive web application I think you'll see it's much more flexible than a wizard okay so getting started with project builder project builder is if you don't know by now project builder is the way to develop web objects applications on Mac Mac OS 10 with web objects 5 it is a new project builder if you're a traditional web objects builder and you've come along the way so there are some things in there you'll need to be aware of that are that are a little bit different and we'll show those ok project builder is that our integrated development environment it also manages other than just you know the standard edit compile debug code it also manages resources for you so we're creating these model files where we've modeled a database and we've got to store that somewhere we've got to manage that somewhere so that's included as a part of the prod as a part of the product as the part of the project excuse me same thing with web objects builder creates HTML and object descriptions that bind to that it also manages those it handles web server resources it handles a number of other resources that you have to deal with in a typical web application it also handles launching your applications and runtime parameters when you launch those so that you can test your applications okay so the first thing we'll do in project builder we need to select the kind of project we're gonna build and as a new developer told me recently the beauty of getting started with web objects is you launch project builder and now you have 47,000 project types to choose from which one okay so it is a little difficult to pick the right one or to know the right one so we'll kind of help you through that process let you kind of know how to get started but direct to web think of direct I will pick a direct to web product project I think of direct to web as creating a model file much in the same way that we model a database a data dictionary or a schema coming in from the database it's a little bit different it's more of a rules file really but you can think of it as a little bit of abstraction from the objects in our application so yo modeler creates an abstraction from the database it takes data rows and turns them into objects that we like to program in objects right and our model here will take those objects and basically describe how to present those so we've now isolated ourselves both ways a little bit from the user interface wicket which can change very quickly and from the database that can change very quickly okay so direct to web will give us by default a standard login page nothing too exciting there the web assistant then connects up to this application that we've launched and it'll allow us to customize that on the fly so that's what we're going to do we'll launch the application and then we'll customize it as we go along okay so what do people use direct web for well traditionally a few people have used it for doing things like validating my model okay so I have an object model from my database can I get from my customers to my suppliers to can I then can I go you know traverse relationships can I Traverse key value coding through all this stuff to get through all these relationships and make my application work the way it should so it's just you can use it as a validation tool that yeah this actually has you know all the relationships that I need in my model it's also very useful for creating administrative apps so how many of you developed an app and you get done and somebody says well we've got to have a way for you know our secretaries to get information into the system and you don't want to sit there and do a quick you know quick application or something so you can just throw it into directory web and hand it over immediately okay so that's another use but what we'd like to do is customize it just a little bit more and begin to show you how you can actually use this as a real live running application not just for admin apps and not just for pumping data into the application okay again wizard bad remember that we're gonna build a new project so this is what you'll do anytime you're building a web objects application again here's the 47,000 choices that you have we will select a director web application and we'll name this hap our school okay these are the pre-built frameworks that web objects includes if i've got other ones such as when Steve Heymann built his demonstration yesterday wanted to add in a few other frameworks you can do this upfront if you know you're going to going to want to include some pre-built code that either your company's developed or maybe Apple I services is developed for you to add a model for right now we're just going to kind of pass the model off until later in the presentation just just consider it some magic somebody has handed you on how to connect up to your database okay so we choose our model and now we have a couple of looks in director web will choose the neutral look but we can change this in the rules at any time if you want to change the look and feel and I'm not going to build and launch right now because I want to show you a few things before it takes off okay so there's project builder for those of you that weren't here yesterday and saw the new project builder this is what it looks like it manages as we said a number of things it manages your classes so we give you by default you have an application class in a session class indirect actions direct actions which is how you handle some of the get methods that you use and other tools it also handles web components and components are the richer set of things on how web objects can interact with the user in a much more powerful manner so it does sound some of the same things you could do in previous versions of project builder I can look at the HTML and so you know obviously if if I want to change things in here I can I but it's probably much easier to bring it up in web objects builder okay there are three components that it gave me a main a menu header and a page wrapper so it's going to already we're using a couple of reusable things of components can be embedded inside of each other and I can modify those and it'll be modified in all my applications so it's very nice it's a very nice starting point resources as we mentioned are models such as my database model that somebody handed me other kinds of things it also has a rules file okay this is another nice thing that web objects does for you in a lot of environments where you don't have as rich of tools as well objects you would have to go in here by hand and edit these things or come up with some kind of crude tool to do this we'll show you we won't have to mess with this directly there's also a rule setter which Miguel will probably cover in his session but we'll have tools to manage this so that you don't have to go in there and muck with it by hand web server resources if we have web server resources things that need go with the HTTP server and and be copied over there to be vended that's where they're all go and then the frameworks that I just included again if I want to include some other as after I've started up this is where I would put them okay so that's our application hammer means build so we're building the application if you want to take a look at what is spewing out of here you'll notice that it's not make anymore it's now Jam using Jam to build the files and it's built the other thing is kind of new if you're if you're just walking up to project builder and you're like most guys I admitted that don't want to take read the manual or listen to your wife and pull in a gas station to get directions you go to enough of these sessions we'll all give you one or two tips and you'll learn project builder here executables there we go that's much better thank you - whoa porch auto open in browser no ok you can also enter in a number of other things in there like I said we will need to build this application right now ok when the build target is done we can launch it now and that should go a little bit okay as I mentioned there are a number of parameters you can set when you launch this and those all show up here so you can see where my port is set and these are all in red here the runtime parameters that you can set here they used to be a separate panel so get used to that a little bit of the of the moving panels as we go here okay our application is ready okay all right there we go okay so the default page in a directory web application is a query all and query all just says take all the entities that you had in that database thing that somebody handed you and pick one thing and put it in there take a good guess okay so it takes a pretty good guess on these things of course course name where course name begins with B okay I can go out and search boom there's my my courses in my course database for my school okay anytime we hit home we go back to the main page okay well we can also begin to customize this a little bit so if you're building your first app you're probably not going to do the full insert update delete all this kind of stuff with multiple tables and a big thing okay if you've got web objects out of the box how many of you got the book out that said getting started okay so the getting started book is probably how you got started right you did guestbook and then you did a simple movies demo okay so when you do a movies demo or get started that way usually you're only querying on one or at most two entities okay and then we're traversing down a path okay so I don't want to make this quite so complex and yeah okay but I'll show you as we go through this there's two ways actually of doing this I can launch it in the browser which is a simpler way and once the browser is getting meshed up with the underlying java code that's that's in the mrj they'll be able to deal with this much better but for now we will walk this fine as I walk off the edge of the stage here so it's gonna be a little tight here but let's let's see what happens okay that's good so the query all page is the default page it doesn't have a customization but I'm going to customize the entities as we said we can customize the entities and the tasks that are involved in this app okay so picture your manager or your coworker working on this and saying okay well I can make all those read-only what's that that's gonna change a little bit now I can also take course I probably only want to look at for now let's pick courses and students okay and let's save that off okay reload boom okay so now I've only got two I've cut that down to two entities the others are hidden so there were three categories here if you can read the tiny font it's hidden entities read-only entities and readwrite okay so now I've got to that's a good start okay so let's look at students and let's look at students whose last name begins with B okay so we've got a number of them I don't like first name in front of last name so again I can go into the assistant and now I'm going to go into expert mode okay so if I look at the properties of this page okay I've got first name and I've got last name in here and I can customize that to some extent by selecting last name it's moving it up a notch so that'll come first but you'll notice if you were yesterday's session Steve talked a little Steve Heymann talked a little bit about key value coding and going across relationships that come from our model that students have a 2:1 relationship to photo so I can select photo dot photo and move this into my application or move this into my page and notice direct to web is smart enough to figure out the attributes that are there I can save this and let's check our browser again ah it looks much nicer although a motley crue they be don't they okay some of you may recognize a few of those faces we'll have a quiz later okay so that'll be our student list page okay so we can move through this application one by one picking off all the different kinds of things so this is what we can do we can go in here and select and fix the user interface for courses and for students and we'll map down until those things cross over until I look at students and all the courses that they're taking so why don't we do that okay in this list page I've also got courses okay so I can move courses over here and I can inspect it okay I can do a two mini table and maybe what I want to list is specifically the course name so let's save that and take a look at what we have okay so it's collapsing the courses let's clean that up save again okay so now I have the students and I've crossed a many-to-many relationship and I can list the courses okay so I haven't done any coding yet still I'm just configuring basically the rules on how we're mapping from models to applications okay so if I look at let's sort these by last name by clicking on the icon I can sort them let's look at a course okay basic circuits inspection looks like it could use a little work so let's go back home and clean up another one okay so let's look at courses we've been cleaned up some of the student pages let's clean up some of the source the courses pages alright okay alright so here's the courses let's take it looks like in here cost is free obviously this is a free University so let's take out some of these things will leave in name and let's leave in instructor name and save that and reload and that looks a little better okay let's sort them like that and I can do the same thing here so I can list in this list page I can actually list all the students that are in that page as well and traverse the relationship so there's a relationship called again I'm crossing the barriers from one table to another to do this in another tool normally you'd be writing sequel joins and and joining tables and having to deal with all this stuff let's put it in a table again and let's display their last name and let's save it okay okay there we go okay so now I can begin to loop a little bit I can look at individuals let's look let's clean up one more thing let's clean up the inspection for students and let's clean up the inspection for courses so I don't like the fact that it lists seven courses that looks kind of ugly so I'll go back to my web assistant let's put takeout enrolled let's take a last name and bubble it up first name I'm bubbling this up [Music] let's take photo and actually I want to move that out and traverse the relationship for photo again so as I'm inspecting a student will display their photo both in the list page and in the inspection page okay let's add that make it an image okay and in the courses we're gonna select the course name okay all right save that reload there we go one more thing I'm not a big fan of collapsing all right so let's not allow collapsing there we go cleaning it up one more time okay all right so now we basically have an application that I can take a student look at their courses go across to the courses I need to clean up the inspect courses so that I can display who's all in the course so let's synchronize that and this is always one that can that is fun to do because we can sometimes as this application goes along we can go a bit too quick and actually bind it up but let's give it a shot here okay so we'll keep horses and we'll keep horse instructor there we go okay okay that looks too simple let's go back and add students and let's put a table in there that has a student's last name okay okay here we go okay so this is our application right now okay I can search on students I can search on courses and I can traverse all the relationships and get all the information about both of those so as I look at students in classes I can say I can go to other classes I can see who's in those classes and etc okay that's first part that we're going to build so I will launch into customizing the HTML a little bit let's try and let's try to make this look a little bit prettier so it doesn't look quite as much as a direct to web app okay so we can use web objects builder on everything I built up till this point to customize the HTML both in the page wrapper and in the menu that's along the side okay so I can clean those things up make it look like an app make it look like my app instead of making it look like an out-of-the-box app okay we can do things like also freezing pages as well so if I want to go in there I can freeze this out and have a standard web objects component instead of having and make be totally dynamic okay so I can go in there and customize even more if I choose to do that so we'll go in here and fix alt or change all three will change the login panel a little bit we'll change the menu wrapper a little bit and we'll change the header a little bit okay and we'll show off some of the things with web objects builder well budgets builder is the way that you edit HTML in web objects as Steve mentioned yesterday if you want to deal with the with the files that web objects builder normally deals with you can use anything but we think it's easiest to use in web objects builder for a couple of reasons okay it edits your HTML but it uses a standard metaphor that we have of objects and object browser on the bottom and what we're doing is we're binding those objects to the HTML okay the only tag you'll see in the HTML from us is the web objects tag so we really try and stay out of there and instead we try and dynamically bind bind these objects with with minimal impact on the HTML web objects builder also has built-in integration as you saw yesterday in Steve Hammonds presentation we can drag entities from AO modeler into web objects builder and it'll automatically create a display group object for us in order to connect up to the backend it also web objects builder also has integration with project builder so if I'm changing code in web objects builder in automatically and instantaneously updates in project builder okay so let's take a look at that and customize that a little bit okay if we can go back to the demo machine okay so here are my web components you can see I have three as I said before nobody stood up good okay I click on those to launch web objects builder and let's go ahead and bring up all three and then we can just move project over to the background okay alright first let's take a look at our login page that we had our main page okay so remember we said web objects builder has the HTML part on the top and the object part on the bottom I can browse objects you'll find the general design pattern of browsing and browsing objects to be a standard thing is one of my favorite developers I'm from Boulder Colorado it's one of my favorite developers says it's all simply a matter of browsing you can browse everything so he wrote a tool that browses the Oracle schema and browses the objective-c runtime and it's all just browsing he says so that's all we're doing here on the bottom is we can look at the application objects session objects below the line our methods or actions that I've got so my main dot java has a default page action which probably is bound to the login panel okay so I'm going to clean up the table a little bit as we've shown you a little bit before you can see the HTML along the bottom the depths of the HTML path along the bottom so if I want to look at this table row right here or if I want to look at what is included in a form a web objects form I can look at that level so it's very handy it's also very handy when you're tying methods to objects you can bind here or I can bind as I drag from my object so bind to the HTML either place okay very handy sometimes if you have some complex HTML much easier to deal with in that in that fashion okay all right let's take a look at a table row here let's get rid of the assistant part because I'm not really going to have now that our app is looking pretty good we're probably going to not need the assistant anymore let's take and center that and let's look for an image that we have laying just happen to have a laying around education web objects and when I drag an image or any other kind of resource into my application it's going to ask me do you want to add this as a global resource okay so yes I do it adds it as a global resource to my product project okay so I can save that I can also look at what this page looks like in the raw HTML okay notice what I had highlighted here whatever I happen to highlight here as I move over highlights here so well object name equals education web objects okay so it named that right there in the HTML and I can easily again if I'm having trouble finding something embedded in a table I can click on it here and switch between views and actually see where that is where it's highlighted okay I can also get somewhat of a view of what it's going to look like as a best guess in the rendering in the HTML okay there are palettes as Steve mentioned yesterday he has many more palettes than I do but you can drag and drop other things off the palettes into here if I had this image on a pallet already it would be something that I could just drag into my product project and bind up the dynamic things that web objects includes or on the bottom row here so as you hold your mouse above those you can see all the kinds of things that we can bind up to web objects and I can also add other variables or keys and it does this in a very smart way so if I want to add a key such as let's call it a course okay and it's a class this will list all the different kind of classes I have access to but it's not just the standard object types it also figures out and substitutes in things like courses that come from my ye'll model okay so it understands how to connect up to the database and include these things in my application okay when I add that my course object now understands what are the attributes that it's pulling from our model of a course of course has category cost course name other kinds of things it also has relationships that I can traverse so I can traverse course summary and the name of the summary and bind that to different things okay as you saw in Steve's demo yesterday okay so we'll delete that okay so there's many powerful things you can do with web objects builder we'll keep that as our main page and let's go on to some of the other reusable components that are in our application okay so you'll notice on the page there's a menu header and a component side okay so this is the page wrapper it's an object that we use in in web objects in order to get reuse on a lot of our pages very quickly so I can wrap this page and the page any page in this page wrapper and it gets all to be all the settings in there for free when I drag the image in again it says do you want to replace since I've already put this in the resources I know that I've got something in there by that name do you want to replace it or you want to just use it let's just use it okay so we'll include that in our page wrapper we'll call that one good save that okay now our last page is the menu on the side okay it's a read-only application so we're not going to insert anything new so again I can select anything that I have in web objects builder and simply delete it okay we probably don't want to customize anymore notice I can see on the tagline that that's what I'm trying to delete we can delete that as well okay let's save that and let's keep this one open so we can show you how this can modify on the fly or how we can do other kinds of things okay so that's web objects builder in a very short time frame let's launch our project again over rebuild and launch and let's take a look with what we have okay so here's our new login panel we can clean this up however you want but this certainly looks better than than what I started with foo bar again to my super-secret Apple connect login panel okay so now I can search there's one thing I not wild about in here it says entities if you can see it in the upper left so entities doesn't probably mean anything to most of the teachers in my school so let's take a look in web objects builder I don't see it it's hard to see again in the HTML so this is one of those instances where it's kind of nice to go into web objects builder raw mode and I can search on entities and there it is and let's change this to looking for okay so it's handy sometimes they have the raw HTML there as well so I can search for difficult things that are hidden and again do I have to recompile this app now no because it's all dynamic on the fly and notice it's looking for I can look for courses I can look for students okay let's look for again courses okay there's my courses basic circuits and I can traverse my relationships okay not a bad app for how many minutes okay about a half an hour at most I wasn't talking so much I could probably do it about five okay thanks okay so you can begin to see the power of what we can do with these tools and yet we're building these straightforward apps without developing any code and we can do this very rapidly but yet not lose the power of web objects underneath so we haven't taken away any of the incredible power that a lot of serious developers that have been using this for a long time understand is lying underneath the covers so what a great way to get started with a tool that isn't going to hit the ceiling as soon as we walk away from this application okay so to talk a little bit more I've kind of abstracted away from where this information all came from so in order to talk about that I'm gonna bring out Dan Montana no Joe Moreno to talk about eel modeler thank you afternoon I'm Joe Bereta with Apple I services about two minutes to 2:00 this afternoon I was in the web objects lab someone came up to me and said hey Joe aren't you doing introduction to web objects tools and I said why yes and they said well that begins in two minutes so obviously it was wrong but about it had a heart attack thinking I was gonna make it over here on time for about the next 15 minutes or maybe even short if I can squeeze it in I'm gonna talk about eel modeler but I can't tell you what a modeler does unless you know what an eel model is so it's gonna be more on eel model what an eel model is Neal model provides persistent data store connectivity it Maps data into objects and it defines relationships and these circles that you see these disks the red disks with the yellow circles those represent Yoos if you've never seen that before all in EO is is a Java object in memory absolutely no difference with exception that an EO connotates the data came from say a row in a database table ichiro model web objects app connects to a specific data source so in your web objects application you can have multiple data connections now it does not have to be a relational database it could be a flat file it could be XML or it could be screen scraping but for the rest of my little talk here I'm just gonna go nice option we're talking to a relational database system alright also any ole model will map data at runtime into particular data types example here is a VAR char would become a Java long string and int would become a Java line num it doesn't have to happen like this but that's generally what makes sense this is the connection dictionary inspector which I will show you on my demo so if you can see it in the back all it has is the connection dictionary information we're using JDBC open base and then the URL where you find the database there's usually doesn't have to be but there is usually a one-to-one mapping between a database table and a neo or a Java class in your project and this is where you can see the mapping provided a student entity or student database in your database table maps to a student al very intuitive makes sense also again it provides the mapping between columns and geo attributes also creates templates for you you will click a button and it will generate a Java file for you which will go into your project this is what the file looks like the its this isn't the whole file but the top part there shows the setter and together for last name and first name and then below that white line is where you start implementing your custom logic for example very simple custom method here is full name it's the one we always use for some reason and all it does is return first-name plus a space Plus fastening also in any old model you define relationships you define to one relationships you can define to many relationships just like you do in a database one other thing that's I think is a big win with any old models you can define a many-to-many now even though your database doesn't support the many to many you can in memory following too many relationship and it just works like magic where the middle table which is in the database is sort of hidden so you don't even have to pretend it you can ignore it like your appendix or something all right you can also define relationship rules alright like delete rules cascade deny nullify no action cascade that's a big one cascade you have a student object and it has let's say a one to one to a photo every student has one and only one photo when I delete the student it doesn't make sense to keep the photo object in a database anymore that's how you get off orphaned rows in your child database tables so you can tell ill modeler that when I delete a student didn't write the sequel also to delete the photo you can do deny nullify no action propagate primary key in a one-to-one relationship again between student and photo when I inserts a new student it makes sense already go ahead and insert a row into the photo table and then join them across the same primary key so basically the primary key is propagated and also owns destination it's a little more advanced but and again an example of student to photo if in memory you you can create read update delete your standard crud with Yeo's one thing you can do is you hook them up into relationships and you unhook them when you unhook them if one owns the destination and you don't rehook it up it gets deleted from the database which may be what you want here are some things that yo modeler the tool specifically can do they can reverse engineer database schemas into a Neal model which we've done quite a few times probably wants a session so far generates sequel to create or sync database schema this is good if you don't know SQL like I don't know SQL - well so I just use the OL modeler to cheat it can graphically create fetch specs in the next session there the next session is they're going to talk about fetch specs all effects spec is is a query on a database and you can do it programmatically in your java code again this doesn't mean you have to put sequel in there but you can generate a fetch spec programmatically in your code or you can store it graphically in your ill model allows importing and exporting of data modeler can import from a flat file into a database or can export into a flat file these flat files we call pea lists or property lists and you can also browse live data eel models just the tip of the iceberg though there's a whole layer of middleware between your web objects application and the database and this whole area of middleware we call AOF Enterprise objects frameworks and basically your real model works with AOF to keep a OS Java objects in memory synchronize with the database and vice versa you make a change to a Java object in memory that represents a neo when you say save changes that sequels go into the database and here's an example of just how simple it is to get data from a database in your java code change it and then save it to the database the first line there it's basically saying give me all the students with the last name Smith so you get an array of objects back the next one is we're gonna take the first object object at index zero and we're going to change it from Smith to Jones and then the last line we're gonna save changes now that editing context is basically just a bucket that your data goes into and it watches for changes and then updates the database that you'll get some more exposure to in the next session after this so this is the key a neo model provides a layer of abstraction that minimizes the cost of change as we switch over to the demo I'm just going to comment that we've all experienced change in requirements it's management's fault or for technical reasons things just change then pay our bills so when we do here is open a neo model and reverse engineering correct I'm gonna open a database and reverse engineered into a neo model like you've seen so many times before around the database and we're not gonna do anything with primary keys they're not gonna be any relationships it's just going to be any old model of tables so these are the tables first thing is the connection dictionary this is what you saw in the slide earlier this shows you have the database and you know the île model talks to the database this is the URL right here and that's the database that it found and you can have your login and password here and you can go right in here and change it so now we're gonna flip over to the diagram view and we're going to focus on two entities the student and the photo that we were talking about earlier there's a student there's a photo we didn't tell it to assign primary keys I'm gonna go in here sign talent ID is a primary key and talent ID this is what I really like I always forget where the foreign key goes you know well now I know it goes onto too many side but I used to forget and I joined the relationships wrong when I did inspect them so now I just click here and then drag over to the other one now it won't let me connect to photo because photo is a different data type than talent ID but it will let me connect to talent ID brings up this inspector which I'm going to minimize close for now and you see it's actually joined the two date of the two tables and there's actual real data behind these you can browse them and if there was real data there we go yeah there's real data behind them so the next thing you do is save your real model it's gonna give me a warning I know because I haven't gone through and made it all copacetic but I'll just save it in my home directory with the unique intuitive name and now I'm gonna generate a Java class all right so I'm highlighting the student entity I'm just gonna turn this off which will explain in a later session what I just did and we won't click on the Java here I didn't give it a name so it's gonna assume to use student Java make sense and it generated a student dot Java file I go my file system go home here's my student Java I can show you what it looks like real quick in a really large font it puts setters and getters for the first name and a last name now one thing you'll notice is that's the only line of code that actually goes to the database and pulls out the data there is no sequel in there and then again down here we would just start putting in your custom your custom business logic such as full name and the last thing I mentioned I don't know sequel so if I was generating this schema any old modeler and there was no database under it I can very simply come here and just click on this sequel panel here let me turn everything off to show you explicitly what it's doing it will create the tables that you want there's a sequel and this depends on what type of database you're connected to it'll give you primary key constraints primary key support etc and this depends on again which database you're talking to and it generate the whole schema for you so that concludes my portion of the talk I'm going to turn it back over to Barry let's talk about direct to web thank you [Applause] okay we have just enough time to talk about directed Java client a little bit direct to Java client is similar to direct web but it has a swing UI interface okay so it's not using the browser it's a pure java application it gives you a little bit of a richer experience than the limitations of the web again it's very rapid development for these kinds of apps and the thing to remember about this is that it's probably easiest to deploy these apps on Mac OS 10 okay because we've got this great Java platform that you've probably been hearing about in other sessions and you're guaranteed to have Java there if you deploy this app on the steam-powered Babbage engine or the as/400 of the system 390 or something you'd you know it depends on the Java that runs on that environment on the client because you're not relying on the browser okay so you're a little bit you know you have to make sure that the clients that are going to connect up to this but we think we have a great platform for you to develop and deploy these kinds of applications very rapidly so web objects is not strictly limited to an HTML presentation you've also got a swing UI interface to this okay so let's go right to a very simple demo that we're gonna do let's build a new project okay and it's going to be a directed java client application we'll call it my school - okay I'm going to add one additional framework here that just simply sets up some parameters for me it's called the Java client class loader so it'll it'll allow me to run this app much quicker let's run the pic the model again the model is courses so we use the same model that we were using before except now we're going to display it in swing so we can build and launch this application one of the things that that was set up there for me normally this would go ahead and launch it in the browser I'm actually going to launch the Java Java client launcher okay so it's going to launch us in a pure Java form it can also vend this through the browser so that if you do have to suck down swing classes it can actually do that for you but in this case we're not going to launch a browser okay so let's go ahead and connect up to our running application right now and we'll show you in a bit what that looks like okay so it's the same logic everything that the same model that wasn't my application before and let's get rid of some other things and here it is okay so it's the same kind of thing we were doing but now it's available to me in swing so any any platform that would have Java on it can run this let's look for last names again just to show you that we are live and connected up here's my last names and let's look for similar kind of name one of the things this allows me to do is bring up other kinds of windows okay so I don't need to be I don't need to stay within frames or the windows I can have multiple windows I can click on other other people in my application and I can have multiple windows open same time okay same thing that we had before I've got the tools but now instead of a Java applet this is what the assistant looks like so I can customize this if I want to get rid of facility and I want to get rid of instructor I can apply that and restart okay okay so now you can see I've restarted and I've got ridden to the tabs and now I have the exact same application running in a pure swing UI environment ok that's it if we can go back to the slides okay so if you're interested in checking out these tools we would encourage you to come to the web objects labs here's the times here's the hours it's a great lab it's much cleaner and doesn't make your hands stink as much as it could they ever lab so it's a lot of fun okay the roadmap as I mentioned before I mentioned a lot more of the courses these are come some of the highlights stick around for introduction to uof should be very interesting and these are some of the other ones that are the rest of the week okay people to contact at Apple again Tony trio Veon and Bob our new product manager who I believe is misspelled his last name on the slides here you
