On Dec 29, 2005, at 7:09 AM, Wolfram Stebel wrote:

<snip>

What am i missing?

There are a few things you can do.  One is to follow EOF's suggestion
and add a formatter that can format (convert between) MyType and
String.  Given a String s, it will return new MyType(s).  Given a
MyType t, it will return t.getValue().
...

I'd prefer a formatter: it keeps the code all in one place and is
easy to reuse.  I'd avoid adding code to CSampleTable as you would
have to do this in every object that used MyType.
I followed your recommendations regarding the implementation of the MyType
class (immutable etc.).
Further i implemented a formatter "MyTypeFormatter" which i use for data
exchange in my component.
Works like a charm!!!

:-)


One question remains:

I allocate the formatter as a public final member in my application at the
moment. Is it a reasonable place or should i allocate it in session or
component context?

I would say, session is best for speed, resources and safety, do you agree?


It should be fine at the application level. As long as you are not maintaining any data in instance variables (and I don't see any reason that you would need to do this) then it will be thread safe. I often place such formatters at the application level and have never noticed a problem.


P.S. In a short while i will publish my "BaseWOApp" with several interesting
solutions (MyType EO data type, timertask for property update [from
PropDemo.zip, www.bugs-and-errors.de], page member pushing and popping for correct forward and backward navigation, standard error handling pages...)
That's something for beginners :-)


Something indeed!  I'll look forward to this.

Chuck


--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to