How NOT to Code - Challenge 16
Been busy doing a IP address switch over at work, which naturally caused me to find more things to rant about ;)
If you are directly calling an IP address in any manner in your coding, PLEASE STOP ;)
No I'm serious. Yes, IP changes are rare but not unforeseeable. By basing any programming logic on an IP address, you have made your code extremely fragile. to any type of change What's worse is when I see it baked into Flash/Flex apps. Typically the client doesn't have the source code and they end up SOL. In most cases, it's completely superfluous - just make a relative call and the code becomes very flexible to domain name or ip changes.
If you must use an IP or domain name in your coding, put it in a config file outside of the compiled swf. This is specially true for the Flash/Flex world.
You might even go an extra step and be more critical about calling the CGI variables directly. Sami Hoda has an interesting post about using a CGI facade - http://www.bytestopshere.com/post.cfm/cgi-facade-why-you-should-use-one. This is a very important concept of you ever intend to grow the site's infrastructure with clustering or reverse proxies.