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

# WWDC2001 Session 601

## Transcript

Kind: captions Language: en what what day what day is it today it's a holiday for Canadians right we don't really have to be here we have the day off we're going to be working next Monday but I thought that since its Victoria Day which commemorates the birthday of Queen Victoria - national holiday in Canada this traditionally marks only six more weeks of winter in Canada on Victoria Day so I'm hopeful that the sound is on on this computer so that you can all rise and sing with me god save the queen [Music] but we say [Music] [Applause] [Music] this here is the web objects technical overview got a kind of a smattering of a technical overview in the last session but I want to go in a little more depth I want to actually build build a project without any of those little wizards because we Canadians are kind of rugged outdoorsmen types and we don't need wizards to help build projects so we're gonna do it all the hard way I want to show you the tools I want you to understand the titles of the other sessions and I want to talk what about what is the deal with web objects four or five one it's an application server I don't like that term but that's what we're stuck with it ven's applications with usually web interfaces to the internet but it's more than that it's a most importantly it's a collection of frameworks that do a whole lot of really good stuff for you that that we'll see in a few moments for instance you write apps and they run in this square thing here and they vent interfaces by collecting data from a bunch of different data sources by manufacturing these objects by exploiting relationships between the objects and delivering a variety of different UIs to the end-user it's a developer tool it's got a steep learning curve but that's okay because that means you learn a lot in a short period of time web objects works with java gel by the way and because it's Victoria day we'll be pronouncing it Java for the remainder of these session and we'll be saying project builder in the Canadian way works with a variety of databases a variety of different UIs a variety of different web servers open open open open open open open where can you use it you can develop as Ernie mention the windows continues to be a development platform but I think the experience on Mac os10 is awful darn good you can deploy on OS 10 on Windows 2000 on Solaris on hp-ux theoretically on anything with the right kind of Java to environment and you can mix and match these things as needed and start small on one little server and grow to a big hog and deployment you might start with one application running on a little server like this and then through the ease and miracle of the web objects deployment tools grow to a big scary complicated thing like this where you've got several copies of the same app there and several over here multiple servers and multiple databases and so on the hard work of managing that kind of scalability is done for you I should do a survey here I'm put up put up your hands if you hate it when they stop to ask you to put up your hands people hate off people keep going key ideas web components at the front end components that manage that are responsible usually for HTML enterprise objects at the back end that contain data drawn from databases but they're kept apart and bound together at runtime these components typically can excuse me let's just take a second Yello oh ho fine yeah okay all right I'm gonna say Panama okay say hi to Regis so where were we these HTML templates come on is it serious do you think these HTML templates contain this one special web object tag it's really a marker that says here's where something Goods going to happen here's where we're gonna send a message to another object to cause something to happen there was a separate bindings file that defines the meaning of each of these tags and a whole lot of pre-written objects that participate in this whole process these components at the front end typically emit strings often HTML strings sometimes plain text they could be binary image data they could be Apple script commands they could be virtually anything they can be non HTML components they can be PDF based we have a partner report mill who's exhibiting over in the show that has a tremendous PDF based reporting solution that really works great with web objects we've partnered Europe whap objects we do XML natively and I'm going to show you some XML stuff if if all goes well later in the demo in for which I have 72 minutes and 30 seconds I've got a great clock here and I like that scoreboard I like that scoreboard up there did you see there was a scoreboard to count how many mistakes I make I mean they can put those up for the visiting team or something enterprise objects at the backend these are the objects that implement your business rules they're typically modeled app named after things in your business like customers students courses and so on we have an adapter that draws the data for these things out of a data source and we have these model files that pick a particular adapter from the vast array of adapters that we have now and fetch data from some data source and deliver certain kinds of objects to your application they also automatically manage in a very slick way relationships between objects you're going to see me go completely crazy with the relationships a little later but this back-end enterprise objects framework part is the real gem these are pure business objects that have no notion of the fact that they are rendering HTML or rendering PDF or sending out whap thee they simply respond to messages and deliver back an answer and something else creates them from the database the enterprise object isn't even really aware that it was fetched from Oracle or Sybase or front base or whatever your favorite actually is it's all completely managed for you in a very clean way these are all bound together by your web objects application that locates these tags sends a variety of messages takes the results turns them into the component sends it back to the end user with literally a million in one hooks by which you can customize this entire process at runtime along with some advanced session management every web objects application for free has a session object that you can extend as needed and this session object contains whatever you want in there knowing you know that web objects arranges to have one session object for every distinct user who's coming to your application you can extend this session object to manage a shopping cart or to keep track of what a users been doing and web objects sorts out the thousands of requests that are coming in and delivers them automatically to the correct session objects there's also some runtime monitoring tools the monitor tool manages that huge deployment member that ugly slide I had with all the the instances all over the place a monitor takes care of making sure that they're all running that they're all healthy gives you statistics restarts them as needed well let's see how this actually works I want to I want to do a little diagram here and show you the sequence of flow of control of a web objects application it's the Internet up there and we have a web server and maybe several app servers in the database at the backend I understand the Internet's grown I was going to put four IMAX on it this year instead of three but but we ran out of ran out of time so just to elaborate once again with the various platforms are that web server could be anything it could be virtually anything we have an adapter that plugs into the web server and takes requests coming in from the user on their web browser and routes them to the appropriate application and through that web server the responses from these applications are delivered back to the end-user we have special plug-ins for a variety of popular web servers than that scape server Apache IAS we have a generic CGI plugin if you're running some other peculiar web server web server web server pardon me and the application server has a limitless now that is Java to of potentially limitless collection of machines that you could deploy the application on anywhere there's a Java to environment this is a major step from last year last year we had to tell you that you could use hp-ux or Solaris or Windows NT or Mac OS 10 server now you can use virtually anything with the appropriate Java Runtime the adapter at the backend in the past we had several different adapters one for every distinct database and there was a whole mishmash of which adapters ran on which servers and a lot of restrictions that prevented you from getting for instance to sequel server if you were running on Mac OS 10 a lot of other combinations didn't work but now that we've got JDBC as a pure Java way of moving the SQL commands back and forth from the database we can talk to all the databases on all the different platforms so let's suppose we had a really simple application here and we're gonna follow the flow of control here to give you an idea of the processing that's going on I'm picturing some sort of beginner application where I type my username in there and then it fetches some info about me and says hi Steve well there's really three steps that are going on here that the web objects application is going to take some values from that initial request it's going to notice that you typed s haman in in a form field it's going to invoke some sort of an action some sort of logic that says all right we got this submit button what do we do now what page do we go - what processing did we do and then it's going to generate a response a stream of HTML that's going to come back to the end-user how does this actually happen well a user would submit a request to a web server the adapter on the web server would find one of many different instances many different identical processes representing your application and and forward the request to the right one your session object in there would find the the web objects component that generated the initial page the component that put up the what's your name page and it would study the various form values that came in we seem to have received a text field someone's type s haman in the text field and according to our instructions we need to bind that to our user name variable the requesting component then there's another step it goes through it figures out which action to invoke the submit button is connected in it by a means I'll show you - perhaps a specific Java message being sent to a specific class back in the application server that class might be a method called that action might be a method called handle login here returns another component so there would be some Java code associated with this they could do whatever business logic you want I want to fetch the customer with the username that we just got and I want to return some other page and I want to put the customer's name and in this session that kind of thing is a fairly common paradigm that action returns another component that other component is the thing that's going to generate the response to the end user so the session loads the response component another one of these things with web object tags in it it studies them it finds the tags it identifies what it needs to replace in this component so that it can generate the response in this case it's noticing I've got a thing here called a I've got in my HTML file I've got this tag that says name equals username and in this extra file I have a definition that says username it's a string and you send the message customer to the session object and you send the message first name to that object whatever comes out of that replace this little tag with it and all that that may cause various objects to be fetched in the database all transparently via this Enterprise objects framework we might in this case need to load some sort of an enterprise objects model that says oh by the way customer objects are coming out of the cust table on oracle and the enterprise objects framework automatically figures out whatever ugly SQL it has to generate it sends it to the database a bunch of rows come back from the database and they're converted into enterprise objects this is all happening while you wait it's all happening without the need for you to have any intervention here this is a very seamless process so a customer object is created with the results of that fetch from the database and populated with some data we've got this model set up that says customers have a name and they have a address and they have the first name on a last name and a relationship to some other things the object is created automatically we need to send the message first name to that customer object and it responds Steve hey coincidence and that response is substituted back into the web objects template you can see it used to say web object name equals user name and now that's replaced with this single string steve so the stuff that's actually going out to the end-user has no evidence that it's ever actually been through this entire web objects process here then this session sends the plain HTML back to the user and they are happy happy happy here it comes welcome back Steve but it's actually a fairly elegant process when you get used to it I mean it seems like 300 steps when I describe it here and it seemed like 10000 steps when I was making this slide but most of those steps just just happen automatically for every web objects application it's just one of the many great things that you get for free with this environment and we call that the request response luke request comes in from a user and a response is generated and sent back to that user and if you look into the web objects documentation we all heard help as well the web objects documentation is becoming you'll see a variety of methods like take values from request or invoke action or append two response and these messages are automatically delivered to various components in your application if they wish to receive them and they can all participate in this and add their own little bits of HTML or modify state in some way as the result is going back so that request response Luke was considerably more important to web objects developers one year ago because if you wanted to do that more than 25 more than 100 times a minute you had to give us $50,000 now you just give us $700 you can do it as many times as you like what what a deal what a deal you'll note from this that the SQL and the HTML are kept as far apart as possible this is really a fundamental tenet of web objects we keep database logic over here database access stuff over here we keep user interface code for drawing UIs over here we keep business logic in the middle and there's no need for you as a developer to worry about writing HTML yourself we have tools that can help you do that or generating SQL yourself again we have tools our modeling tool that builds that model they all figure out how to do that unless you want to and that's one of the other great things about web objects is that if you want to you can override virtually every one of those arrows on that last presentation and cause something special to happen in your case frequently not necessary but a great thing to have in the in the bag of tools as we move along your brief drink of water here excuse me those are really 100 degrees in Sacramento today I mean isn't that like the boiling point of water how do you stand it down here so let's let's talk about the tools project builder web objects builder yo modeler web objects builder is one of the more interesting ones that you can learn all about in session 603 on the introduction to web objects tools it recognizes the fact that you need to create a whole bunch of these web objects components in an application and a component typically contains some HTML like we just saw with these web object tags in them and that's it's a directory called let's say main wo with a file and it called main dot HTML then there's a second file called a wad file just love that name the wad file that defines the meaning of each of these tags in the first file so you see we're keeping anything even remotely resembling business logic out of the HTML it's just this one little tag then we put in the HTML hands up everyone who says how come you didn't write the closing slash web object tag on this little example all the yeah I write all my buddies over here why did the font would have been too small if I did that the technically a web object name equals string and then a closing tag you can learn all about that are we going at it like that level of detail any of the other sessions I don't know but there's typically a Java class associated with each of these as well so my main component for instance there's really three files associated with it an HTML file a web object declaration file and a bit of business logic in this Java file it's Java Java file really do you really prefer that I can't believe it and a bit of logic that you as a developer write that defines what happens for some of these tags when we click on place order on the hyperlink over there it sends this message and it adds something to a shopping cart and takes us to a checkout page you write logic like that in a Java file web objects combines it at runtime with these HTML and odd pieces and a stream of often plain HTML was sent back to the end-user that would be a simple component you're going to create a lot of these in a web objects application usually one for each page often one for little sub components of the page often you'll collect interesting components from your buddies and drag them into the application and reuse them in effective ways you can have components that wrap themselves around other components to enhance what the inner one is doing and we provide components for a bunch of common UI elements out-of-the-box but you typically write lots of your own using the web objects builder tool now how do you actually make these components they're all files okay you can use whichever your favorite tool is for editing editing these things but you know there are sort of professional level tools as well and I don't know why you couldn't do with with cat although UNIX hackers maybe we'd rather use DD you know you could use you can use that to create a component alright let's let's show that but you can also use any visual HTML editor you like some of them particularly go-live have excellent support for managing web objects tags as well and we have our own tool that we think you'll like now nobody says you have to use web objects builder but it's it's it's pretty nice engineering is done a nice job on this thing so this is what web objects builder looks like when it's editing one of these components and you're gonna see this in excruciating detail in a few minutes here so you have a view of some HTML in the middle with little Taggy things in there that represent objects you've dropped into this HTML application up at the top you have an inspector that tells you the properties of the currently selected thing in this case I've got that that click here hyperlink selected so you can see the properties of a wo hyperlink object at the top and at the bottom you have an object browser that shows you what attributes and methods are available in the collection of objects that your application currently contains and you draw lines I can tell here that my list is called main my main component has an application variable a session variable a product variable it also has a place order method web objects builder has this out by looking around at the other tools to see what you're doing and I would like it when the user clicks on that hyperlink to send the message place order back to my main object so I can figure out how to get to the next page well you do this by drawing a line it doesn't look exactly like that that was the closest I could come in PowerPoint but you draw a line from the method that you want at the bottom to the object you want to connect it to at the top the hyperlink in this case and you choose a property of hyperlink objects hyperlinks have a string that they can contain and they have a direct action name that I really must read the documentation about sometime and they have a bunch of other properties here that are available but I want to connect it to action which is certainly the most popular one of all the hyperlink methods this is the method you connect to if you want a hyperlink to actually do something and having done that you'll see at the top the inspector reflects that particular change so web objects development of web objects builder is an ongoing process of drawing lots of these little lines connecting things from here to there picking through objects in your browser down here design your HTML visually up here and saving it all as one of these main wo components or header wo or catalog item wo if you like you can also work in raw mode if you're really excited about typing raw HTML you can dive into that with web objects builder and it will give you a view of the text of the HTML file and the actual text of the WOD file if you insist on now you know occasionally that's handy you can also use palettes to organize your stuff these these first two over here are palettes that come with web objects there's I think that are five that come with web objects now I'm a bit of a palette pack rat and you'll see some of my others later you can create your own palettes with useful objects on them like the amazing PluralEyes err that we saw last year or a shopping cart or a buy button or a localizer bar right these little things once and put them on a pallet then you can reuse them in in web objects easily by dragging and dropping I'm sure are wondering what that one in the middle is it's not working right now I really want to show it to you as a shame well give it a shot we have lots of extra time at the end we'll give it a shot another important tool geo modeler this is really an editor for a Oh model D files or if you want to be incredibly antek yo model deed directories that contain a bunch of files one of these object models is full of information that describe how to connect to a particular data source how to retrieve values from certain tables in that data source what kind of objects to make what kind of relationships to have between them and EEO modeler is really a graphical editor that lets you set all this stuff up so this is one that's kind of finished for a cars database that you might have and hidden inside this EAL model is a lot of useful information that you that you've set up there's database connection information that tells you the particular database that you want to talk to in this case we're talking to - you know that's not even right that's where do we have the real why I made that last night I looked at my slide know Jesus my Alban was wrong and this one is not really any better but you'll see that in a moment because we're gonna make a neo model and you'll see what it actually looks like there's also information about entities and tables built in here an entity is a kind of a thing a general class of things that come out of a neo model the table is the particular database table they come from we can see in here that the MDL table in let's say our Oracle database that this thing is connecting to every row in that is going to correspond to a vehicle object I'm not stuck with ugly schemas with incorrectly spelled table names in the did not that that ever happens but in the in the database I can put a nice meaningful view on it I want the vehicle objects to come out of the MDL table in Oracle there's also detailed information about each of these entities the vehicle object you can see it's got a bunch of properties it has a base price and a loaded price and some image JPEG data and those things all correspond to certain columns certain columns in the Oracle table that we're getting this stuff from for instance the base price of the vehicle corresponds to the P R min column in Oracle so once yo MA once the enterprise objects framework has manufactured one of these vehicle objects for you you can send the message base price and it's going to go oh okay here you go returning the data from that column of the Oracle table there's also relationship information down here at the bottom vehicles have a related maker object the Corvette object is related to the Chevrolet more some of the relationship information in the bottom half we can see that there's maker objects corresponding to a different table and eel modeler maintains these relationships sometimes one-to-one a car has one maker sometimes they're one-to-many the chevrolet makes a whole bunch of cars and all that information about how to actually do those SQL joins is hidden in this model and it's something you can exploit very easily later with web objects builder yo modeler can manage some fairly complex relationships here you get a diagram view that you saw in the previous presentation that lets you see what relationships actually exist you can even draw new ones that might not be actually defined by the database and my favorite part of all this is what we call key value coding it's this idea that you can make up these little expressions vehicle maker named ask the vehicle object for its maker ask that object for its name you got a string like Chrysler vehicle dot packages give me the list of all the packages to go with this particular car you send these simple string messages of these dots in them you send even fancier ones with this @ sign notation they can do averages and sums and maximums and minimums and that's that patented key that is it patented this patented isn't that software patents are evil but this is a good one this is a good one this is good sorry sorry oh I forgot where I was go but not this one this is a great software patent and because it expresses this simple concept that no one's thought to do before the a dot B dot C to D as a stream of messages in a you know I was gonna say language independent way but that only matter it last year when we were doing Objective C and Java but in a nice neutral way that lets you specify how to traverse this graph of objects and how to get results out of it you'll see this exploited in web objects builder when I get to that in a moment I tend to go nuts with these things I am I made up one when I was working on my demo I made up an expression like that that had seven dots in it and to add signs which was a personal best for me I don't think I've ever come up with a reason to have two of these at signs and a key value coding expression anyone ever had to add signs and key value coding before I'm on the first off cheese but thank you there you're not but it was so complicated I looked at I couldn't understand it after I'd done it I thought well maybe you better not do that in today's demo so we'll try to keep that part simple let's do a really brief ile modeler demo if I could have a demo screen three here you can see that I'm working on a machine that's protected by this secret shroud here I think this is our new 18 and three-quarter inch monitor that hasn't been released yet so you can't actually look at it but I'm looking at a great picture here so I want to build a new model using île modeler here meant to launch this before here we go no splash screen in this version let's build a new model and remember a model is just a document that describes all of this connection information that you might need in order to determine how to make objects I'll tell you a little bit the database I'm using I have this big database of presidential elections from the past hundred years all the candidates every who's ever run for president because I'm fascinated by this American process of how do you decide who the president is that's okay I don't know something about electrical votes I don't really know what those are but it's just it seems like a great database to kind of work at maybe we can write a business rule that decides who the winner is and kind of speed up this process a bit here so I'll tell you one of the great thing you want to go with great things about web objects five we have simplified your choice of database adapter jdbc or none I love the nun adapter but I think today we use the JDBC adapter one adapter that lets you connect to a variety of data sources in a nice cross-platform database independent kind of way you need to have what they call a type 4 JDBC driver for your particular database install in a certain spot on the system but since those are pure Java classes you can do that on any machine here the fun part is in remembering the clever syntax for this URL that connects you to that particular database this is my least favorite part here on JDBC : oh god what am i doing open days go on / / localhost / US elections that's a URL that describes how to use JDBC to load a certain kind of driver get to open base in this case and fetch information from the US elections database running on this machine these plugins are little helpers because I gather JDBC isn't just quite rich enough to find all the information that we need from a remote data source so we have a little additional classes that help out here and now you're prompted for what kind of information from that database do you want to actually incorporate in your model there are I don't have any stored procedures to worry about I got to do custom enterprise objects later but we'll deselect those and look at the rest of these what of all the tables in your database which ones you want to use well I've got a table for candidates and I've got one for elections and one for votes and well let's use all what the heck now yo modeler wants to be a nice citizen and and work with the referential integrity rules that you specified for the database you know I was it next year because I don't know what this is all about this I'm sure I should look that up you know what that there's a reason I'm in sales and I'm not actually delivering the consulting services it's probably safer for everyone that way but here here is our yo model that has just been created and this is a view like we kind of saw a few dozen PowerPoint slides ago it says that we've got campaign objects coming to the campaign table and party objects coming from the party table and you can actually look at these in here if you want there's a little data browser where you can say fetch me all the party objects that you got in the database a whole bunch of the america-first party and the farmer-labor party and the little you have a liberal party down here oh isn't that interesting I thought that was a bad word but there's also a for instance there's a candidate object and you can see that the candidate object has a first name and a last name in a home state and a couple of relationships he's a candidate is related to a party so-and-so ran for the Republican Party candidate has a one-to-many you indicated by the two arrows a one-to-many relationship or a list of campaigns that this candidate has been in and there's other useful tables in here there's an image table of photos of certain people but I'm gonna like to add a relationship that's actually missing here I'd like to be able to get from the candidate object to the picture of the candidate object so I'll add a new relationship not currently defined in the database to this particular model and then the inspector you can give it a little more detail about this I want to go over to the from the candidate table to the image table and it's a one-to-one thing we're gonna join the image ID here in the image ID there connect and now that I've done that every candidate object I get I can now send this message image and it will automatically fetch the picture of that guy for me it actually does it in a delayed way we have this incredible deferred faulting you should really go to some of the advanced COF things and learn about this is hilarious but the way we can keep stuff from being fetched until it's actually need these engineering guys they've done a lot of work to minimize the hits to your database so this is I'm editing a document here and I want to save this let's call this put it on a yield desktop here this is my elections 'i'm one and we'll come back to that little later that's the end of the observe a brief feel muddler demo can i go back to the slides please we're gonna come back to this you know I left it there we're gonna come back that was the really brief ill modeler demo project builder go to the session on project builder there's several sessions on project builder if you like tab sliding in and out boy are you gonna love this thing it's like it's like it's kind of like the Ice Capades with all this stuff sliding in and out and it's actually much more powerful and extensible than the old project builder I I admit it takes a little getting used to but I found that actually after I read some of the documentation about project builder I liked it quite a bit more than I did before I read the documentation this is essentially your development environment you compile things in here you add resources you check them into another CVS if you want you can hear all about that in other sessions I'm going to use it minimally later oh now we're gonna have no demo oh that's great great we had one slide in between those two demos I thought I could cool down a little bit more first can I have this thing back please let's build a project I want to make a new project we have all these wizards that certain people feel they need to use but we're gonna actually choose a plane unassisted web objects application here what do we call this woe is me how about that and I want to make a simple application that lets us browse for presidential candidates the idea is going to be I type part of the name came in and I can see if anyone named Haman has ever run for president which I'll tell you in advance no they have but we can try other things as well so project builder coordinates web components in your application here's a main wo that we were talking about before it's a plain empty little one that doesn't do very much it coordinates classes we've got an application object here Oh big font hey here we go an application object that doesn't really do anything other than to say hi welcome to what was me and a session object that will be shared by all users this is really all the code there isn't this application is a few lines of these trivial classes here ready for you to extend as needed but I want to start by working on this main web objects interface file here so this is that editor we were talking about before if you like you can think of this as just a simple HTML editor Explorer exploder ok exploder went up and you can fool with the fonts and you can make things bigger and you can bring up a color panel and be sure to go to the session 9:57 on using the color panel no there's there isn't a session I like that because this takes me back to the old necks color panel it's so fun to see these things still here and if you want this is just editing HTML I haven't really put anything very interesting in it and if you wanted to you could pop over and just look at the raw HTML and fool with it in here if you want is nothing to this one yet but it gets more interesting when I want to put dynamic objects which are what a lot of these little buttons are up here into my application what we really want to do here is have a form that's a that's a form gonna be rendered as a form on the user's web browser we'll put in someone's last name we'll take part of a last name in a text field and a submit button I want to do a legitimate survey here has anybody in the history of the web ever felt the need to actually click on the reset button ever really even in the most complicated thing do you ever need to click on reset you know what else I hate are those stupid links that take me back to the top of the page well who needs that who can't figure out how to get done sorry I've had all these politics on the brain for a while here at so now let's let's actually arrange to fetch the some of these candidate objects now these these tools talk very nicely you'll recall that we had our modeler define a candidate object with a first name and a last name and a relationship to a party and if I drag this little object out here and into this view it's gonna add my object model to the big whoa is me application and it's gonna add what we call a display group to this particular component and a display group is this total Swiss Army knife object that knows how to fetch a certain kind of object in this case candidates it knows how to collect the criteria of what candidate you want to fetch last name is like this it knows how to send them back to you in batches here's the first ten here's the next ten here's the next ten so all you need to do is draw some of those lines to tell the objects in the UI in the top half what messages should be sent to the objects back on the server to coordinate all this fetching so one might start with let's have that submit button send the message qualify datasource draw a line like that now every time a user sees this submit button in their web browser it's going to send the form back to my application and send the message qualify datasource to the display group and the display group is then going to collect some candidate objects defined according to my wishes this display group also knows the various properties of the object is fetching so here's all the properties of candidates and you can hook them up here I want the candidates last name as we're fetching it to be drawn from there by the way I want all the I services guys up here what's more the kickoff if I miss anything obvious like if I forget to save something cuz y'all just coughed a little bit and then I'll just remember to save it thank you thank you well we could go with this we can go with this application we could save it and we could run it and what would be one slight problem with this application then display anything would you take it on faith for me that it actually fetched objects will just now move into the step where we actually display them or just let me to draw this demo out even further than I have already all right let's display them what a great idea okay sure here we go let's put in a table web objects has this little table thing with an idea of if you want a second row that repeats over and over again so I want to have one row of this table for every candidate that comes back and I can ask this display group give me all of the displayed objects on that repetition it's a common design pattern you have a repetition associated with something that's going to be done over and over again so we're gonna get one row of this table for every candidate that was fetched we it's also a common design pattern to use a special object to go through the table kind of an iterator object so I might want to come down here and say I'd like to add it can to do it Canada take away candidate object of type can the I don't have to type the whole thing is sexy a and I want to create a candidate object that's private to this particular component and that candidate it's got a first name on a last name but if I make an association like this item this object will be set once everything that came back on the list if I fetched 37 candidates 37 rows in the table I'll actually have 38 rows because this is a title row name and I'll fill these in later well if I click on this button here these are webobjects strings these are the simplest possible objects in the entire web objects framework they send a message they get a result they take the string they put it into the HTML well I can have those send a message like first name to the current candidate oblong cup your first name to the candidate object you draw a line like that last name to this other string object and this this is probably worth actually trying this to see if it works it doesn't work with a second night it'll be great but this is a good starting point here this will actually display candidates it will fetch a list of candidate objects it will iterate through them one of the time and send the first-name and lastname to each one get on with it I can hear everyone saying so we come back here to project builder we compile always a good opportunity to have a little drink of water it's compiling the various Java classes it's making a big honking jar what what a web objects application actually is it's kind of a complicated directory with let your dot HTML files and your dot water files and somewhere in there a jar a jab archive of all of your classes then there's all these other frameworks somewhere else in the computer that themselves contain jars and other resources and when you run a web objects application you're actually launching this shell script that looks all around it constructs this humongous class path to find all the objects in all the jars all over the place and runs your your main class to get the application going and as a convenience it also launches your web breasts so there's the class path by the way you didn't believe me but look at that holy macro go I don't have to type that this is actually gonna launch my web browser and have it hopefully display some of these candidates for me here oh there's my fantastic form let's compare that with what the original actually looked like everybody whose last name begins with h h backslash H there we go there's a whole bunch of guys whose names began with H how many people can identify Austin holcombe Enoch hole Twix I'll give $5.00 to anybody can tell me what party Enoch Hall Twix ran for president for anyone anyone no tell netting into my database and looking around for your Airport machines anybody well let's find out well given that we have a candidate object it's fairly easy to add another string one of these strings let's ask the candidate for its party and ask the party for its name I'm now working my way through that object graph I've descended through a couple of levels down here and what's actually going on as I'm doing this back in the wad file is there's now a string called string 3 and it's getting its value by sending the message party to the candidate and by sending the message name to that thing key value coding in action save that submit this again and look at how much we're gonna learn now all people from the natural law party in the Communist Party the oh the prohibition party who had prohibition party in the pool did anyone have the that guy was liar but by walking through this this graph of objects you can put up some pretty interesting data pretty fast on the screen and I'd like to take advantage of another relationship that's defined in this database you'll see that each candidate has a thing called campaigns that's a list of all the campaigns that they were in he ran in 2000 and 96 and 92 and 37 in 1776 and whenever else they had elections I'd like to display all of those can't those campaigns for each of these candidates because that gives me a let's put a nice little table and you're gotta be neat elections which elections was this guy actually in well let's put in a handy repetition object so you have a little loopy thing there that says let's just go over some list just like we did at the table and do something over and over again let's loop over the candidates election objects like that let me create a little object here called an election this would be a little private instance of the election class in my application and that'll be the item that we're going around the list with and we got a little string here now we've got a repetition inside a repetition but it just works let me add a little string and we'll hook that up to the election year now at this point we have to actually pause and compile because in all of that it added a whole line of code over here it added this line that declared an object called election so we'll just stop whoo recompile have another drink water close this browser it'll open it again in a second here our lovely whoa is me application look at that class I just love that class path when it goes by because it reminds me how much work web objects is doing for me look at all that stuff it's picking up that I didn't have to describe that a certain amount of pattern when you're doing this here hey H oh look at all these guys that ran all these different elections somebody ran in 1892 my database only goes back to 1892 I'm sorry I could not get the complete database done in time maybe next year we'll go back to the Magna Carta and have every election since then but for now we can see all I recognize a couple these guys go John Hagel another natural law party and Warren Harding he was somebody wasn't he Benjamin Harrison didn't he win I don't know we'll get to that later but it might be interesting to click on some of these elections and find out a little more information about it I gathered that 2000 election was kind of interesting a little news about that filtered over the border so it might be might be useful to have a page where we can display some details about a particular election this gives me an excuse to introduce the idea of a component that does one thing and that does one thing well I want to make a little components in web objects builder I'll make a new one and actually you know what I got two ways to do it and the other way is better for reasons that are not worth explaining right at this point in time I want to make a new web objects component inside project builder for anyone who's wondering why I do it this way take a look at radar election details and you know we should go to the project builder session to figure out what the heck is going on with all these target things I think that's the one I want I don't know is you're copping going on over there no no coughing good I'm all right I've created another component and I've added it to my application and the idea of this one is going to be it's going to have its own private election object let's create another one and let's remember to set it because we want to set it from the first page the fabulous election of some year and we're gonna display everybody who ran in this particular election another table you don't the talk you can really do this pretty fast each election we want to go through all the campaign's associated with that election we want to have a campaign object on this page as well because these are separate pages separate objects and for each campaign that's gonna be my list I want to display the first name and the last name just like we did before of the candidate relationship I got a lot of relationships in this database first name and last name and let's display the party because that's so easy it is stop laughing it is easy you love this party the party's name and let's put titles on it because my mother might be watching the DVD and she'll wonder why I didn't put titles on here and a date right by the way I'd like to say hello to everyone that's watching the DVD in the future hello people in the future with the flying cars how are you how is web objects version 14 alright are you looking back at this and going that was so primitive I can't believe how did my children turn out did they go to college I hope so can i expense their tuition now can i expense their tuition with that because i mentioned them and i don't think so party party thank you I spelled party wrong and let's get fancy here let's display no not up there let's display how many votes each person got because this really gets into borderline abuse of this whole key value coding business here but if you dig deeply into this kind of stuff you can say for each where are we here for each campaign I want to add up won't take all the votes objects and display them there but I don't really want to list all the votes objects what I want to do is throw this little token that says some don't list the things on the right-hand side add them up so that's gonna add up how many votes each guy got all that is a key isn't a nice object that can display everything about one election provided we tell it which election we want one could do that on the first page remember the main page remember how we had a hyperlink or a piece of text displaying the election year I can make that into a hyperlink by clicking on that little button which wraps this thing inside a wo hyperlink object and hyperlinks actually send an action message back to the application when they're clicked on just like my submit button did but I want this one to send an application of my choosing show me all about this here election how how long can an identifier be in Java I don't know it's there's at least that line and I'll tell it to go I just type even knew I had a page called election details in there already and we'll arrange for that hyperlink show me all about this here election to be called for everyone these are going to be hyperlinks and even though there's 30 election years on the page they're all sending the same message back to web objects and web objects knew how it made this page so it can easily just figure out which of all those 35 election objects is the one that sent me this message this is really kind of a powerful concept you're not encoding junk into the URLs yourself as you generate these pages you're letting web objects do all the heavy lifting of sorting out collections of objects and indicating to you which one was actually selected say that say that come back to project no wait what are you doing all right wrong wrong application let's say that project okay here we go Steve's gonna try to type a line of Java code without making a mistake here's my main application here is my nice show me all about this here election method that I just asked web objects builder to create for me you can see what it's doing here it's looking up the page called election details and it's returning that page that page will be blank if I don't dive in here and rescue the situation well I want to tell the next page set the election that you're displaying to be the same one as my election object remember I've got an election object up here that I'm using to go around the loop of all the elections I want to that's going to be set automatically to whichever one of the forty nine hyperlinks it was that sent me this message but it's going to set it to the object that caused that hyperlink to be created and just in one step like this pass it over to the next page Oh is there any hope that I've done all that without making a mistake and here any copy over here oh not the sneeze oh no not the sneeze that was a secret single signal for something that I've forgotten okay start running this again here how come no one's asked why I'm running the classic Internet Explorer yet and not the carbon one it will become clear in a moment it's part of my fascination with XML and my shock and horror how some things aren't implemented as widely as you hope when you start designing your your web www.daytontoyota.com lets you know you don't believe me this is a real database tell me about in nineteen fifty two who here voted in the 1952 election Bob did you know okay well the 2,000 that's the one that I remember the 2000 election and now that I got this page going here we'll look at the details page and the first thing I might do is to take that string that's representing the number and in the inspector one can say don't just pump up the number pump but out with commas because that just looks so nice makes the change like that is coming out with comes oh yeah you can take at it you see this little path down here this is how things are nested I got a string inside a table data inside the table row inside aw oh repetition I could take that table data and inspect it and say you should horizontally aligned everything to the right because that would probably look better that does look better you can even come in here and say let's add in this first cell an image object remember I added that image relationship about 23 minutes and 11 seconds ago in the demo that was not for no reason try translating that sentence remember my candidate object has a relationship to an image object and images have some data and they have a mime type that just says whether their gift for jpg I happen to have a database table full of images here conveniently and oh that's better how do you like that would you vote for this guy I don't know well a lot of people voted for some of these guys and to my naive view I might think that since this number is greater than this number but I don't know anything I have a Canadian math degree we do it a different way up there but but you know what I'm kind of I'm kind of a I'm kind of a visual I'm kind of a visual guy not only am i rugged outdoorsman but I'm also kind of a visual guy and I would like to leverage some work that's already been done in this area how many of you have heard of SVG from Adobe scaled when scalable vector graphics looks a lot like PostScript in many ways always XML it's a way of describing an image and sending it to a browser and then the browser is gonna draw it for you I want to draw those little maps like they have on election night with all the states colored in wouldn't that be cool I've already got in my database information about you didn't see the electoral there's an electoral votes table in there as well but how many electoral votes each guy got wouldn't be cool if I could hook up the list of who want electoral votes where to something that knew how to draw a list of states wouldn't that be cool no oh come on please thank you okay well too bad that part's not working no no actually no it is working it's not going to work yet because I have to add a couple of frameworks to my project frameworks are collections of objects that already exist we give you some I wrote some in my spare time and I enter that on the timesheet appropriately and if I add them over here too I happen to have I got this this firewire disk I love them firewire discs boy-oh-boy because I've got conveniently over here some frameworks that have just been hanging around waiting for the right time to be used in a in a situation just like this let me add three of my favorite frameworks of objects I've personally written in the past to this application actually you know what what let me quit that okay now I'm going to do this what we'll discuss that later I want to add them and once again I look at all these little targets and I go oh man the application server I think so these are what the project builder can build different targets and they build a collection of things that go for the web server like static gift images and stuff that belong in the web server but in this case I'm adding frame which the actual binary and because I've done that I can take my little election details component go back into web objects builder here and take advantage of some pallets remember I talked about oops pardon me that's just one app on the screen at the time how's that ever talked about pallets these little handy collections of pre-written objects that other people have written you get a bunch of these width web objects none of them draw maps but they do a number of useful things this one does you know one of the great things about web objects is that this product is so sophisticated that here's a whole pallet full of objects I have no idea what any of them do but it comes with web objects it's great it's it's smil this is a whoa smell what is that synchronize multi is there a session on that one let's hope so because this isn't it but let me in addition I've got I've got some pallets of my own I'm a bit of a pallet junkie and I've got a few of these guys there's one and open him and we'll open this guy and these are sort of related to those frameworks and these pallets gosh I just thought of something here no I'm good I'm good these pallets are objects that I've collected over the years they do various useful interesting things I got some little JavaScript doodads and I've got a thing that makes words plural that was the big hit of WDC mm thank you very much and but to alway do you see this these draw maps these take SVG files back on the server which you can create with Adobe Illustrator or a bunch of other applications they're just text files that describe polygons put line line line line line line line line line and then you give it a label montaña line line line line line line Indiana this line and this other line Michigan and if you make one of these things up Michigan and if you two polygons if you make if you have one of these things in SVG I wanted to find an excuse to use this xerxes parser that we've put into web objects 5 this is an XML parser from the Apache project and someone wrote a little thing that would parse one of these SVG Maps using this parser which is it's so easy it's unbelievable and every time it saw a polygon it would look at the name of the state Montana and it would consult another list is Montana on my list okay I will fill it in it's not on my list I'll leave it outlined and I put a bunch of these things together on a palette like this I got one a Canada one of the u.s. one of Europe I've got one of North America which might as well use that one since I am thinking about my comrades back home on holiday today at the beach not working sweating sweating up here under the light over there six more weeks of winter I forgot well we're ice fishing we're ice fishing at the beach what's a guy yeah exactly yeah what's a girl with you we let me draw them oops we there we go that's an object that will draw maps of Canada and/or the United States provided you tell it you bind it in web objects builder to something else that knows about a list of regions this is why I love key value coding we're gonna go in here we're gonna take the current campaign object take all of its electoral votes objects ask each of them for their state ask each of those states for its state name and by that - art selections list can it be that easy people come up to me and they say Steve can it what what oh all right Oh about the wrong thing pardon me thank you for coughing selections what's wrong with that there we go I put two of them in oh my mistake I got ya this time there's this there's this little validation window in will builder that will tell you when you design a component you can say this is a required binding this one's optional this thing will check when you save them and here I was panicking and it was right I I did have one in there that was unbound thank you for the coffee did I say this I save this project builder will build this again I added the framework so they're gonna find the code to load this SVG parsing thing this is why I'm using classic internet explorer SVG plugins are only available for certain browsers not including the new carbonized internet explorer so that's why I'm using this classic thing here we'll start this this is all going to be very anticlimactic if this doesn't work which is strong possibility at this point launch the application its class path is even more complicated now because it includes three of my frameworks and all them little doodads and going to open this up here that looks good tell me about all the guys named no Bush well it's two of them okay tell me about this one talk about the big election of 2000 all this is getting complicated now it's loading up all these SPG things it's loading the Adobe SPG plug-in and for each guy that actually has electoral votes it's filling in that thing with the necessary states but but [Music] but you're saying Steve they're all the same color what can we do well remember part did you have the noise of my eel model that parties had a color you can ask the current where are we here in my object graph campaign ask the current candidate for his party past the party for its color tell the map to use that color Oh waitron one here go quick red ones and blue ones but I I still can't really tell from looking at who the winner is it looks to me like there's more red pixels on the screen is that how it works is it like by square miles how do they do it but I might want to this might be a good opportunity to write a little object that can solve this problem for us once and for all so let's return to this eel model and I must close it let me reopen this eel model here and we talked about the idea of business logic in these objects and so far all the objects that I've got defined here what we call generic records they're just simple containers they they store some data you can send em a message they respond with the data but they don't make any decisions they don't implement any logic but I might like to take a couple of these and make Java classes for them to be added to my project and we'll come back here and actually add those files to the project itself it-it's no creative campaign Java an election Jeb and I want to make them part of my project come look at this panel again and go uh yeah okay that one all right and if we look at the election object you can see that it just has it's a simple data contain it's got a bunch of methods you can send it the message here and it returns the year you can send the message campaigns and it returns the list of campaigns well I'd like to send the message winner and have it implement you know check with the Supreme Court and see what the date is and decide who the things have expired and decide who the winner is whatever that is now that that's I want to write to methods here we want to write one method that sorts everybody according to electoral votes because I understand that is sort of how this works right right and I want to write a second one that takes the sorted list and returns the guy at the top of the list and you all thought I was kidding about using stickies for development there there's a method that returns the winner it asks for all the sorted campaigns here's a method that sorts the campaigns by this by this key sum up the electoral votes for each guy save those let's um let's build that and the fact that not what have I done I just added two additional methods to the election object and if you look back in web objects builder over here you'll see that the we're going through elections and the election now suddenly has this winner property these tools are talking back and forth web objects builder has discovered that there's an additional method available to election objects we can send the message winner and it returns a campaign and here's you can send the message candidate to the winning campaign and figure out who that was and you could put something up here that says your winner last first name last name first name last name I think I can do that compile that well that was happening I don't remember I think I did never hurts to compile it again I want it really compiled you know I want the bits to stick to the disk cosmic rays could be entering the auditorium here and then messing this up it's gonna watch again here lots of chatty error messages here if you like you can turn on a variable it has all the SQL it's being sent to the database spit out here that's fun to read very actually very useful for debugging I mean sometimes you just can't figure out why is this so Sloane's because you were fetching the same object too many times or you weren't batching things in an effective efficient way that that EOF lets you do so I was H guys again John Hagelin he ran in 2000 who's wait wait oh these quote that we put all right I'm gonna tell you something I've got this other monitor here I've got a sticky on here to remind me what to do and right there in bold it says save the EO model I forgot save thank you and build it again sorry the what happened there it was trying to send a message winner to a neo generic record because that's what the previous CEO model said election objects word I added something here but it didn't know about but pardon me hopefully this is worth it did we know who the winner is I'm not this isn't news to anybody is it I mean you read the papers hope so it's Gor still in it is there still a chance how long does this go on I'm not sure four years yeah here a 2000 election if it's fetching a whole bunch of things you are winner george w bush it it evaluated that custom business rule to add up electoral votes and decide who had the most and in fact so long as has done that remember i added a method called sorted campaigns we could take that table there instead of going through all the unsorted campaigns we could ask the election for the sorted campaigns and that that repetition would look that much better that's gonna be my list two sort of campaigns now we're not gonna have this howard phillips guy at the top anymore thank goodness there's a George Bush Al Gore and Nader and FEC Howard Phillips various various other people so I think I've shown some relatively interesting concepts here the idea that you can have Business Objects and that was a pretty trivial rule I was just sorting something and taking the first one but you could implement much more complicated business rules and you frequently do with web objects in your own application students are they eligible to graduate well we check have they paid their parking fines and have they returned all their library books but they pass all the tests is the supervisor still say they're okay you know you can implement that kind of logic when it's appropriate in these middle tier Business Objects and all this stuff is being done in a database independent way none of these objects are even aware which database they were coming from which means you can do one last moderately cool thing here let's remember I made I made this eel model here that said let's talk to the US elections database and let's fetch candidate objects and elections and so on let's take then we take that out of my model and we've got my firewire disk here bring a different eel model models you bring another yo model and put it back in the same place and we'll start this application again here oops well compile it and start again maybe I had to do that so I've dropped a different a totally different eel model in here totally different fetching from an entirely probably different database could it could be an entirely different database than the one that we're using here it could be but we don't know because we just put an object model in there and the object model has all the information about how to actually fetch things so once this thing gets going again here let's um this time fetch all the candidates oh wait a minute who are these guys Stockwell de Reform Party what is this different database oh my god tell me about that election oh wait wait wait wait hold your plus here comes your winter jean chretien oh he won all those seats and day when he went all those ones out west and the bloc québécois very popular out there and NDP seem to have some large chunk of northern Manitoba so this application is completely ignorant of what data source it's actually using it's all revolves around that yield model I told it to use a different database with it could have been a different schema and I could tell you was a different schema I wouldn't have to show you and you'd have to believe me but it was the same but it made the same kind of objects with the same relationships and the the complete separation of back-end and front-end of interface these these SVG map drawn objects at the front end these data bearing objects they're coming out of open base or or front base or Oracle or how many people added the IBM number and the Informix number together on that graph anyway it could be any one of those I mean one of those databases and you see the the separation of the backend in the front-end enables you to do some pretty interesting things here how many people are running what the heck happened in Nunavut on this map Canadians are going there's no none of it on the map the Americans are going to what who had no problem with one polygon can I go back to my slides please I want to finish up with a few more concepts here nobody said you had to use HTML I was using SVG here which is a form of XML that's sent to the to the client we have some pretty cool technologies that lets you build pure java applications including Java client I would certainly urge you to go and see the director Java client there's two director Java client sessions and the direct to web part me I'll go and check out the report mill and see how they're delivering PDF and sort of a similar way here talk to guys like me about how we did this XML thing and take a look at some of our assistance we have direct to web which takes an EO model like I just made and makes you a full-featured application that's pretty much done that you can tweak through this very interesting rules engine which you can learn about it the director web session director Java client the same sort of thing with a Java client interface and for deployment we've got a good session on deployment that tells you what the heck is going on here how do I keep all these arrows going what is the role of the web objects tasks daemon that runs on each of these machines to keep an eye on everything how does it communicate with the web objects adapter through the firewall what what are these messages that are going back and forth well we have a whole architecture and a tool called monitor that lets you describe how many applications you're running and where and it sort of lays everything out for you it starts them up it gives you a UI like this where it will start three copies on that machine and two on this machine and inform the whet the adapter on the web server about what's going on and generally it works pretty well alright it always works pretty well I'm sorry weird this stuff works great engineering has done a heroic job and a migrating this stuff to Javan the fact that it works at all considering where they came from this objective-c code base to where it is now it's nothing short of miraculous we have a number of how many people here go into all the web objects sessions that people here for the whole track well that's great you're gonna love all of these these are all great these are all great and what is the deal with web objects four or five one well Mac os10 objective-c only you don't want this unless you already have a web objects project that you want to bring to a Mac OS 10 machine if you're starting something new you want you definitely want web objects five you do want web objects four or five one if you're going to bring a product to if you're already using four or five on one of the other platforms as well you can that along the only thing that's really missing is support for Java on Mac OS 10 with this product we still support Java and objective-c both on Windows NT and ones 2000 and Solaris and hp-ux just like before but this is it we swear this is the last time we're doing an objective-c release with web objects we're no more fooling around here we're not gonna so if you're starting something new I really urge you to look at web objects fly because 4-5-1 is for people migrating existing projects along moving 4 or 5 to 5 pretty easy if you've got a project we've got a whole session on that the api's are pretty close learn more a couple of web objects training classes that you can use week-long class on development another week-long class on more development and another three day class on deployment the excellent excellent classes taught by our eye services technical training guys feel free to come and see us in the lab in room K and the other building which is on the ground floor play with all this stuff I'm gonna try to have my demo running on the machine I'll try to have that set up if anyone wants to see what the deal with that SVG mapping thing was and why Nunavut was missing maybe we could help me help me put it back in there and there's lots more sessions they asked us to put up the most relevant sessions on these slides I couldn't really think what they were because they're all good from this point on I have the advantage in doing the technical overview that that all this great stuff is following behind me and I can refer you to virtually any session that's coming up on web objects who to contact Tony Bob I services guys a whole bunch of URLs you
