Archive for December 2009
Salesforce: Polymorphism driven by Apex class inheritance
Polywhatsthatnow? Polymorphism ” is the ability of one type, A, to appear as and be used like another type, B.”
It is a facet of OOP and can best be described using the good ol’ example of the ‘Shape’ class problem (thanks Java!). Let’s suppose we’d like to create an application that drew a number of shapes on a page. At the time of analysis we know that we want to immediately support circles, but to future-proof our application we need to support the drawing of any shapes. Being Pretty Darn Good Developers(tm) we realise we should create a Shape class that has a single method used to draw itself, and any specific shapes should be derived from this class, and override that method. Make sense? Didn’t think so. Read the rest of this entry »
Howto: Communicate between template- and inner- pages.
This post is as much about me asking a question as it is about providing a solution, so don’t let me down community. I got your back, but you’ve got to scratch mine too.. A little to the left, ah yeah, that’s it. The topics in question here are page templates, their controllers, and the pages (and the controllers) that use the template. But first let’s start with what I’ve discovered.
I like using page templates, they make my life easier. If I’m creating a site I probably want to have some consistency of navigation, page header, search etc. across all my web pages. So let’s assume I have the following setup:
1. A VisualForce page I use as a template.
2. A controller for this page that handles navigation, searching etc.
3. Several ‘inner’ VisualForce pages that use this template.
4. A controller for each of these pages. Read the rest of this entry »