Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]..What should be the maximum number of function in a controller
#1

[eluser]ranjeet_sangle[/eluser]
Hello friends,

I am working on a project in which there are 40 utilities. I am trying to create a single controller class that will handle all these utilities. But I think that this will make the size of the controller class very large. So this may lead to large computational delay. Also I am having a team with me hence different developers will be working on the same project.But with a single controller class this is not feasible.
Can anybody suggest me a solution to this problem?
#2

[eluser]LifeSteala[/eluser]
It sounds like to me these utilities are 'tools' therefore they should be Helpers? Just thinking out loud here...
#3

[eluser]ranjeet_sangle[/eluser]
you can call utilities as a function or a tool.
#4

[eluser]JoostV[/eluser]
Why would you like to place different tools in a single controller? Cramming all this in a single controller will make it bloated, unmaintainable, etc: you pointed out the cons yourself.
#5

[eluser]Zack Kitzmiller[/eluser]
With out knowing more about this project, I'd say one controller per tool. There's no problem with having a large number of controllers.
#6

[eluser]ranjeet_sangle[/eluser]
Thank you sir...!!


That means it simply doesn't matters how many controllers we are using..?

I think I must go for a single controller per tool.

But this will result in creating 40 controllers. Wink
#7

[eluser]JoostV[/eluser]
You can create an unlimited amount of controllers, yes. You can create one per tool, or group the tools into meaningful groups and create a controller per group, for instance
Code:
class User extends Controller
{

    function User ()
    {
        parent::Controller();
    }

    function create ()
    {
        // Create a user
    }

    function delete ()
    {
        // Delete a user
    }

    function edit ()
    {
        // Edit a user
    }

    function show ()
    {
        // Show a user
    }

}
#8

[eluser]ranjeet_sangle[/eluser]
I got you sir..

very much thankful to you




Theme © iAndrew 2016 - Forum software by © MyBB