Re: api variables
Re: api variables
- Subject: Re: api variables
- From: "Jerry W. Walker" <email@hidden>
- Date: Tue, 5 Sep 2006 07:46:56 -0400
Hi, Laetitia,
On Sep 4, 2006, at 5:45 PM, Laetitia Orsini wrote:
Hello,
I'm a newbie and after having developed my first "complex" webobjects
application I wonder if it was the right way to do it... The aim of
the
application is to offer an interface to manage contents stocked in a
database. I have at the end many reusable web components with many api
variables. Within these api variables I send the edited objects and a
lot of booleans to deal with the layout with conditionals. Is it a
common way to do things in a web objects application ? Doesn't it look
like dirty javascript ?
It's not clear what you're asking here. However, it sounds like you
may be trying to do some things that WebObjects (WO) would do for you
more easily if you would let it.
It might help to review an example. Take a look, for instance, at the
ThinkMovies example at:
/Developer/Examples/JavaWebObjects/ThinkMovies/
This application also uses the JavaBusinessLogic framework whose
source code you can find at:
/Developer/Examples/JavaWebObjects/Frameworks/JavaBusinessLogic/
In order to build and run the example, you will also need to start
the WOMovies OpenBase database, but you can review the code and WO
Components without doing that, if you don't wish to take the trouble
to build the application. If you do want to build the app, Apple
recommends that you copy the project to your own work area first, and
not modify the code in the Examples directory.
What are the differences between api variables and non synchronized
variables ?
The api variables for a component may be synchronized or non-
synchronized. Synchronized, means that WO will push any variable
values through the api variable bindings from the parent to the child
component, then pull the values from the child component back to the
parent component both before and after each of the Request/Response
loop method calls (appendToResponse, takeValuesFromRequest and
invokeAction). That means that the values will be pushed downward and
pulled upward across the component/subcomponent interface six times
for each page rendering and user response to the page.
Though this approach is not particularly efficient, it tends to keep
people new to WO out of trouble. To make the value transfers more
efficient, you can override the synchronizesVariablesWithBindings
method in your subcomponent to return false, which will stop WO from
doing the six push/pulls for you. In that case, you will probably use
the WOComponent valueForBinding and setValueForBinding methods to
push and pull the values yourself. Although this is more efficient,
it is also more work on your part. For a small, local, low traffic,
administrative application (e.g. an app that will be used by fewer
than 10 or 20 people each day on the LAN), I probably would let WO
synchronize the values.
I also wonder if this kind of applications would be more quickly
implemented with Direct To Web. I've made some tests with Direct To
Web
on my database model but it seams I'll still have a lot of work to
customize things if I want the same features as in my own application.
For example, if I have an entity Album that contains Singles, I would
like to be able to edit Singles just by clicking on a Single listed in
my edited Album.
This is doable in Direct To Web (D2W) without freezing the components.
It seams it's not easy to customize relationships with
Direct To Web. If I have to freeze each component to customize
everything will it still take less time than if I do the entire
application by myself ?
If your interest is simply providing a convenient administrative
application for a well structured database, you can't beat D2W for
convenience. If you get good at using D2W, you would probably be able
to build your administrative application faster with it, even if
you're customizing a few components. However, if you find yourself
customizing most, or all, of the components because you're more
concerned about a custom look and feel than simply administering the
data, then you would probably be better off not using D2W.
It's also true that if your database is not well laid out (for
instance, a badly structured legacy database that you can't change
but are being forced to use), then you would probably be better off
developing a custom app without D2W.
Is Direct To Web a common used tool to make
advanced interfaces to manage data or it is more for testing models ?
Those who are very good with D2W use it commonly to make advanced
interfaces to manage data. They also mix its use with custom
component development. However, in doing so, they are mixing two
technologies and to do that, you should be fairly adept at using each
one individually.
Thanks for your precious advices
Regards,
Jerry
PS Please post any responses to the list.
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >api variables (From: Laetitia Orsini <email@hidden>) |