My latest project for third year was to recreate twitter in Java using Hector and Apache Cassandra.
The name Cassandra comes from Greek mythology, she was granted the gift of prophecy by Apollo who was in love with her. Hector was Cassandra’s brother.
In computer terms, Cassandra is a No-SQL database, originally created by Facebook, that is fully scalable. Hector is a Java Class Library that is used to interface with it.
You can interface with Cassandra directly in Java however, Hector is supposed to make the whole experience a lot easier. It builds the relevant code to interface with Cassandra. Much like we use SQL to interface with other libraries.
The thing about Hector isn’t so much that it is over complicated (and believe me, it is), the problem with Hector is that is is undocumented.
In Java terms, documentation doesn’t mean having a document that explains what everything does and how to use it, it means that special comments have been placed in the code to do that for you. When using an IDE like Eclipse or NetBeans, we can see the various methods and classes available to use along with a description of what they do, what parameters they take and what they return. In the case of hector, the writer has put nothing like this and the parameters its methods take are always along the lines of “arg0, arg1, arg2, arg3″ as opposed to meaningful names like “keyName, columnFamily” and so on, thus making it even more difficult to write for.
After a lot of stress induced headaches, I have completed my twitter clone in the for of “Quotes,” a site used for posting quotes you’ve heard or read. These could be exerts from books and music, things you’ve heard on the news or even just something funny or meaningful you heard your friend say.
The entire site makes use of JSP pages and Java servlets and when quotes are taken from the database, they are rendered in JSON, an XML like system that uses a C based structure in the same way as Java, C#, C++ and many other languages do.
The JSON is then read by a JQuery script that prints it onto the page.
You can currently view it working on our JSP server here at the Dundee School of Computing at http://jspnet.computing.dundee.ac.uk/quotes/
I have also placed all the code in a GIT repository that can be found on GitHub at https://github.com/apbarratt/Quotes
I’d love to continue development of though will have to look into running costs as Java and Cassandra hosting costs money so I’ll warn you now, if you do decide to register on Quotes, there’s a chance it may not be there forever.