Course:CPSC312-2016-Project2-TweetMeet

From UBC Wiki

Title

Authors: Aditi Chakravarthi, Nancy Chen

What is the problem?

Are you a Twitterer? Do you dream of an interface that summarizes the most popular tweets based on trending hashtags and or a particular user? Would you like to follow those that your favourites Twitterers follow, if you haven't got to follow them yet?

-- if your answer to the above questions is "yes", then you should consider our interface. TweetMeet is a interface that not only allows you to see most popular (e.g. most liked/commented/re-tweeted) tweets based on your interested subject matters, but also recommends new accounts that a user might be interested in based on their current follow list.

What is the something extra?

Screen capture of our Haskell Tweeter app
  • Writing GET requests to to fetch information using Twitter's API (https://dev.twitter.com/overview/api)
  • Define parsing logic to construct Tweets from JSON responses
  • Be able to search tweets on both user handle(@) and hashtag(#) search requests

What did we learn from doing this?

  • On Haskell's applicability to front-end development: Haskell is known for being fast, and through our app we confirmed that performance is never an issue when fetching large amount of data with Haskell backend thanks to the language's built-in lazy evaluation logic. Haskell actually has several very well-developed web framework that integrates nicely with Bootstrap, JavaScript, HTML/CSS and more. The one we investigated, Yesod (http://www.yesodweb.com), even follows the MVC model loosely. If familiarity with the Haskell language is not an issue one can build Haskell webpages easily, and enjoy the performance the language brings.
  • Error message handing and front-end libraries in Haskell: not only did we learn how to use the data type Either to establish proper error handling procedures, we also went through some front-end libraries such as Network.HTTP and Web.Authenticate to communicate with the Twitter API. We are certain there are many more libraries out there that provide powerful functions for developers to exploit, although we do wish the documentation of these libraries have more simple examples to attenuate the steep learning curve.
  • Aeson: the most difficult part of this project turns out to be parsing JSON (similar to the other project DudeWhere'sMyBus). We decided to use Aeson, which is a Haskell JSON parsing library, to handle Twitter API responses. In most cases we found that once the JSON becomes slightly less straightforward (e.g. nested or embedded as an array) user are forced to define their own parsing logic (including error handling) and data types. We found very few resources to learn the syntax of Aeson since their API is very low-level, and had to figure out when to rely on the "magical" pattern matching capability of Aeson's FromJSON and decode functions, and when to do our own parsing (with lots of help from https://artyom.me/aeson tutorial) ; the final code is a one-liner, but requires much more effort to read and write than, say, Python code that does the same thing.
  • Comparison to other front-end languages: Even though front-end libraries exist in Haskell, they pale in comparison to similar libraries that support other more popular languages. One of the most challenging aspects of the project was the lack of documentation and standardization for existing Haskell libraries. When dealing with, for example, OAuth to access the Twitter API, a lot of Haskell libraries could only deal with HTTP (not HTTPS) requests, or were just plain out of date. Since Haskell is not a popular web development language, it also has less support from platforms like Twitter. We also found downloading and installing the Yesod web framework to be a hit or miss, as it takes a long time to install all the required libraries and the process was very error-prone.