Grant Palin
05-20-2004, 06:44 PM
I have a main method in my ASP page to process user input from a form. I delegate some of the repetitive work to helper functions or subs. In those helper methods, is it appropriate to use the Request or Response objects (Request.QueryString, Response.Write)?
I am trying to simplify my code as much as possible. I know the importance of code reuse and cohesion and so on. In the form processing method, should I get necessary values from Request, and pass those local values to the helper methods? Or is it okay for the helper methods to interact with the Request object directly? Same for Response; can I just output directly from the helper methods, or should I return the necessary information to the main methods to output themselves?
If it makes a difference, I'm doing output from a database, and am thinking about doing a seperate method to create queries for various combinations of data. From that method, I thought to call a helper method to handle the actual query execution and output.
Am I on the right track, or do I need to rewrite my code some?
Woohoo! Passed 500 posts!
I am trying to simplify my code as much as possible. I know the importance of code reuse and cohesion and so on. In the form processing method, should I get necessary values from Request, and pass those local values to the helper methods? Or is it okay for the helper methods to interact with the Request object directly? Same for Response; can I just output directly from the helper methods, or should I return the necessary information to the main methods to output themselves?
If it makes a difference, I'm doing output from a database, and am thinking about doing a seperate method to create queries for various combinations of data. From that method, I thought to call a helper method to handle the actual query execution and output.
Am I on the right track, or do I need to rewrite my code some?
Woohoo! Passed 500 posts!