tag:blogger.com,1999:blog-7944666952015351059.post3105117896018285506..comments2023-08-28T03:12:16.536-07:00Comments on The Rich Blog: MAD About Code! :)Richhttp://www.blogger.com/profile/10644583780793852011noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-7944666952015351059.post-64382439478704890652012-04-13T06:30:54.506-07:002012-04-13T06:30:54.506-07:00Hi Nathan, I was figuring that eliminating 50 cfif...Hi Nathan, I was figuring that eliminating 50 cfif statements would put the new code in the fast lane. Yes, we do Canadian provinces & French, I just kept this example simple. I kbow how to justify the code, and speed is not one of them. :(Richhttps://www.blogger.com/profile/10644583780793852011noreply@blogger.comtag:blogger.com,1999:blog-7944666952015351059.post-7601315186327719532012-04-12T17:17:24.708-07:002012-04-12T17:17:24.708-07:00Rich, you're asking something dynamic to be fa...Rich, you're asking something dynamic to be faster than something static... let me put this another way. I have an HTML page that has the word "hello" on it. Compare that to a CFM page that has #hello#. There is no way that your cfm page is going to be faster than your html. Make sense? So when you make your form field more dynamic, you should, by all means, be making it slower. That's the nature of the beast.<br /><br />Now let me point out a couple things. First, the speed difference is negligible. Also, with debugging on, it is undoubtedly slower than it will be in production. There is no way any user will realize the difference between the two pages. Second, your form is now data-driven, and the data is reusable. You can tuck that aryStates (the data) away in a CFC or an include and re-use it anywhere you need. This is a very good thing. Third, your form field is now dynamic, so say one day you have to add Canadian provinces, you are already halfway there. Fourth, you have reduced complexity - what used to take 54 lines, is now 5 lines, not including a call to get the data from somewhere. This means that if you want to modify the way the select works, like style each option element or something, you don't have to change it 50 times, you just have to change it once.<br /><br />This is the magic of programming, it costs CPU cycles but you've made your application better. No doubt.Nathan Strutzhttps://www.blogger.com/profile/13707916254833023742noreply@blogger.comtag:blogger.com,1999:blog-7944666952015351059.post-81526319839182078072012-04-12T17:16:13.359-07:002012-04-12T17:16:13.359-07:00You're worried about .016 seconds?You're worried about .016 seconds?Tony Nelsonhttps://www.blogger.com/profile/17222036859676784775noreply@blogger.com