Paddling In K2 Pool - Part 1 - Preparation

David Horwitz 04 April, 2009 12:20 Sakai Permalink Trackbacks (0)

Now that I'm able to clear some space after the start of the year and that K2 work is gathering speed, I'm getting ready to start dipping my toes in the K2 pool. The aim of the work is to explore what it would take to port existing functionality in Sakai to K2 (rather than write new tool from the ground up in the K2/3akai idiom) - as presumably a large number of people across the community have code that will need to be porrted to K2 hopefuly this wil be of some interest.

The test case selected is the Poll tool as this is an existing,  fairly straightforward, too. There also is an exisiting polls widget making use of the restful services. Standing against the poll tool is that some of the code is rather messy, it was the first tool I ever wrote and as a result has some poor architectural features. As a precursor the even looking at the K2 code and concepts life will be a lot easier if these where fixed. This will also improve the quality of the code for the 2-7-0 release. This work is being tracked as SAK-15989:

  1. Add unit test coverage of code
  2. move use of sakai services to "external" classes
  3. make use of utilities like GenericDao written since polls first developed 

Some of these Aaron has been talking about for a long time at developer workshops and I've followed to a greater or lesser extent in newer project. However the act of doing this work has brought some interesting things to light:

1. Simpler code

 The use of libraries like GenericDao has simplified the code, notably removing the need for a number of functions to convert collections to lists. Moving the Sakai dependencies to external classes also has simplified the code in the service layer.

2. Writing unit tests exposes Fragile assumptions

Writing unit tests for existing code makes you aware of fragile assumptions you may have made in your code. This is particularly evident when you cover the cases where you expect the code to fail, such as null atributes, you may well find that your expecting the persistence layer to handle this gracefuly.


comments


Add comment

Topic

Text

Your name

Your email address (if any)

Your personal page (if any)

authimage


Powered by LifeType
© 2006 - Design by Omar Romero (all rights reserved)