Wiki source code of Learning WebObjects
Version 3.1 by tavisadk on 2009/10/26 21:24
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | This document is written for someone who wants to start developing with WebObjects and has no prior experience with it. It details: | ||
2 | |||
3 | 1. What WebObjects is and does | ||
4 | |||
5 | 2. How to learn the concepts necessary to code with WebObjects | ||
6 | |||
7 | 3. How to install the development environment | ||
8 | |||
9 | = What WebObjects Is = | ||
10 | |||
11 | \\ | ||
12 | |||
13 | WebObjects is a server side development environment that allows you (a developer) to write a database driven web based application by creating Java objects and working with them. You can bind the properties of an object directly to user interface elements like text, form fields, buttons, and drop down boxes. WebObjects hides the complexities of the fact that the user is using a web browser from you, and also that the data store is a database. WebObjects handles creating and managing user sessions without the use of cookies, and fetches and saves your objects to and from a database without your needing to write SQL. That also means it is easy to switch databases after an application is written. In addition, WebObjects can be used to write a Web Service without a user interface. You can use a Web Service to interface with other web application servers or with a JavaScript (AJAX) application. | ||
14 | |||
15 | WebObjects includes a rapid prototyping tool called Direct to Web. You can graphically define your object model in the development environment and immediately launch a series of web pages that look somewhat like a Microsoft Access front end; you can list the objects in your database, query the database, and add new entries. While using the Direct to Web pages, you can customize them in real time with a Java tool that takes your changes and saves them back to the web server. When you are finished you can "freeze" the pages and then use them in your finished application. | ||
16 | |||
17 | WebObjects applications can be written on any platform that supports Java development. They are compiled into 100% Java byte code that use a runtime environment also written in Java; they can be deployed on any web server capable of running Java. WebObjects applications perform very well and are very scalable; Apple's online store and the iTunes store use WebObjects. | ||
18 | |||
19 | = What WebObjects Is Not = | ||
20 | |||
21 | \\ | ||
22 | |||
23 | WebObjects is not a web page design tool. In fact, WebObjects does not have a WYSIWYG HTML editor. When using WebObjects you either hand code your HTML pages or use your favorite HTML designer application to create your web pages. This enforces the concept that web developers write code and web designers make web pages. WebObjects uses your web pages (called templates) and adds dynamic content on the fly to make your application run. Also, WebObjects is not a framework for writing client side code. The objects you work with in WebObjects exist on the server only. If you are writing a complex client side JavaScript based application you can serialize your server objects via XML and send them to a browser, but you will then have to deserialize them in your client code and deal with them. WebObjects is maintained by Apple and in my opinion Apple will not ever try to make it into a framework for developing an entire cloud or Web 2.0 / Application (for example the Google Apps). However it could be useful as either a back end for such an app, or as a means to develop a server driven application that uses extensive client side scripting to make the user interface more responsive (for example client side code to validate user input). You will have to write such code yourself. WebObjects (or rather extensions to it written by third parties) provides hooks to define and execute client side actions (known as AJAX). | ||
24 | |||
25 | = Why I Use WebObjects = | ||
26 | |||
27 | One year ago I wrote a Microsoft Windows .Net application that consisted of a native Win32 front end coupled with an MS SQL Server back end. I needed to extend it to work outside of the local network, so I needed a web front end. MS ASP.Net would have been a natural extension. However, I was frustrated by how much time I spent writing code to interface with the database and how difficult it was to represent my data with custom objects. For example, in my .Net code, I created steps to explicitly perform queries on a database and the results were returned as dataTable objects which returned dataRow objects. A dataRow is similar to an array of strings. After they were loaded in memory, the row objects have no relations to each other; for instance if in my database a person is linked to a department with a foreign key, in memory a dataRow object representing a person does NOT have a pointer to the dataRow object representing his / her department. So I can't write a statement like: | ||
28 | |||
29 | String myDepartment = aPerson.department.name; | ||
30 | |||
31 | Nor could I easily bind a user interface element to a custom property of an object. For instance I could not easily create a Person property called fullName (Firstname + " " + Lastname) and bind it to a drop down list. In order to do that, I had to create a custom Person object, copy all of my dataRow objects into a collection of Person objects, work with them, and when I was done write my own code for tracking which objects changed and saving the changes back to the database. | ||
32 | WebObjects is a mature and time proven method for writing business logic in Java, using all of your favorite frameworks and packages, which manages both the mess of database storage and HTML interface binding. | ||
33 | | ||
34 | |||
35 | = How to Learn WebObjects = | ||
36 | |||
37 | To use WebObjects you need to use both the Apple frameworks and third party extensions and tools. Apple developers also use these tools. Unfortunately not too long ago WebObjects development used an Integrated Development Environment (IDE) that is now obsolete and many references to it are still present in the documentation. To be clear, you will develop your applications using the Eclipse editor, which is an open source editor written in Java. On top of that you will install WOLips which provides an IDE for modeling your data and writing your code. Also, you will install a set of frameworks called Project WONDER which include bug fixes to the WebObjects framework and extensions that will make your life easier by performing common tasks. | ||
38 | | ||
39 | Prerequisites | ||
40 | | ||
41 | To start developing in WebObjects you need a basic understanding of Java, HTML, and what a database is and how tables, columns, rows, and relationships work. Having any knowledge of SQL or any experience with NEXT or Apple Cocoa development is a plus. | ||
42 | | ||
43 | 1. Concepts | ||
44 | To learn WebObjects I suggest first reading the (out of date) Apple documentation. Everything in it is correct except the references to the obsolete Apple development tools, and how to deploy WebObjects applications. Here is a good list of helpful documents, and a suggested reading order: | ||
45 | | ||
46 | |||
47 | |= Document |= What it tells you |= Ignore references to | ||
48 | | WebObjects Overview | Conceptual Overview of WebObjects | Apple development tools, creating a full Java client (Swing) application running outside of a browser . | ||
49 | | Java for WebObjects Developers | Java Skills Necessary for WebObjects | | ||
50 | | WebObjects Tutorial | Walkthrough of a Simple Application | The references to version numbers. As of this writing WOLips can be installed in Eclipse 3.5 | ||
51 | | WebObjects Web Applications Programming Guide | Common WebObjects Development Tasks | Apple development tools (in particular creating a new project, but your steps will be similar). | ||
52 | | EOModeler User Guide | How to Model Your Objects | This instruction book references the obsolete Apple modeling tool. The WOLips modeler is VERY similar. | ||
53 | | WebObjects Enterprise Objects Programming Guide | Working with Your Objects | Apple development tools and Java client applications. | ||
54 | | WebObjects Direct to Web Guide | How to Rapidly Prototype an Application | Apple development tools, especially Builder (HTML editor) and RuleEditor. | ||
55 | | WebObjects WebServices Programming Guide | How to Hook Other Applications Into WebObjects | Apple development tools. | ||
56 | | WebObjects Dynamic Elements Reference | What Dynamic Elements are Available | Note: Third parties have extended this list considerably. | ||
57 | | WebObjects Application Properties Reference | Advanced Configuration of an Application | | ||
58 | | WebObjects XML Serialization Guide | How to Serialize Your Objects Into XML | Apple development tools and Java client applications. | | ||
59 | \\ |