Design Question - Removing Data dependencies from code

bryggya
02-11-2008, 03:11 PM
Question regarding logic that has built in data dependencies: For example, explict user definitions that are enumerated with integers (userid = 1 etc). Another dependency maps constants that are passed values from an initialization file. (Campus1_Student_Home_Directory=server1.oncampus.local - at runtime)

The user enumeration limits the number of fields to 9, would like to be able to make this unlimited based on the number of elements imported into active directory.

The constants are initialized then processed when student data is being imported into active directory. Right now they're processed within a select statement, should I just populate an array from the ini file and process every parameter and value?

Removing the dependencies will make the service more flexible to any data changes or server redeployments, as the current version limits assignments to current campuses. No new campuses can be added - or removed.

Thanks for any input

Gruff
02-11-2008, 05:33 PM
There are times and places that Enumeration can make code more understandable. It is not a cure for all problems.

Can you boil your question down to one sentence? Not sure what you are asking for.

~T

bryggya
02-12-2008, 12:11 PM
Well, I need to remove hard coded literals and replace the logic to process parameters passed from configuration files.

This will make the application more versatile so any new or modified values can be passed without rewriting the code.

Right now, the logic includes a specific campus name to perform the action of setting the users home directory based on data being imported from a csv file. I'd like to have the code take any parameter=value set and process it. The problem is there are new campuses being built, so any user could be located out of the five current sites. Just for the record, I had asked the development team to do this but it didn't happen. Now I'm stuck trying to correct the problem.

Hope that makes sense, tossing this question out to see if anyone else has dealt with an issue like this, instead of reinventing the wheel.

Gruff
02-12-2008, 12:47 PM
What do you need help with? General program flow? Writing Code? Concepts?

If your asking whether your program should use enumeration at all... I guess that depends entirely on whether it buys you anything.

If you need ranking or sorting of items as in enumerated playing cards or months of the year then I'd say yes you need them. If it is always a case of simple equallity then select case with text not unheard of. Another case for using enumeration is comparison speed, but for moderately sized chunks of data that is usually not a problem.

~T

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum