in reply to Writing general code: real world example - and doubts!
For perl, I would imagine a system where everything must implement a base Rule object. The engine would create one of each rule and have some sort of "validate" function. Next, wrap whatever framework away from the developer. Your Wrapped framework would have a method for getting data, "get_validated_data" which would take a pointer to your validator configuration as to which object to use. I would then be able to do something ala...
If your developers do code reviews, which they should, any bypassing the system can be slapped down. New validators can be written for everyone to use. Life may be cleaner.. in an ideal world 8)my $frameWork = WrapedFrameWork->new(); my $allValid = 1; my ( $valid, $data ) = $frameWork->get_validated_data("email","typeEma +il"); $allValid &= $valid; if( !$allValid ) { .... }
----
Give me strength for today..
I will not talk it away..
Just for a moment..
It will burn through the clouds..
and shine down on me.
|
|---|