Chuck Hill

author
+ Follow
since Sep 13, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chuck Hill

The problem with this kind of framework, it is very difficult to get approval for use from upper management(because of being less known )



Quite true. If management wants to dictate technology they will usually dictate what they read in a magazine. The sell for WO is the very low cost of delivery and maintenance. It all comes down to which management values more.


Chuck
19 years ago

this value,directActionRequestHandlerKey(), come from ?


It is a method on WOApplication.

I want the first page is login page, how to invoke loginAction() method?


If you want the first page to be a login page then return the login page from defaultAction. The login action is accessed through a URL like:
http://www.domain.com/apps/WebObjects/YourApp.woa/wa/login

wa is the key returned by directActionRequestHandlerKey()
the login (after /wa/) must match one of the methods in DirectAction: loginAction.


The defaultAction is invoked for URLs where there is no action indicator such as:
http://www.domain.com/apps/WebObjects/YourApp
http://www.domain.com/apps/WebObjects/YourApp.woa

And, of course, where there is a action indicator:
http://www.domain.com/apps/WebObjects/YourApp.woa/wa/default


Is this defaultAction() a first page if we don't define the Main page.


Yes. You will also see the "main as default" made explicit in code like this:



Chuck
19 years ago

If it has so many of above positives, why is it not yet popular like Spring or Hibernate??



Good question. There are a number of reasons, more or less in order:

1. It is proprietary, not Open Source
2. Apple does not market it
3. It does not follow the J2EE architecture (better necessarily means different)
4. It was not originally Java technology
5. It is not a "Standard"

Remember: Brittany Spears is popular. That does not make her a great musician.

Chuck
[ November 03, 2004: Message edited by: Chuck Hill ]
19 years ago
Hi Kevin,

There are a few conveniences in WO that are useful when you are starting out. The Main page is one, Session's defaultEditingContext() and DirectConnect (webserver-less deployment) are some others. By the way, only Main.java is a WOComponent (subclass of com.webobjects.appserver.WOComponent), the others are subclasses of other classes).

The page named Main is used by default if no page is explicitly named. There is no requirement that the application have a page named Main, most of mine do not. If you do not have a Main page then you need to indicate in Application and DirectAction the name of the "default" page.

Let's talk about the WebObject's concept of actions for a moment. HTTP requests are handled by objects called Request Handlers. The DirectAction and ComponentAction handlers are the ones used most of the time. There are also special handlers for resource requests, web services, etc. The frameworks manage these for you, there is no need to know much about them.

The ComponentAction handler is stateful - it requires a session to work properly and sends the request to a WOComponent instance. The DirectAction handler is stateless but it can use session information if it exists. It sends the request off to one of the methods (each action has its own method) in a subclass of com.webobjects.appserver.WODirectAction. The subclass named DirectAction is just a standard convenience. DirectActions serve as stateless entry points into your application. They can also be used as service URLs that take parameters (form values) and return some result. For example, you could use a DirectAction to return a file that is not stored in the webserver's document root.

Let's look at how to use a DirectAction to make some other page the default page. First, we need to tell Application to choose the DirectAction handler instead of the ComponentAction handler as the default when there is no indication of which handler should be used. Add this to the Application constructor:
setDefaultRequestHandler(requestHandlerForKey(directActionRequestHandlerKey()));

Now all we need to do is to implement a DirectAction. We are concerned with the default page to show here, so we will used the special "default" DirectAction. Add/edit DirectAction to have this method:
public WOActionResults defaultAction(){
return pageWithName("PortalEntrance");
}

You could add another as a direct route to the login page:
public WOActionResults loginAction(){
return pageWithName("QuickLogin");
}


Chuck
19 years ago
As Apple does not advertise it, the marketshare is best described as lousy. If you are looking for the most broadly based skill-set that will virtually guarantee employment, well sorry to say its not WO. If you are looking for a very productive web app development framework, then it is an excellent choice. As to the place with the most widespread use, I'd guess at USA or Australia.

Chuck
19 years ago
WebObjects is for developing web applications, web services, and java client apps. It is also an appserver, though you can use JBoss, or Tomcat or whatever to deploy if you want. It is a very, very efficient environment to develop in and the vast majority of your time is spent on developing domain level functionality rather than plumbing and infrastructure.

The native dev tools work on Mac OS X and Windows, and there is also a very good plugin for Eclipse. We prefer Eclipse to the native IDE. If you are willing to forgo the GUI UI builder and data modeling tools (and some do) then you can develop anywhere you can compile Java. Deployment is supported on OS X, Windows, and Solaris. It is also commonly deployed on Linux, though without support. In practice, if there is a JVM you can deploy.

http://www.apple.com/webobjects/

Chuck
19 years ago
Hi Alvin,

I don't think WebObjects will replace any technology. If Apple went on an aggressive education and marketing campaign, then it might. But Apple is not going to do that (see my other messages for why). What it will continue to do is to inspire advances other technology, and in Java technologies in particular. In the meantime, I can continue to bring in enterprise solutions for a third of the cost of a J2EE solution (though the definition of this is getting more blurry).


Chuck
19 years ago
Hi Alvin,

No, the book is not aimed at the beginner. There were already beginner books available, we wanted to add a more advanced book for WebObjects. For beginners I would suggest Joshua Marker's excellent Visual QuickPro Guide. This does assume you are on a Mac, but it does not take too much effort to apply it to Windows.

Our text also assumes that you are familar with Java. If you are not familiar with Java, well you have already found the right place to hang out! Some familiarity with databases, HTTP, HTML, XML, and web app architecture in general will serve you well.

Even for a beginner, there will be lots in the book to help you out when you run into the inevitable pitfalls as you start out. However, you will gain maximum value by reading again as you progress.

Chuck
19 years ago
WebObjects is a set of Java frameworks for developing applications. It is based on a design that dates from the mid 90's and which is still innovative today.

1. Data Persistence (think Hibernate)
It provides OO access to external data stores (via JDBC, JNDI, etc.) which can be extended to wrap file systems or pretty much anything has a reasonable translation to objects. As a bonus, there is no hand coding of XML needed. There is a GUI data modeling tool.

2. Template Based Presentation Layer (think Tapestry)
This allows HTML pages, XML, PDF, whatever to be generated from your objects. The handling of session state is particularly nice.

3. Rule Based Programming (think again)
This is kind of hard to explain, but you model rules that describe how your app works and, well, it happens. Between the rules model and the data model, application development can be very fast and it is very easy to update. No, this is not code generation. This is code-less application development.

Chuck
19 years ago
And now onto the question in your subject line. While the J2EE crowd is catching onto certain aspects of WebObjects, they are not quite current with others. WebObjects is way out in front and will remain there for some years (IMHO of course). While the DB access and presentation layers are being copied with quite good success, there is something in WO that will hit mainstream Java in three or four years by my guess. If WebObjects is the best kept secret of Apple, then the rule based programming technologies in WebObjects are the best kept secret of the best kept secret.

What I am referring to are the Direct To (D2) technologies that blend a data model (MDA anyone?) and rules to produce an application on the fly. No, not code generation. A model and rule based application that can be changed on the fly. There are engines for HTML, JavaClient, and WebService generation.

You won't find them in the book, the topics are too large to be covered will in a couple of chapters. Perhaps the next book...

Chuck
19 years ago
Yes, you will find a lot of open source (and some not) project that are based on aspects of WebObjects. WebObjects (WO from now on) is an old timer, dating from the mid-90's. It was originally created by NeXT, who had some very, very good OO minds. I find most of the design very beautiful, a sentiment that the J2EE APIs seldom inspire in me.

NeXT had it right, IMHO, a long, long time ago. However, it was not originally Java technology. It was originally written in Objective-C, a dynamically typed (yeah! no casting!) language similar to smalltalk but with a C syntax background. It was also about $50K for a deployment license. Only in the last couple of years has it migrated to Java - a move made for marketing, not technical reasons. Yes, its true -- I miss Objective-C.

OK, where am I going with this? The frameworks have a legacy of excellent design and they have been around long enough to be very mature. A lot of people have recognized the quality and "rightness" of the design and you can find implementations (some nearly complete, other just of parts) in Java, Ruby, and a number of other languages. TopLink for Java is heavily inspired by EOF (part of WO). How many re-implementations of EJB has anyone seen?

It seems that in the last few years that this has started to sink in elsewhere and there is movement in the Java world away from full-on J2EE to a simpler, saner world where we can concentrate on implementing functionality not infrastructure.

Why doesn't Apple market it? Who knows? I suspect they are having way too much fun selling iPods and raking in bales of cash. They have a great product, they know that. They use it for their own systems. Why expend effort trying to sell it in a market place choked with a myriad of OpenSource options when you can sell iPods and make much more money?

Chuck
19 years ago
Hi Stephen,

I'll be presenting on the book Practical WebObjects here next week and will be pleased to go into more detail then. In the meantime...

people on there apparently pity traditional EJB developers


I have nightmares about being forced to get a job using EJB!

while you can deploy on Linux and Windows easily enough, it's much harder to develop on those rather than MacOS X.


That is not quite correct. There are two tools (the GUI builder and the object modeler) that only run on Windows and OSX. Mac users hate me for saying this, but I have both and Mac and a Win2K machine and I prefer the Win2K machine for most WO development. It is faster and has a larger monitor. There is a plugin for Eclipse for WebObjects and development on Windows is great. The plugin works on OS X too, but, well, I like my Windows machine. Deployment is supported on Win2K, OSX, Solaris, and some flavors of Linux. Note the "supported". In practice, if there is a JVM it will deploy. You can also deploy inside of JRun, JBoss, Tomcat etc.

This sounds great. I'm just wondering if any JavaRanch folks actually know much more about this (e.g. whether it's worth it to pick up an iBook off of eBay to play around with this stuff enough to convince the folks at work to start developing projects with this platform).


I don't know that I would go with an iBook, but yes, it is worth looking into. You will find many other projects in various languages that are based heavily on WebObjects. Do you know of any re-implementations of EJB in other languages?

Chuck
19 years ago