WWDC2001 Session 505
Transcript
Kind: captions Language: en okay welcome to the session on jbuilder five for Mac OS 10 so many of you've seen me before in one session or another my name's Blake stone chief scientist for Borland software corporation we've dumped the IMP rise moniker for good and we'll be spending a lot of time looking at a lot of detailed features in jbuilder you've probably seen some quick overview views you've seen a smattering of features but not a lot of explanation for what's behind them and no look really at what's new in jbuilder five especially since Jabil is really new to the Macintosh community as a whole at this point but I know there's some of you out there who are already table their users and they're just waiting so we'll showcase some of the tables or five new features as well why don't we have a look in fact at what we're gonna do with the tour of jbuilder five we're gonna try to walk through the major areas but it's a big deep product anybody who's used it knows that I'll try to give you a hint of what's there but if you don't see something you're interested in get ahold of us get on the newsgroup check out the CD we've handed out whatever it takes make sure that you find out the answer to your question and of course I'll be hovering around the conference for the next day or two as well we're going to cover some of the new features in jbuilder 5 and we're gonna look a little bit at writing Macintosh specific code in jbuilder because we keep talking about pure Java and how Jabil does pure Java and some people confuse that with being swing specific Java is Java you can has easily write cocoa applications in Java with a few caveats we'll talk about a little bit as you can right swing applications and so that's that's an interesting topic by itself we'll talk a little bit about the preview CD you got and how to get that up and running to the best of its ability especially getting a hold of the update that you're required to the VM from Apple to really make it sing and then we'll have a Q&A session so Jay both are the basics that we're gonna walk through you'll see everything of course uses the Aqua look and feel this is courtesy more of Apple's work than anything we've done we've tried to make sure that we use swing purely for all of our user interface and so the Aqua look and does a great job of translating our appearance into a really nice Macintosh user experience there are some specific things we've done and maybe we'll have a chance to highlight a couple of those along the way where we felt what we were doing wasn't quite mac-like enough and so we actually do have some behavior that differs on the Mac from other platforms but solely to try to give you a more comfortable user experience jbuilder focuses very much on allowing you to keep directly in touch with your source code it differs from some of the other major tools out there in that not only do we get you direct access to your source code you spend a lot of time in the editor or manipulating code but we store your source code and just standard files there's no binary repository anywhere that hides your code from you so you can very easily use jbuilder in conjunction with other tools that expect you to have direct access to your code we're going to talk a little bit about the performance of the editor because that's something that I think is an interesting topic for Java developers everybody was told from day one Java is slow Java is slow you hear it often enough and you begin to believe it but the actual fact is that Java code is amazingly quick hot spot is a startling technology and can do a lot of things in a dynamic compiler that you can't even do in a static compiler so we bring a lot of performance out of it and you'll see a lot of that in the editor the editor does some interesting structural analysis that if you were at the Java developer tools session we talked about a little bit and of course we added something to the editor to make it comfortable for you we added key bindings that mirror the TextEdit project builder sort of the standard classical apple key bindings as well as the BBEdit slash code warrior key bindings that you may be accustomed to so you don't have to retrain your fingers for a whole new set of keystrokes we're also going to talk a little bit about navigation through your source code code insight and Javadoc and how they increase your productivity right from day one and and this is gonna be kind of an ongoing theme that's increased productivity how do we make you more productive each and every day in the product rather than how do we provide some things that look good in a demo and may help you learn on the first few days but then you grow beyond them no no no these are tools that you will use again and again again as you continue to develop Java code we're gonna go from there into a little bit more about the project orientation of jbuilder the fact that the project structure isn't something you need to spend a lot of time fiddling with and jbuilder there are a lot of other products where you need to add every single source file well we deal with projects of thousands of source files and so if adding and removing them from your project is a major maintenance nightmare that's something we need to get rid of and in fact we've done some very interesting work on that area we've got a very fast compiler you'll see that every single demo I do of course the compiler will kick in with very clever dependency checking we'll talk a little bit about that and a very powerful archive builder so if your project construction process involves producing a jar for someone we can help you out there too so let's have a look at those very basic characteristics of jbuilder if we can flip to the system in front of me here we'll go ahead and bring jbuilder up see how well the optical mouse tracks on this lovely surface and jbuilder is is structured so that you can see a number of things at once and all might well introduce them before we get a little bit deeper the project view in the upper left-hand corner here is where you see the structure of your project the packages that comprise your project your source files the lower left is where you see structural information and the center is where you see the content view where we can open any number of files concurrently so I've got in this case welcome app and welcome frame open which we can flip back and forth between along the bottom of the content view we have a number of different viewers for that particular content and we'll see some of those a little bit later but just so you know what's where and why I'm doing the things I'm doing we focus on the editor a lot of the time so the editor had better be fast it had better just keep up with my typing as fast as I can type it had better scroll quickly through my code so I'm not waiting for it a lot and that's not all that impressive until you realize that every single line of code and jbuilder is written in Java so your applications can look this fast have this kind of response in performance so if you were concerned about Java from that standpoint please don't be also we do a lot of structural analysis on the code so as I type slash and I'm about to hit a star you notice that we can immediately note that all of that is a comment there is no structure we've colored it green and just as quickly it comes back so very very quick analysis and we talked about this a little bit in another session but just in case you weren't there and out of interest how many people here weren't at the developer tools session for Java earlier today okay a number of you out there so if you were please forgive me we'll try not to dwell a lot on things that we talked about there but this structure over here shows me the structure of the class I'm working with and so if I declare a new integer it shows up in that in that structural view we can actually control how quickly these things are updated and we've got it set about as fast as it'll go so as I continue to type you can see that on the fly in real time we're able to discover that this variable name is changing over here so that that gives us the ability really to give you constant head heads-up about the state of your file because not only can we show you the the class and its members and give you a quick navigational interface we can also also show you if you make a mistake like omitting a closed brace here that there are structural errors in your code immediately so that you know what's going on you can find out that there is no catch associated with this try because we never close the try block and just that fast we can corrected without ever going through a compile cycle so that's a really important piece of getting you performance in the environment by the way as far as the editor goes again for those of you who weren't here it's very fully featured so I can do things like block indent and uh Nintendo problem comment out a set of lines a whole bunch of very helpful keystrokes and a bunch of quick mechanisms for typing common structures like if I want to put an if block in place I can put in an if/else block and expand that template with just a couple of keystrokes all of these things are customizable for your preferred key bindings so I can easily go in and say I'd like to customize a key binding and change the keystrokes or even just go in and use one of the prefab ones like my Macintosh or Macintosh code where your key bindings so that gets us started but all that is is a fancy text editor with a few navigational aids more than that we understand a lot about the structure of what you're doing with Java code that's where code insight kicks in code inside is our technology that allows us as you type code to be able to prompt you with a little bits of help for example if I type enable events and open brace we see from structural analysis that that method requires one parameter of type long the parameter being called events to enable so I don't need to look that up in documentation it's right there at my fingertips so if I go a little further and type a w/t event dot we also notice in this case hey these are the members that are available in this case a lot of constants that I could pass here and we can just pick one of those or if you just know with what it is but you don't want to type a lot of it I can type a piece of the name and then ask it to expand the rest and because there's a unique expansion it just goes ahead and does it for me without prompting so these are again extreme productivity aids but they kick in a lot of other ways as well what I'm doing here is a Productivity aid is is having it analyze the code and give me helpful information about what I might want to type on the other hand if what I want to do is go and look at that code we have navigational aids to get places quickly so the enable events method that I'm calling well I can easily say go and browse that symbol and what it will do is it'll figure out what class that method is in and go and find the source code for the method so I can get to the method that I'm calling work with it and with a keystroke or using the browser like interface here with the home and arrow icons be able to get back to where I went from very very quickly similarly we can use that same structural analysis that if I'm on this available enable events method I can just hit f1 and will go and look up Javadoc on that particular method find the piece of Java doc and show the detail Java doc on the particular method so we can see the rest of the methods in the class everything's available it's sort of at our fingertips here so that gets us a really productive environment for day-to-day coding but again there are a lot of other tools here and the project orientation is one those tools if we're working with a large project with a lot of files we don't want to have to worry about how do I get all of the appropriate files in my project instead all you need to tell us for a project is where the source is located I'm gonna go and create a new project and I'm going to accept all the defaults here for an untitled project but I'm going to tell it that I already have source code for this project in another location specifically I'm gonna go look at the samples we provide and pick up the chest sample source so if I go ahead and build this project immediately my project pane shows me that these are the packages I have their sub packages and all of the source files I don't need to define this by hand and in fact if I were to go and check code out of a repository into that directory I can easily refresh and get the up-to-date information or next time I open the project it would just be there without my having to ask for so very powerful tool now all I need to do to build this project is request to compile and the compiler kicks in it's interesting we're not getting a whole bunch of build progress reported of course I am working with an interim build of the Java VM here so heaven knows what we'll run into the usual demo gremlins but as you saw there it didn't take very long it's hard to believe it did anything at all but in fact it just produced class files for every single source in here and as you saw a moment ago there's a number of packages and sub packages and everything was compiled subsequent compiles are amazingly quick as well if I go into a particular file and we'll just mark it dirty by you know making a change to it and then go ahead and say recompile this project then it notices very quickly there's only one file that needs to be recompiled but it's not like your typical system where if I'd made a change in the API that somebody else required it would just be broken no no if I make a change that somebody else is going to call then it notices that not only does this file need to be compiled but turns out that's API nobody else uses wouldn't you know it I don't know this particular demo real well I love just sort of flying by the seat of my pants it finds that in fact there's a reference to that method somewhere else and it tried to recompile all the files that required that piece of API so it's a very frightening lis complicated system but in fact one that just takes care of all the grunge work for you I work on a project that has thousands and thousands of source files jbuilder and I use J builder as my IDE and I can compile changes in a matter of seconds to this enormous project and it follows all of the dependencies for me and takes care of all the details so that's pretty amazing from my perspective I'm not going to save my changes the next thing that I mentioned is that once I'm done building a project and I've got a bunch of files I probably want to deliver that to someone and so archive building and is an important part of the compiler the build process so what we've got is a technology called the archive wizard all I do is go into the archive builder wizard here and say I'd like to build an application from this I can set all sorts of options or accept defaults I can come in at any later time to any of the jars that I'm trying to build and edit their characteristics in this case I'd like to specify a particular class as the main class for this application and if I remember correctly we'll go ahead and pick the server side of this particular chess op and now when I go to recompile it's going to recompile my files did I actually save that accidentally that would be bad we'll go ahead and look for it yeah accidentally did one of the things I'm using here by the way I'm just typing in a tree and it brings up a little search mechanism that allows me to search the tree it's kind of interesting because I can search based on wildcards and find all of the things that start with GE or say I'd like to find the things that have PL somewhere in them and then move among those that Trin's have to be only one so let's go ahead and change this back apologies on that so now it goes ahead and compiles and creates the archive so it's built a jar for me that contains all of my classes that contains the manifest entries and I can verify that by actually opening the jar in the product and having a look at its contents including the manifest file so really quick way of going ahead and and dealing with projects building output it's not something you would expect from Java but having built this over time we've gained really a new appreciation for just how fast Java can be if I can get back to my slides please so I promised we would go through this at a fairly blistering pace please excuse me I normally like interactive sessions but there's just far too many people further back to make that really practical here so we'll take Q&A at the end visual design is a big piece of the jbuilder environment because Java beans are a big piece of the set of Java specifications they're a very early player in the in the numerous Chaves backs that are out there now but they're an important part of how we take a class-based language because Java really understands classes and members of the lowest level but doesn't have any component based architecture at the language level and layers on top of that a component architecture that understands properties and events so jbuilder understands the java beans architecture and provides a very sophisticated designer so you can take java beans from anywhere java beans from sun like AWT and swing although I'd argue about swing being acceptable java beans occasionally java beans from Borland and we provide a set of data access technologies and data express that really are layered over top of JDBC DB swing which are data where swing components and Internet beans which allow you to produce dynamic HTML using a set of beans or third-party components because Java beans is and we can drop any beam into the IDE and we'll look at how easy that kind of thing is to do all of this is done using Borland's patented two-way tool technology and two-way tools are what allow us to do visual manipulation of a file and then go back and modify the source code and see those changes reflected dynamically in the graphical environment so that you can seamlessly move back and forth there's no code generated that you aren't allowed to touch it's your code so let's have a look at that again back to the demo machine please they're gonna get sick of my saying that they know they should switch back to the demo machine but so if we go into just a very simple application here this this Welcome app and I go ahead and open the Welcome frame in the designer what's going on now is we're having a look at the source code and figuring out what it looks like and it looks like a very very empty frame so that's fine I can start with this as a starting point and say I'd like this frame to use an XY layout which is sort of an absolute positioning technology I'd like to put a button and a text field on it and perhaps I'd like to put a scrolling area and a tree as well and everything I'm doing here is generating source code if you look at the this.jb init method this is sort of my static construction of this this environment but I can do again this manipulation of code or manipulation visually either way it's up to me so if I don't like the text on that button I want the text on that button to say add and again if you weren't there I did a rather perverse little demonstration a moment ago in in one of the other sessions I actually put an expression in here well let's be even more obnoxious about this and let's go between J button one and set text and add a comment so we've got here a piece of legal Java code that has changed the label on this button to add item and if we put back to the designer the designer parses through that and says the button has the text add item in it nice stuff goes a step further let's say I change that text to remove item well it's got an expression in the comment and a bunch of other sort of nasty stuff in there so if I make that change and go back to my source code what happens well we leave everything in your code the way it was and make a surgical change to replace only the expression that used to be there with the new value of the Eve typed in so again it's your source code we just help you with it so what I've got here is I've got a fairly basic and relatively unattractive layout but if you'll excuse me I'll just sort of juggle that a little bit here one of the important things about Java or layout managers there are some slick technologies in interface builder for helping you position things but you're still positioning and using absolute positioning what happens when I then translate my application into another language and the text on a button gets longer well do you need to come up with another set of absolute positions for that or what if I change my font size then everything needs to be arranged differently and that's sort of difficult to deal with well Java uses layout managers to cope with this but layout managers can be tough to understand there's one called grid bag layout that's the most powerful perhaps and it would allow me to do a lot of very sophisticated manipulation of this but I would need to know all about grid bag constraints so instead what we can do is we can use J builder to help me out here so I'm gonna lay things out the way I want them and then go back and say I don't want to use XY layout what I want to do is use grid bag layout and behind the scenes what we've done is translate all of my calls with absolute positioning into grid bag constraints some of you have obviously done some grid bag work before so we can we can literally go through and resize this and you'll see that we have inferred some rather reasonable resizing behaviors for this so the designer is a pretty cool piece of technology even if you think about it in terms of standard components but what if we want to write our own components has anybody here tried to add a component to interface builders palette be one or two you know the rest of you haven't tried it because you knew it was easy right I'm sorry to pick on it but really it's an early component model where the important thing was being able to provide reusable components and for us we decided that it was important to be able to create reusable components so I'm going to create one right now yes thank you so what I'm going to do is create a new class and this particular class I'm going to call my button and it's going to descend from Java X swing J button so it's just a button at this point and we go ahead and and generate some code we have a look at it to see what if you need to do anything in particular and all I'm going to do in my button is go ahead and say by default I'm going to set the background on the button to the color green and if there are any people here who worked on on the Aqua looking field they may be cringing at this moment is this a good bill to do this in and we'll find out so what I've done is I've created a new button here and of course we actually need to import java.awt to get access to teller constants so I've got a new a new button here what if I go into my code and I want to use one of those well for one thing grid bag is not the friendliest place to manipulate things so I'm gonna go ahead although we do provide you a lot of hints about what the various in sets are and so forth and you can visually manipulate them that's kind of nice but I'm going to flip back to X Y layout so I can go ahead and use absolute positioning and bring my new being in how hard is it well you could add it to the palette using a couple of steps but you could also just say I'd like to use the any bean tool and just go up and find it and so in this case I have this comm Borland we're still in samples right welcome my button so I can go and pick up a new button that I've created and drop it in place green background setting was not a good choice I take it let's go ahead and set the foreground color instead so let's change this to set foreground I don't need to spell the whole thing codeinsight will give me a hand there go ahead and compile that and come back to welcome frame now you notice a couple of interesting things one I changed the class on the fly and we picked up the new version of the class and injected into your existing code here so you can do iterative development - you don't need to shut down and restart or anything like that we'll just pick up new versions of the bean as fast as you can throw them at us but second you'll notice that we have a new bean dropped in just like that now let's go one step further I could go zillions of steps further but this is a limited session of course I'm going to do a get foo method and a public void set foo method and I'm going to be really obnoxious and not do anything with the value perhaps get food will always return sorry and go ahead and compile this pull it back to two my welcome frame and are we seeing just paint issues and what we'll see is that the foo showed up in our inspector automatically no work on my behalf it noticed that is this string and gives you a string type editor for that's javabeans and the visual designer there's some incredibly slick stuff that you can do here I could get into database components what have you if we have enough time we'll come back and we'll look at some of those things but if we can return to the slides we'll move on from visual design Java server pages and servlets this is a big deal for a lot of people looking at Java for for server-side development it's a technology that's blessed by sun is the standard way of doing dynamic content because of course in the web static HTML is yesterday that's not interesting anymore what we want is content that's generated on the fly and jbuilder provides some very interesting support for dynamic web content through Java server pages and servlets one of the things of course is that with jsps what you have is a mix of HTML and java now we wouldn't recommend that you embed a lot of Java in your HTML typically what you're going to embed are references to significant other technology that you you maintain elsewhere so that you don't have your presentation and your behavior too intermixed but it still gives you the flexibility of choosing on a variety of of interesting ways what content to call in dynamically into your static HTML it's just that we need a way to edit this stuff although we need to be able to run it so you could take that JSP page and set up a server and get the server running and open your web browser and view it but it'd be nice if we did something there so we'll show you that and of course all the way through to actually viewing it in an HTML viewer jbuilder integrates this whole process and we'll see how there are a bunch of new things in jbuilder 5 that if you're familiar with servlets and jsps might be of interest to you support for multiple servlet contexts is one of them before we supported this single servlet context and that was sort of annoying if you needed to integrate several different servlets which had references to quote absolute positions within their context that conflicted with one another and to integrate those into one project things got confusing so now we allow you to separate those into two separate servlet contexts that have their own root level for the set of HTML references it's also interesting to generate war files now why before JSP and servlets were individual files that you sort of managed on your own now there's a new standard for web archives Wars that you want to be able to deploy a whole set of functionality in one go and jbuilder will build your war for you also vaguely related but you know didn't want to slide into on its own web start bundling did anybody here see the web start demo and the java intro a couple of people here so Web Start is a neat way of delivering your application all you need to do is bundle it up with a web page with a bunch of things and a bunch of XML and well wouldn't it be nice if you didn't have to do that somebody else did it for you and that's what J Builders here for we're also gonna talk a little bit about Java debugging I didn't want to do too many flips back and forth between the slides so we'll have a look at this a little bit because if there's anything you spend perhaps as much time in as your source code editor it's probably your debugger I'll admit it I don't write bug-free code the first pass but by the time I'm done with it it's in great shape because we provide you a lot of really powerful tools so we'll talk a little bit about the Java debugger that's an integrated debugger and the IDE and a couple of the things that it does that are really noteworthy not only can you browse through objects and so forth but we provide full expression evaluation that means not only can I see the value of a variable I can call a method on an object and see the return of that or I can even modify it by calling a setter or something so it's a very sophisticated debugger from that perspective and it provides you the ability to edit absolutely any data type a lot of people will say yeah we can modify data in ours but they usually mean we can modify primitives integers and characters and if you're really lucky maybe strings but in practice we can actually edit just about any data type which is pretty neat it also has extremely flexible breakpoints everybody's used to seeing the click on a line and get a breakpoint but we provide line breakpoints class breakpoints that's kind of interesting I want to know anytime anybody calls any method in a given class and you can use wildcards for the name of the class so you could say any class with the letter E or something equally sewing but there are times anything in this package for example field access and field modification if the underlined vn supports it we allow you to provide break points on modification and access to fields which is pretty slick stuff that's the similar in some ways to database break points in traditional CE debugger except that we're able to say for any member or for any instance of this class whenever this field is touched so you don't need to try to track down where all those things are and we can also provide break points on exceptions so you want to know of course I've got an exception handler for my IO exception but I want to stop if an IO exception is actually thrown and we can do that with our debugger also of course once the debug debugger has a breakpoint defined you want to be able to refine it further provide an expression that gets evaluated or provide a number of times through that it needs to go before it will actually break or even provide an expression that gets logged and not have it stopped at all these are all features of the debugger that we have so let's see both of these things we'll go through some of the web technology and we'll go through a little bit of the debugging technology so I'm gonna start a brand new project to look at some of the web stuff and within this project I'm going to create just an empty JSP nothing particularly fascinating here but actually yeah let's go ahead and do that so where's my project and you'll see that and actually let's add that to my project as well it's probably something I should have done by the way a lot of you may have seen this this this file browser that comes up and it's not the standard file browser why we do some interesting things with it in Java you need to be able to drill into some file types that you might not normally look into for example if I've got a jar it would be sort of nice to be able to see the directories in the jar the files in those individual directories inside the jar and be able to open those files we provide you that kind of depths so there's a lot of extra functionality tacked in here but that's not what I was about to show excuse me for getting sidetracked I'm easily excited by my own product here so we'll go ahead with this this food JSP and with this JSP of course what we can do is is write HTML so I'm going to write just some some basic HTML here you'll notice that the structure pane gives you the same ability to jump to tags as it gave within within Java source so my body is not going to be especially interesting but how about the random number for the day is and we'll go ahead and spit out the random number for the day you'll see that these special tags are colored differently why because they're an indication of something very interesting we've now switched from HTML mode where we're syntax highlighting in HTML the Java mode where we'll start recognizing Java keywords things like if that's pretty cool but it's even cooler when you start doing something like out dot and it recognizes that I'm embedded in a JSP and out has a meaning within a JSP it's a variable of a particular type and codeinsight kicks in and shows you these are the various methods that you can use here so our coding tools work and even in this hybrid environment which is extremely powerful and I could go ahead and print something in here what have you what I'm gonna do is just go to a prefab project just to save time where I have a more sophisticated example this calendar JSP goes through and uses embedded Java as you can see mix of Java and HTML to create a calendar for the current month with the current day selected all I need to do to run that is just go ahead and say web run and what we'll do is notice hey you're trying to run a JSP let's make sure that that's legal first so we'll pre compile it so that you can fix any errors within the IDE then we'll go ahead and start Tomcat why is that interesting because Tomcat is the JSP engine for Apache which of course is your web server courtesy Mac os10 server so we're testing using the same underlying JSP engine that you'll be using on the server-side we then feed at the JSP take the results of processing the JSP and show it and our integrated HTML viewer so you've got the complete experience and to end pretty cool stuff along the way and we'll just shut that browser down and you can of course see the actual source that was emitted if you want to have a look at exactly what was emitted etc we created this this web app and a web app is the this servlet context a web application defines the context it also defines a deployment descriptor which we provide a graphical editor for so that if you want to build a web archive you can do so just by going ahead and building this particular web app and we'll build the deewaar file for you and do all the packaging that's required in the war file to include the actual executable code the the JSP itself etc etc so a lot of technology bundled together I also mentioned that we can do Web Start bundling for you and if you want to take an application and deploy it to web start this is pretty powerful stuff so I've got an application this welcome app that we built earlier and I'm gonna use the archive builder to go ahead and bundle that up as an application for me and build the jar now I want to go ahead and turn that into a Web Start application how tough is that well we go to the web tab and say I want a Web Start launcher I want to call this my welcome demo it's going to use the default web app that's fine the jar file is the Welcome jar that I just generated that of course is the directory this is the file jar files are a little weird that way they're a little bit of both and I want it to yes to go ahead and create that homepage for me I want to give it some meaningful information about the title to vendor the description which can help the user understand what application it is they're installing and finish and what it's done is it's built the HTML for welcome demo for the web start application so if your user were to go to this page what they would get is this message that says hey you don't have Web Start installed it's a plug-in for your browser that allows you to automatic we download Java applications and you need to install it like any other plugin this page automatically detects that the plugin isn't installed gives you the information about where to go to get the plugin unfortunately apple hasn't finished the plug-in just yet so it'll be up there as soon as the web start project is finished and your users would be able to get at it but it's also built the other piece that's necessary the jnlp file which is an XML file that contains the information about my application and its structure so it's done all the work necessary to go ahead and build a web star table application which is pretty cool stuff so hang on to your seatbelts well we'll keep going here at this pace and we'll jump right on into the debugging side of things just quick pulse are we going way too fast or is this about right good okay we'll keep moving so let's let's launch into the debugging stop I'm gonna go and open another project that I have lying around in my home that has a couple of really simple things that we can examine and manipulate for for debugging purposes I didn't cook up anything that had any bugs I'm sorry but if want to see the debugger at work you just need to know that you have certain facilities that you've been used to all along so what we'll do is we'll just place the the typical line breakpoints in this and get it started launch the debugger the debugger who needs to know the main class which apparently I never bothered to define for my project and it brings up a user interface at the bottom of the screen that gives me my full debugging power while still having access to everything else in my environment I can still switch between multiple projects I can compile things I can i can edit code I can do everything I want and there's a debugger down there and you'll note the debugger has a tab at the bottom of the screen why because you can have multiple debuggers open concurrently so if you're working on a client-server application you can be debugging the client and the server simultaneously each one has a full debugger user interface just you know a little tidbit so let's go ahead and and resize this a little bit so I've got a touch more space to look at things in the debugger I'm gonna go and see the the current point where I'm stopped and what you see here is our standard thread view which is showing you thread groups the system thread group contains the main thread groups which contains the main thread which is the one that's hit the breakpoint hence the little red dot with the the call stack that main has called foo it also shows within that scope what's visible is the this reference which we can drill into and as I start executing some code and we'll step a couple of times we'll also see as other things come into scope they just appear and we have this ability to to view things in a variety of ways in this particular case we can drill into an object and see that objects class and we can see that objects parent that classes parent class and we can see members belonging to that particular class for an array we can see the elements of the array and if you have an array with tens of thousands of elements you can do things like say I only want to see element number 9999 hundred to ninety nine hundred and sixty and view a subset of the array lots of little functionality in there more not enough time to go through it all but this allows you a very sophisticated way of looking at information because I can drill into the array elements and see that they're really strings these strings have characteristics the strings contain arrays so we have this this full hierarchy of information we can look at and modify so I've got this variable four that's been declared and by the way did you see when I put my cursor over a tooltip or over a variable what happens is we get something that tries to examine what's under the cursor and display the current value so you don't need to fiddle around with trying to find it if it's visible anywhere in your editor you can just hover over it and we'll show you the same information but we can go in and we can say you know I'd like to change this value we set four to four will set it to 44 just to be difficult and now we've modified a primitive but that's a primitive that's not very interesting what about an object like say a string well wouldn't it be nice if we could just take this string and copy and paste it into another string variable it's pretty cool stuff it means that I now have full control over any data type in my environment I can actually go in and I can cut objects let's see okay you don't have the key bindings I'm used to so I can cut this object and I wind up with a null value but I could also go through and change this value by selecting change value and I am asked to enter an expression of type string by which I do not mean just a collection of characters if I wanted the collection of characters sure I could go ahead and type that in I mean if I want to change this I can now create a string by doing something like say oh this dot getclass dot get a name and we'll get the name of the current class and set that debug demo debugger so pretty slick stuff a very very very powerful debugging environment we won't go through all of the features but just sort of as a quick glimpse we have the ability to set watches on individual items so if I want to watch this particular object I can create an object watch call it buddy and it will show up on the list of watches I can see all of the classes that are loaded so if I want to see static variables I could drill in and say that Java IO buffered stream has a default buffer size so I can go and examine static information see the set of breakpoints that are currently set add various types of breakpoints go in and look at the breakpoints we already have and say you know I'd like to log a message instead of stopping or I'd like to provide a condition or a pass count so again a lot of flexibility on that and get a list of all of the classes for which I'm not interested in stepping into them have you ever before done the the step into and then realized oh no I've stepped into somebody else's library and I'm debugging their code but step-over is no good either because you've got this huge expression that calls a few of people's other methods and then calls one of yours well here you can block particular packages or particular classes from being traced into and we block all the Java ones by default or you can trace into them it's your choice so pretty powerful stuff and lastly there's one tab at the top here you see this little screen icon that if I step over something that sends output will go green to indicate that there is output waiting for me console Y Oh from my application and actually you can type in to this as well and it provides a full console i/o so if you're not doing a graphical application you again have everything you need to work on your server-side app or your console based application directly within the environment without having to turn elsewhere so hopefully that's enough of the debugging stuff and we'll turn back to the slides XML somebody managed to miss the XML revolution it seems that that this is taken over all of us are now to do everything in XML according to some magazines we should stop programming in Java and program in XML other magazines would would tell us that in fact XML will simply solve all our problems and in reality those of us who've worked with it a little bit just enough to get the feel for it understand that what XML is is it's a very powerful tool for solving a very small part of every problem so if every single problem is going to be solved this way then I better have some tools to work with XML because it's not going to solve things for me I better have some basic understanding of what it is capable of and my tools that better let me work with it and that's what jbuilder does is it provides XML support not in terms of being an XML IDE but providing the kinds of things that a Java developers likely to be interested in because you're going to interact with XML a little bit everybody is so XML support provides us some basic navigation and editing facilities validation facilities DTD generation and transformation XML by itself is neat in a way but XSL which allows me to provide a style sheet for transforming one piece of XML into another piece of XML is much cooler still so we'll show you what we've been working on what's new and tables are five in terms of XML I'm going to go in and open a sample project actually comes with the product we provide zillions of little samples to help you get started ah yes I'm sorry let me just make sure that yes there's a demo that was your cue I'm sorry if I drill down into a an existing project here that's designed to showcase some of the XML functionality we'll see that what we have in here is a DTD in a couple of XSL files we can look at the DTD it's exciting if you are into that sort of thing we can look at the XSL files and you'll see that we do syntax highlighting for them we recommend recognize the file type and we provide syntax highlighting we provide basic navigation facilities so that's pretty cool it gives you something but a DTD is interesting partially because it describes what a valid XML file looks like so one of the things we should be able to do is take DTD and say you know I'd like to generate an XML file that complies with this that uses the XML employees as the root element and I'm gonna go ahead and specify that we're gonna use the system DTD here for for this newly generated file and it goes ahead and says you know I parse that DTD for you here's a valid chunk of XML now this isn't something that you would necessarily do at a production system but it's kind of critical for you coming to grips with some piece of DTD somebody's handed you and starting to toy with it and get to understand it that you can quickly get some XML that's valid and we're gonna drop a little bit of information in here perhaps Blake stone Department number Borland and so we've got some some XML here and again we have the same sort of structural view here that we can parse through and find any of this information it would be kind of nice if I could come back and validate this particular XML and sure enough we can say validate this and we'll figure out what DTD it's involved with and apparently I I've specified the wrong path to get to it so it is invalid but let me validate that again and it is valid now if I make a mistake in it first thing you'll notice is our little error insight kicks in and says hey you know this doesn't even balance so you don't need to go all the way to validation to find out that this isn't even legal XML will find that for you on the fly but once you get to the point where this is legal XML and you want to know whether it really complies with the DTD that's a little bit more like the compile pass and will do the validation tell you where the error is and then you can go through and actually correct it so that gets you some of the sort of mechanics of working with XML but transformation is what's really important you get your raw data this way and if you wanted to present it to somebody you need to transform it into something other than raw XML typical thing to do is to transform it into HTML so if we go to the transform view we provide you the ability to pick any style sheet and it's just telling me it couldn't find a style sheet for that particular one because I didn't declare it and I'll pick the well we'll bring in the list view and the table view and then I can pick one of those the list view or the table view and it shows me the output of this now the output in this case isn't necessarily exciting because it's it's going through another stylesheet which I'll talk about in a second but if we turn that off then you begin to see where the power of XML comes in is this ability to take this raw data transform it and show it to somebody in another fashion so now if I go into my raw data that's actually here isn't it and say I'd like to change this by declaring another employee perhaps a Steve Jobs and go back to my transformation view and refresh that then we'll go and apply that same transformation and get this dynamic data thing going so this is a set of tools that doesn't solve your problem because XML doesn't solve your problem it's a set of tools to help you get familiar with XML to help you start learning what XML is capable of and to take advantage of some of the XML libraries that we provide because we provide the the Xerces parser and so forth and we provide the libraries that define those as part of your environment so that's hopefully an exciting first look at what we're doing with XML so if we can get back to the slides here that's all well and good you know we can do pure Java development we can do a bunch of cool stuff with Java beans but if you're a Macintosh user you know there's nothing quite like your native environment and you've seen hints of some of the facilities that are available if you went to Steve Llewellyn's talked on wrapping cocoa api's in Java beans very cool stuff the speech synthesis and recognition and spell-checking neatly wrapped up so that you can just use them in an environment like jbuilder and that's a hint that yes you can get direct access to cocoa stuff from within jbuilder so you could just drop those beans in and take advantage of it but in fact you could go a little bit further than that you could go through and start writing cocoa applications in a pure sense so we'll look at that but we'll also talk a little bit about how jbuilder helps you with new classes in general because apple provides you with a bunch of classes that may not be familiar if you're an mrj user you may know some of them already if you waited around a little while there's going to be a bunch more and what's important about jbuilder is that it dynamically adapts to any new class you can throw at it so all of our coding tools code insight technology our class browsers and so on and so forth we'll learn about new classes that you throw at it and give you those same kinds of help so we'll look at that a little bit as well but when it comes right down to it you're going to be left with a choice you know you can use these tools to do pure Java in a cross-platform sense or write pure Java code that really rings every last ounce of performance and flexibility out of the Macintosh platform we don't make that choice the choice is up to you so let's have a little bit of a look at what we can do in this area now you may have noticed I don't really believe in script here kind of like winging things an awful lot more so this is is sort of a first crack at some of this stuff and I'm still waiting for answers from a couple of Apple engineers because I started thinking about this on Monday but it's really interesting to see that I can sit down and write an application and take advantage of the right way to do a cocoa interface which it's not Java beans so of course that means interface builder and all the power of J builder and meld them together so we're gonna use J builder and we're gonna use interface builder and we're gonna tie the two together into a brand new project so if I create a new project and within this project I'm going to create a new class that's my main class and let's give this a slightly better package name so I'll put this in the cocoa demo package and we'll call this cocoa demo perhaps generate a main method and keep my fingers crossed that I actually remembered what I was doing and brought along my cocoa mein mm-hmm please excuse me okay not entirely scripted but I didn't want to torture you by going through this what this is is it's the stuff necessary to go and find a file and open it up and I'm gonna go with cocoa demo dot nib but of course we could deliver this template with jbuilder we haven't actually finished jbuilder five for mac OS ten we haven't signed it off so maybe I'll sneak that in at the very last minute and what this does some people would like that is it it gives you the the framework necessary to call the this nib in and get things started and running as a cocoa application now if I was really starting from scratch on this and I had no real idea of how to get to some of these classes why so long as you tell jbuilder about the path and so I'm going to add the set of cocoa classes to the path jbuilder can find out dynamically for you about things like oh I'm gonna need to import some of the right things c-calm Apple cocoa Foundation so you can see it helping me already and finding the correct import names because I don't remember them offhand and application so that if I go and ask you know what are the methods for NS bundle it'll show me the bundle for class and bundle with path methods it will show me that for bundle with path what I need to do is pass it a string so all of these kinds of things are a lot easier to find and it's not because jbuilder knew about them ahead of time it's because I added those classes to my class path table Durr found them and did the right thing with them on the fly it can do an awful lot more if it can find the sources in terms of parameter names and so forth but even just the raw class files give us an immediate start so now we have this particular application it's not all that exciting because there is no cocoa nib well let's go ahead and get interface builder involved in this so what I'm doing of course is assuming thank you the developer applications are installed on this machine this is a Developers Conference after all I know bring interface builder up and we'll go and open an example nib file and have a look at the way it's structured what's been set up in it already so if I go and open from what quick question because I've been in an Apple advocate for a long time but I've got to admit I was out of it for a while does everybody intuitively recognize this as the option or Alt key or is it just me you know is this that been a standard long enough sorry that just it gets to me so I'm gonna go ahead and open this this cocoa demo dot nib file that I have and we'll have a look at it this should be really familiar everybody built this application at least once an objective-c and if you've gone through the the Java tutorial for how to build this stuff with project builder you've also seen the same one what we have here are the Fahrenheit and Celsius fields that we can type into and if you look at them you'll see that sure enough when I hit enter they'll send an action that I've got a temperature controller and if we look at the temperature controller class which I have here called converter it has outlets for Celsius and Fahrenheit and an action convert and surprise surprise I've got all these things wired up so that you can get to the appropriate fields and the both fire convert methods when you hit the enter key so I've got everything I need in place all I need to do is is go ahead and save this and they've been my project actually and I created this here and then go ahead and generate the source code for cocoa demo got convertor so I'm going to go ahead and create files say I want to go ahead and generate that one into mice into my source oh that's gonna be bad isn't it I mistyped to the package name will go ahead and correct that and and see a few other table der features while we're at it you know this this is why I made this little comment about this is live I don't really script all the stuff to the nth degree because I believe I can probably fix this sort of thing on my feet so if we go into my JB project directory and look at source code m and change this to cocoa demo what I've done of course has changed the structure of my project and within J builder now if I just refresh it notices hey your your source has changed you've got a different package so we'll go ahead and change this to KOCO demo and get that right and we've also generated this converter and so the converter that's been generated for me by interface builder because interface builder understands Java Apple's right with the program here is it's generated this this stub here that has the appropriate object references that interface builder is going to go ahead and set when I instantiate this nib and it's got this convert method all I need to do is fill out the convert method well I hope you're not too entirely shocked that I have the converter pre-written as well so I'm just a little thing I don't know if this means anything to you it means a lot to me if I go ahead and take that same template and expand it elsewhere it pays attention to the indent level you know it's the little things that matter sometimes thank you and if you look at this converter it's not all that exciting it plays a sound just because it can and then checks to see who it is that sent it and converts the the temperature and and stores the result and the other one so I should have here an application that if I go ahead and run and specify my main class here and it's cocoa demo that we actually should get and let's go ahead and hide interface builder because it's going to confuse situation here we should have gotten the user interface let me just a very quickly scan through this and make sure that there's no surprises demo converter what's a J button B it's an import oh my main class is a button oh goodness that's evil thank you that's what I get for going through this quickly so let's recompile that and run it and so we get our temperature converter over here we can go into the temperature converter and type of value we get the the conversion and what we have here is a cocoa application very very cool stop I gotta fess up to something it's not a full-fledged Coco application by the time I get a few answers from a few more Apple engineers it will actually have an icon on the dock but that's what we're all here for right get answers to the the ponderable side here but let's go one step further we have a cocoa application let's go ahead and drop a breakpoint in our cocoa application and go and debug it from within jbuilder so we can compile this we get it started we'll get our UI over here and go ahead and type in a value if the if I go from the correct field I probably put the breakpoint in the other direction there he'll we'll hit that breakpoint from within jbuilder and then inside jbuilder I can start examining things and I can see let's put this in the correct place I can see for example that sender is an instance of NS text field and Celsius is an instance of NS text field and I could even go ahead and take advantage of what we like to call the world's largest tooltip and click on one of these and browse those directly in place and see what we can see from the Java side of the bridge perhaps not a whole bunch but it's sort of interesting to start examining the internals of cocoa directly from within a Java debugger so again cocoa from Java this is something that we're going to spend some time researching and make sure that it's an option that's available to you so if we can flip back to the slides jbuilder is a really interesting product from a lot of points of view I love that it's written in Java I love that it's actually the same object code not just the same source code but the same object code running on all these platforms I love that the first time we've got the debugger up and running we took it to Solaris and said what happens if we run it over here and the debugger worked on another platform the very first time we tried it this is really compelling and powerful stuff to me and as potential Java developers or as Java developers out in the audience it should be equally exciting from your perspective but I really like how dynamic Java is so when we had a chance to redesign jbuilder and really put everything in Java we took advantage of it and and really to the hilt went for dynamic discovery of features it's what we call the J builder open tools architecture it means that J builder when you launch it learns about the things that it can do from scratch every time you may have worked with other people's plug-in architectures before and you may have seen that what's typical of a plug-in architecture is that the plugins let you do some cool things but that there are a lot of things that they did that you can't take through the plug-in architecture well J builder is written with its own open tools architecture that means our designer is just a viewer plugged into our open tools architecture all of our editor key bindings are plugged in through the open tools architecture J builder itself consists of close to 300 open tools loosely clustered together in fact if you remove all of the open tools and the libraries they use there's one class and one interface that's it so it's a pretty powerful framework and it's one that we strongly encourage other people to plug things into so if you want to tailor the environment you can you can add new viewers file types editor behaviors dialogues and much much more to you know use the typical phrase but we mean it I mean this is powerful stuff we've seen third parties do very very cool things using the open tools architecture and if you look around you'll find that there are a number of of application server vendors and big companies who have products that they'd like a Java IDE for but instead of inventing one from scratch they can just tailor jbuilder and make it work for them what's especially cool about that is anybody who writes an open tool has to write it in Java and if it's written in Java it probably already works on Mac OS 10 so all of those open tools that have been written you can take advantage of them the day j-bolt or hits the street and in fact if you're brave you could probably take the copy if it's in your bag go home download a couple of those open tools and start using them today so that's really compelling stuff as I was in the prior session I realized I wasn't planning on making a USB device any time soon I just really wanted to be in the room and there was not that much point in my paying a lot of attention so I spent the last half of the session writing an open tool that sort of just occurred to me and let's have a look at what you can do in half a session when you're worried a little bit about battery life and everything else that goes along with that you can take an idea and almost get it all the way well if we can oh yes my apologies I keep not going to the clue slides I'm probably their their least favorite presenter by this point I'm gonna go to my home and have a look at a proper because one of the things that people will point to jbuilder and and say is that you know obviously it's a pure java environment they build jars they build Wars they build roarers they build I mean literally these things are all valid acronyms ears etc but what about a double clickable application and it just you know we're trying to get the first copy out to get things going as fast as possible and building a double clickable application was just too late in the cycle for us to put in the product but as an open tool it's a very different story so what I did is I sat down and looked at at the process of what it would take to build an open tool that gives you a double clickable application and just to give you kind of a quick sample this is all the code and just kind of what it does the initialize Open tool goes into our project view mechanism and registers a context action provider so that means that in our project view if we bring up a context menu on something we should be able to now have new functionality registered and it goes on to say this functionality should only show up if you have a single thing selected and that thing is a jar file and it should bring up something that says create a proper for this jar file and then go through the motions of creating the the basic structure and copying things into it and if I was if I had any of the documentation handy I would have actually used the standard mrj app builder but instead I just sort of rolled my own this allows me then theoretically to extend J builder well let's go ahead and compile it you'll notice the compile took a whole bunch of time and what it did was built this app wrapper jar file that contains the necessary class and a manifest file that tells J builder that yes this is an open tool if I were to go to some application in J builder without modifications such as my welcome application and bring up the context menu for a jar you'd see that it has a variety of options but it doesn't have anything for an app wrapper well let's change that what I'm going to do is not save all of this uh I suppose it doesn't matter what I'm going to do is go and find the directory that contains all of our open tool definitions oh that's and it's in jbuilder 5 its a directory called open tools it's actually installed as user writable so that you can drop things in like my tweet to turn on hardware graphics acceleration here or in this case go into my app wrapper and find that jar file drop a jar file in and restart jbuilder that's it so the install installation process is pretty straightforward you drop something in the open tools directory start the product and at launch time we dynamically discover new capabilities and this new capability in particular should be that it can create a double clickable application now I will admit I came down to the final seconds of the session and I had a bug left so it gets almost all the way and I'll show you what we have to do to get it the rest of the way go - welcome jar and note create a proper for welcome jar now just shows up this is one of the zillions of places you can plug things in if you'll excuse me while I sort of take a diversion story we actually got a message through tech support from a fellow working for a company that said I'm trying to write a whole new file system based on XML and plug it into J builder and it works fine I can open things and so forth but I need to be able to go ahead and add to my source path pointers into my XML file system and we're able to actually tell them well that's nice because the open dialog actually allows you to extend the set of route elements in the directory browser with things in any virtual file system that you've written in Java you know so little things like that are getting done by people out there why we built the architecture for ourselves and we've just opened it to the rest of the world I'm sorry again a little bit of a sidetrack topic but let's go ahead and create a proper for this and boom it's gone off and it's done the basic work if I were to actually go to that welcome project and the Welcome project is in our samples and the table there framework and welcome I'd find welcome Dada so it's built me a little app wrapper unfortunately it's left out one line in one file and forgotten to set the executable bit on something sigh last minute demos I thought you'd be forgiving you're a developer audience after all and real demos are always much better than canned demos so let's go in and have a look at at this welcome app and it created its everybody else get two DS sometimes see it's left off one line in not be executable it's left off one line in a config file to specify the main class sigh I should have known and it's forgotten to set the executable bit on Java launcher I'll get both of those things in there shortly and then we should have see it's on the dock it should be loading bits and pieces of swing as we speak and have I guess live demos does anybody remember the last thing I did and welcome at before I turned it into a double clickable application let's see what the launcher does activating lightweight uh XY layout I didn't bundle my XY layout which I was still using in there so you can see we have got double clickable it shows up on the dock if I had code that would actually execute it would actually run so to clarify of course this isn't a feature of jbuilder this is a feature I whipped up in a few minutes during the last session you can do the same will continue to do the same and will continue to make sure that if we find cool things we can do on the Mac OS 10 platform open tools are one easy way to slip things out the side door without having to wait for another release of the product one very last thing by the way because it never gets brought up and is it a Macintosh like thing no but some of us here have to deal with reality constraints how many people here have to automate a build process for a project alright graphical tools work real well for that you run into some problems so one of the things that we did is made sure that J builder actually has a command line behavior so in this case we can say things like J builder build the project at developer applications see if I can find this one again J builder framework samples welcome welcome dot jpx and it'll kick out the command line version of the J builder build process and do everything in my project definition it'll check the Java dependencies compiled necessary files build archives build war files ear files you name it it's the attention to detail that makes it obvious we've been at this for a little bit so if we can switch back to the slides the preview CD you've got I want to mention really briefly you definitely must get apple's java vm update yes you can run it on Mac OS 10 the initial release will bring up a warning letting you know that it's going to be a little bit suboptimal on that release because the debugger really desperately needs some JDK 131 technology and also of course we benefit from a lot of the work the team has been pouring their hearts into over the past couple of months since the release of Mac OS 10 you need to go to the Borland community community site to get a license key but don't worry you can opt out of any possible contact so we'll just make sure that we get the license key to you but if you're interested in jbuilder information then that's a way to get make sure that you get further information from us to let you know when jbuilder for Mac is actually going to ship you