Welcome Guest, Not a member yet? Register   Sign In
Performance Questions
#2

[eluser]n0xie[/eluser]
[quote author="Jagar" date="1241465724"]
If it's a good idea to have one controller do many functions, how do you organize and/or redirect request to different function within controller. I currently use if and switches in my index function. Good or bad idea.
[/quote]

Since each function in a controller is supossed to be a seperate 'link/page', I don't really understand why you would need a switch in your index to control flow of your application. Whenever I need to control the paths an user can follow it's usually very logical (from a business logic point of view Wink ).

Let's say someone didn't supply the right credentials: you redirect him to a login controller. Or someone didn't supply the form fields you wanted: you redirect him back to the form and tell him what he did wrong. Another frequent issue comes up when a datasource doesn't return any results. You should always check for this, and you might want to move the user back to the page with a message that his 'query' didn't return any results, or give him a default resultset. All of these cases are pretty clear cut and should only take an 'IF' statement to check if certain criteria are met.

Maybe you can supply an example where one would need a switch to coordinate the flow of the application?


Messages In This Thread
Performance Questions - by El Forum - 05-04-2009, 08:35 AM
Performance Questions - by El Forum - 05-04-2009, 08:50 AM
Performance Questions - by El Forum - 05-04-2009, 08:57 AM
Performance Questions - by El Forum - 05-04-2009, 09:12 AM
Performance Questions - by El Forum - 05-04-2009, 09:47 AM
Performance Questions - by El Forum - 05-04-2009, 09:49 AM
Performance Questions - by El Forum - 05-04-2009, 10:07 AM
Performance Questions - by El Forum - 05-06-2009, 11:30 AM
Performance Questions - by El Forum - 05-06-2009, 01:21 PM
Performance Questions - by El Forum - 05-06-2009, 04:30 PM
Performance Questions - by El Forum - 05-06-2009, 06:04 PM
Performance Questions - by El Forum - 05-06-2009, 07:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB