Monday, April 9, 2007

Use Cases and Data Compartmentalization

Meant to blog yesterday but fell asleep trying to think of what to write.

I refactored the package structure to resemble an MVC design architecture since I was having trouble separating the view from the data collection. I wanted to have the View able to call the sendEmail method while passing the information it had gathered from the UI (such as email addresses) without needing to touch the data at all. I refactored and moved files around to reflect the data flow more accurately, only to discover after doing so that this is not MVC after all.

At the moment all the view does is gather data from the UI and call some sendEmail method in the mailer. The mailer gathers this data from the view and calls some getEmailBody method in the data manager which returns a String representing the email body. What the mailer doesn't need to know is that this String getting returned is completely made up of html tags. In essence the mailer shouldn't have to touch the data at all either.

All of the data collection and formatting should only be occuring in the data manager. The only thing the data manager may need is the User name, in order to get the names of the projects owned by the user. These projects with their associated data, and the html template page, are the only things the data manager should require (I think). It should take care of all formatting and only need to return a String, which the mailer cannot discern from any ordinary emailBody String.

I think this method of comparmentalizing the data should work out well.

Oh yes and I really need to write a detailed use case for this new module design in order to eventually finish the UI.

No comments: