Wednesday, January 7, 2009

ServerWeave progress

Unfortunatly I'm falling way behind schedule.

The biggest barrier is data validation. There's just so much of it to do and I lost track of how to properly organize the code for it. It's turned into a real mess and I need to try and clean it up or if I go on it will only get worse.

The issue with data validation is that the same type of data needs to be checked, but all in different ways. So I find myself repeating code all the time but with slight changes.

For example when a new virtual host is set, I have to first make sure it's a valid domain string, then I have to check that no virtual host entry exists, then I have to check that if it's a sub domain, that the user owns the domain etc... that's just for adding a new virtual host.

Now what if I want to edit a virtual host? It's nearly the same, BUT, I cant check if it already exists, because obviously it will exist considering it's being edited. So that stops me from reusing code by writing a function or class.

You get the idea.

So yeah, it's a mess. At this point I figure if I can land myself out of the data validation mess by end of tomorrow I'll be happy. Really, it has been slowing me down for a while now. Everytime I add a new field, turns out I need to validate it, in some different way. Makes for really messy form submission code. There's got to be a way to make this cleaner.

No comments: