Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which is the Proper Programming Practice
Message
General information
Forum:
ASP.NET
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00959042
Message ID:
00959184
Views:
9
Martin,

>Based on your programming experiences, which is better to make use of hard coding or using switches? From what I've noticed, hard coding is much lighter and requires less code since it is more direct. Switches on the other hand are more flexible and requires less maintenance.
>
>Any opinion on this?

Sure. You should never hard code anything that might at some point need configuration. This means usually connection strings, paths, or anything application specific that the user needs to set.

I use a configuration class for this sort of thing, so it's easy to set this up. You just create properties that you need and the class handles storing and retrieving the values.

I wrote most of this up here:
http://www.west-wind.com/presentations/configurationclass/configurationclass.asp

It's super easy to deal with and consistent across applications both in Web and WinForms apps...

Regards,

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform