Research Log of Web Science Students

Computer Science is not simply programming

My first “contribution” to Open Source

with 2 comments

I have been hardpressed to wire Twitter4j using Spring in our application for the past 4 days. This is probably the only third party library (the others being Google Appengine’s UserService and PersistenceManagerFactory) I am having a hard time wiring and right now I can’t tell anyone exactly why.

But I do have a few leads. One of them came when I asked Yusuke Yamamoto, author of Twitter4j, if this test would pass:

String consumerKey = "consumerKey";
String consumerSecret = "consumerSecret";

Twitter twitterOne = new Twitter();
twitter.setOauthConsumer(consumerKey,consumerSecret);

Twitter twitterTwo = new Twitter();
twitter.setOauthConsumer(consumerKey,consumerSecret);

assertEquals(twitterTwo,twitterOne);

The test failed. This was a big Yehey! for me. For one because my suggestion was filed as a bug and will be in the next release of Twitter4j (version 2.0.10). You won’t see my name on the bug tracker though, credits to Yusuke for wading through the code to identify exactly where the error was coming from.

On the other hand, it was a good sign. I had this feeling this was something that’s making the wiring of Twitter4j impossible…at least right now. Everytime my controllers needed to use Twitter4j using oauth, I had to get a fresh instantiation of Twitter4j and do another initialization. In Spring, all beans are singletons (not Singleton with the capital S). That means that there’s only one instantiation of a class going around the ecosystem.

See? Here’s the thing, a singelton Twitter class gives me errors while new instantiations do not. For me, it only means that there’s something non-deterministic about the Twitter class.

But whatever it is I hope it it’ll be fixed in the next version of Twitter4j.

Advertisements

Written by Jose Asuncion

September 9, 2009 at 4:01 am

Posted in Hardwire

2 Responses

Subscribe to comments with RSS.

  1. Good job! 🙂 Did he tell you when the next release will be out? Maybe you can get the daily build and play with it.

    rom

    September 9, 2009 at 10:36 am

    • The bug is already fixed. I checked again yesterday but I haven’t checked if the fix fixes my problem since version 2.0.10 isn’t out yet. Still waiting for it. Hopefully it’ll be sooner rather than later. I can’t live with smelly code. 😦

      Jose Asuncion

      September 22, 2009 at 4:44 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: