How to create custom controller for a view ?


I want to learn about custom controller. I understand that it is used to hold the context after we navigate away from the view.. but I'm looking for some technical information on this..

1) Can someone please tell me what technical property enables custom controller to hold data for longer time ?

2) Does every standard SAP view have custom controller class ? Can we create our own custom controllers ? If yes, is there any standard SAP class that we can inherit from ? (I did do a where used list on cl_bsp_Wd_Custom_controller hoping to find some info.. but I was unsuccessful)

3) How and where do we link the custom controller class to a view ?

Any document or a pointer(to look at or read) describing how a custom controller is created and used with an example will be highly appreciated.