cancel
Showing results for 
Search instead for 
Did you mean: 

confusion controllers vs subcontrollers

Former Member
0 Kudos

i am just starting to use bsp development, and have been going through the tutorials, etc. i have a question regarding controllers. i have seen several references to sub-controllers, and i am curious as to what makes a controller a controller versus a sub controller...

also, should an applicaiton have a controller for each view, or should one controller handle multiple/all views? i see a lot of conflicting information about this.

i just want to get started on the right path....

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Inhertiance is possible through the concept of using subcontrollers and controllers.

Sub-controllers inherits properties and functions of parent controller .Later on

suncontroller uses same fuctions by calling them or else methods can be overrided

in subcontroller.

I think there is no restriction on one controller should handle many views or one

controller can handle only one view.Depends on requriment,we can use any case.

Thanks

Narendra

Former Member
0 Kudos

Hi David,

What makes a controller a subcontroller is that a subcontroller is created and managed by a (main) controller. In a view, a subcontroller is called by the <bsp:call> tag. Events are redirected to a subcontroller with the dispatch_input method from the main controller.

Indeed, you can use only one controller to handle all views, but the code in this controller can quickly become hard to understand/maintain. I think it is a better idea to have different controllers for an application if there are a lot of views. There should be as much controllers as there are aspects of your application.

Regards,

Tanguy

Former Member
0 Kudos

Hi David,

one controller is sufficient to handle all your views. Think of controller as a connector between your model class and your views. Events are handled via controller and also navigation between your views. The only use of model class should be for business logic and the only use of controller class should be to handle events, navifation & data transfer between views and model.