I have a requirement to implement visualforce Template approach. As part of that I have page1, page2, page3(VF pages). page1 is the starter and composition page which defines content(empty for now) for page2. Again page2 plays the role of composition page here defining content for page3. Page 3 which is a template defines its own content. Content for page2, page3 should be extracted from the controller instance.
Right now 2 instances of controller are defined one in each of page2, page3. Can't we leverage single instance of controller as the controller is executing twice and most importantly it's taking significant time.
This design is based on the principle of inheritance where page3 behaves as the top base page where unwanted content is modified in the child (page2) by overriding with apex:define. Also to be more specific, page1 acts as selector for choosing right template or page.Lets say here it chose page2.