Pages

November 03, 2008

ServiceAdapter in BlazeDS – Where’s the service?

An English translation is available for this post...

"כיף".
לו הייתה ניתנת לי מילה אחת בכדי להגדיר את המעבר מ-LCDS ל-BlazeDS הייתה בוחר במילה הזו – "כיף". טוב נו, זה לא כזה נורא, אבל עדיין אדובי מצליחים להכשל בעקב אכילס שלהם שוב: הדוקומנטציה.
למרות שהכל די שקוף לאימפלמנטור (אני, אני...) ומעבר להברחות jar-ים מפה לשם והגדרות תלויות, מגיעים לשינויי-קוד, שהם למעשה הכואבים מכל.
בזמנו יצרתי הרחבה של ActionScriptAdapter עבור יישום של צ'אט באפליקציה. אותה המחלקה ניהלה את ההודעות בצורה מעט שונה שלא רלוונטית לעניין כרגע. מה שכן, המחלקה השתמשה במשתנה שהגיע אליה בירושה מאדון ServiceAdapter שנקרא בפשטות service.
קימפול זריז וג'אוה צועקת שהיא לא יודעת מי זה service ולא מכירה אותו אפילו ב"שלום שלום". מיד כשועל מנוסה אני קופץ אל התיעוד של אדובה בכדי לגלות מה העניינים. אני אכן מגלה שאין חיה שכזו service ב- ServiceAdapter, אבל להפתעתי אני מגלה דוגמת קוד שעדיין משתמשת בו כאילו כלום לא קרה. לא מאמינים? הנה תראו. אז מה בעצם נותר לנו? נכון. לפנות לפורומים.
חיפוש זריז ואני עולה על הת'רד, בו נאמר כי שהדוגמה היא קלוקלת ולמעשה יש דרך אחרת לפנות ל- service הנעלם.
אני מאד מקווה שאדובה מודעים לאיוולת הזו, שבטח מבזבזת לא מעט זמן למפתחים ברחבי העולם.
עד העונג הבא.

“Fun”.
If I had one word to define the migration from LCDS to BlazeDS, I would choose this word – “Fun”. Well, it’s not like it’s all that bad, but still Adobe manages to fail when they are known to fail in the most: Documentation.
Even though that most of it is pretty transparent for the implementers (me, myself and I…) and after smuggling all the .jar files and messing around with dependencies, we reach to the code migrations which hurt the most.
At the time I’ve created an extension for ActionScriptAdapter for a chat in the application. This class managed the messages that came through it in a slightly different manner that’s not relevant to the story. What’s relevant is that this class used an inherited variable called “service” that came from Mr. ServiceAdapter.
A swift compilation and Java shouts that it doesn’t know who “service” is. I instantly dive into Adobe’s documentation to see what the hell is done wrong here, and I do find out that there’s no such thing as “service” on ServiceAdapter, but to my utter surprise I also see a nice code sample which uses it. Don’t believe me? See for yourselves. So what have I got left? That’s right… forums.
After a quick search I find this thread where it says that the code sample is wrong and misleading and there’s another way to reference the “service” variable.
I very much hope that Adobe is well aware of this mistake that surely waste time to a lot of developers around the world.
Till next time…

No comments: