Sunday 7 July 2013

News Publishing System

Care and Nursing Related News

We have been developing a news system that allows us to post care and nursing related articles direct from a browser using an editor similar to Libra Office. This gives our news posters complete control over their articles.

It also provides image support in terms of cover images for articles and images inside articles, we use AJAX (Asynchronous JavaScript and XML) to allow us to upload without refreshing the page and other various interactive functions.

We have also integrated into social media by using the Facebook opengraph and Twitter API allowing us to publish any articles directly to our social media pages allowing us to try and maximise our exposure.

In this article I will try and cover some of the development needed to implement the system from the ground up and any tools used along the way.


Screen shot of our news page with various article
News Page


Making Life Easy

Our news system takes advantage of jQuery to provide a JavaScript framework to help speed up development and provide solutions to some common tasks while developing a web site.

We have reviewed a few frameworks for client side JavaScript such as Dojo and we have also used a few plugins for jQuery to provide form handling functions for AJAX file upload, document publishing, saving, loading and reviewing.

One handy plugin we have used is jQuery Equalise which allows you to equalise the height of your divs in relation to the highest div this gives us a nice even layout. We did try to use just a left to right layout using divs but it looked to messy.

Another plugin which we use is jQuery UI which provides JavaScript effects, widgets and user interface specific functions. This allows us to provide tooltips for our forms as well as highlighting form fields to the user and shaking to get attention.




Logo saying jQuery write less, do more jquery framework
jQuery Framework

News Objects

The system we have developed was designed to make good use of OOP allowing us to reuse our code and reduce the amount we need to write.

Once the system has been release and we have fixed any release bugs found we will review all our classes and see if we can refactor any of them.

This is something we try to do regularly because our system changes over time we can usually move some classes up the hierarchy.

As well as these we have implemented a few common patterns such as the builder pattern and singleton pattern. We use the builder to create news article objects and the singleton allows us to only have a single instance of a class (internal).

We have also implemented the Iterator interface so we can use a builder to create objects and then iterate through them using a foreach loop.

For more reading on design patterns you could try and get a copy of Design Patterns element of reusable object-orientated software (ISBN-13: 978-0-201-63361-0) or find some online tutorials.


Picture of the cover of Design Patterns book
Design Patterns


Social Media

Integration into the popular social networks was accomplished by using the opengraph to interface with our Facebook timeline allowing us to post the article onto our timeline directly from the news article.

Twitter has also been integrated so we can tweet our articles directly when we publish them on The Care Homes Directory web site.

Unfortunately we could not implement Google+ integration because they only allow read access to their API so we cannot post to our stream.


A screen shot of my public profile on Google plus
Coffee


Testing Testing

We also developed some unit tests to allow us to automate some common tests for our objects and the system as a whole. We use PHPUnit for our tests as well as PHPDocumentor 2 to generate our documents using inline comments and header comments.

Each class has a corresponding test case which tries to test every possible path the code can follow and also checking for the correct output. We also try to fuzz our script because we find it helps with handling bad user input.

One thing we have learned over the years is that users are unpredictable and will use your program in ways you would never imagine so by throwing some bad inputs to it we can try and uncover these cases before our users do.

Along with these we will be developing some selenium UI tests to make sure we can test our interface as if we are a normal browser. We will be using it with PHPUnit for providing us with some comprehensive tests for our code.

We have written about how we approach testing before in an old article which you can read here if you are interested in our testing and QA process.


An image with lots of words written at random spots, words used are testing with phpunit
Testing



Conclusion

We hope our news system provides a useful service to our visitors and also any care providers who like to keep up to date with the news.

Once the system is stable and our first release is tagged we will be reviewing integrating news into our enhanced listing allowing care providers and home owners to publish any news and/or events directly to their listing.

Soon we will be publishing an article on the new feature release for our news system, RSS and Atom feeds, which were simple to implement and most of the work for this feature has already been done

No comments:

Post a Comment