Inside Paulo Abrantes' head
[ start | index | login or register ]
start > 2007-11-05 > 1

Software Developing: Implementing a ShoutBox on SnipsSnip

Created by pabrantes. Last edited by pabrantes, 244 days ago. Viewed 580 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
shoutbox-render.png (32825)

Software Developing: Implementing a ShoutBox on SnipsSnip

Since a few months ago I noticed that the number of visits were raising although most of the readers won't comment. In my opinion, this behaviour is due to the fact that SnipSnap only allows logged-in users to comment and even though the registration process is quite simple and fast some readers probably prefer to skip the process and not comment at all.
The idea of allowing guests to comment is in the list of features to implement, although since a comment is a snip and a snip needs to have an owner it has implications, such as, who is the owner of such snip - some default user? should be an editor and the snip be locked? - I still haven't find out a good solution so that implementation keeps getting postponed.

Meanwhile, I thought that a good idea would be the existence of a shoutbox. For the ones who don't know, a shoutbox is a chat-like feature that allows people to quickly leave messages on the website, generally without any form of user registration.
It's not my intention to replace the comments with the shoutbox, but it could be a feature that allows interaction with new users, which then might lead to the registration of those users.

On Friday I developed a simple implementation of a memory-only shoutbox. I'm saying memory-only because the messages aren't persistent, there's a buffer that keeps messages in memory only (size is configurable) and after it's full it has a policy of first in, first out (FIFO). Also since it's only in memory if the server is restarted the current shoutbox is lost.

The implementation is very simple and it only needed to create three new objects, the ShoutBox, the ShoutBoxServlet and finally the ShoutBoxMacro.

ShoutBox
The ShoutBox is the object that is part of the model. Basically ShoutBox is a wrapper around an application aware map that contains for each one of the application instances that SnipSnap is running a list of shouts. A shout is nothing more than a formatted string with the date, user and actual input.

ShoutBoxServlet
The ShoutBoxServlet is the controller. It receives data from the interface and after input formatting and escaping (in order to avoid XSS) it passes the information to the ShoutBox object.

ShoutBoxMacro
The ShoutBoxMacro is the tool given to the user. It is a component that renders the shouts' list for the current application and also renders an input box to enter new shouts.

A schematic can be found below.

shoutbox-render

This is the first version and I'm aware that improvements can be done, such as:

  • Allow editors to moderate the ShoutBox. Currently shouts are only deleted when they are thrown out of the shout buffer.
  • Using javascript to submit and update the shout panel auto-magically.
Any other suggestions, comments and critics are welcomed.
4 comments (by skimmer, m4ktub, pabrantes) | post comment
Who am I?
paulo-roca2My name is Paulo Abrantes AKA pabrantes and I'm a software developer. I'm currently employed at >>CIIST working as a Java developer in >>FenixEDU.

This blog is mostly about Java programming, domain driven design and snipsnap bliki developing. Everything written in this blog is my personal opinion and it may not reflect the opinions of my employer and co-workers.


Blog subscription
subscribe by rss subscribe by email

Links
>> Home
>> Paulo's Profile
>> Post History
>> Add to Technorati Favorites
>> Paulo's Photo Gallery
>> WishList
>> Posting without Login

Search Blog
Fellow Bloggers

Recent Posts

Java Programming: Bytecode Injection
Intermission: Sorry For Downtime
Software Developing: Studying The Bliki Domain Model
SnipSnap Developing: Trying to settle a roadmap
System Administration: Load Balancing with Apache
Blogging: Two years have passed
Software Developing: The SnipSnap Saga
Java Programming: Getting your code spicy with Groovy
Software Developing: Fluent Interfaces
Software Developing: Implementing a ShoutBox on SnipsSnip
Software Developing: SnipSnap, SnipIt and SnipSnip
Java Programming: Proxies and Access Control
Java Programming: Proxies and References
Java Programming: References' Package
YALM: Yet Another Layout Modification

For older posts, please refer to post-history for a complete Post History

Logged in Users: (0)
… and 17 Guests.
This is a modified version of snipsnap.org created by >>Paulo Abrantes