New Project: My Favourite Things

Friday, 19 September 2008 14:56 by Frimbob

I have been wanting to try this for a while, I have wanted an easy way to create lists of my Favourite; movies , books, songs etc and display them on my Blog, now I could just do a couple of blog posts but my lists change very quickly and its would just become a time issue.

I wanted to attempt a ajax app, so my a project that would allow me to use ajax techniques with a persistent data store seem in fruition, I could then dynamically display the lists and a have an easily modify control.

Quickly I have some requirements.

  1. Use the .Net 3.5, framework
  2. Blog use a flat file so must this datastore.
  3. Use JSON and not xml as data format.
  4. Use AJAX techniques.
  5. YUI library components for the script.

I have identified 3 packages:

  • Library which handle object definitions and persistence.
  • Web-services that provide the access layer.
  • Client Side package to display and allow control.  

Nothing too ground breaking about that setup, I have made good inroads into the first data layer.

Objectives of Data Layer

  • It must accept string paramaters and return JSON string.
  • Handle all transactions and object Deinitions.
  • Provide a robust data-store.

I have decided to use the following libraries for this package.

  • Json.net - This provides the Json TO .Net Object mapping. Is better than the inbuilt Json parser IMOP.
  • SQLlite ado.net Provider - This provide the flat-file DB and help ensure transactional and data integrity.

The Data-Definitions

This is hierarchal data, With each category and items under the category. I have defined 2 base cases that cover the common data between each category. Below is a print out of these two classes

ClassDiagram1

The 'CategoriesBase' implements 2 important static generic  methods. The first is a Serialize obj to json, which as its name suggest return a json string from an object.

The 2nd method is the reverse, De-serialize takes a Json string and returns an object.

These classes are still a work in progress but I will require a method that will store and object in the DB an other to retrieve it.

The Sub-Classes

I have created a number of categories and items.

  • Albums
  • Books
  • Drinks
  • Movies
  • Recepies
  • Songs
  • Sports
  • TVShows

ClassDiagram2

Observations

  • By Hard Coding the data-objects, I make adding new ones more difficult.
  • The DB will consists of a single table with each category consuming one column, The objects state will be mapped to a single record and stored in JSON text string.
  • I'm working on an object level, To edit and 'item' I will have to restore the state of the category first.
  • No be appropriate for complex structures.
  • Using DB over the .net streamwriter or and XML data-store(my first choice) gives Transaction integrity where none would have existed and easier to backup a single file than 5 or six.

Jobs to Come

I still must develop an DB helper class to handle the transaction to the DB file and obviously needs some magic data to test the methods.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , , , ,
Categories:   Projects
Actions:   E-mail | Permalink | Comments (492) | Comment RSSRSS comment feed

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading