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 more

Flickr + jQuery + Salesforce = Awesome^5 [Part 1]

Being a mathematician, equations like those in the title usually make me wanna poke someone in the eye.. but in this case it’s just too true to not use. My aim over the next two posts is to provide you with the knowledge to,

  1. Consume web services from within the Force.com platform(without WSDLs).
  2. Use web services(we’ll be using the SOAP-based variety), or other agents, as data sources for integration with JavaScript, and in particular, jQuery.

I will cover point 1 in this post, and then bring it all together in a second post which will cover point 2. It’s gonna be a rocky ride, but I’m sure all you cowboys/girls/others can handle it. Just so we know where we want to end up, our final product will look something like this,

Read more

OOP in the Salesforce Cloud – ReCaptcha Revisited

Can I get a OOP OOP?! That’s right folks, OOP is alive and well on the Force.com platform, and over the past few months I’ve had some pretty thrilling experiences implementing projects using those trusted sidekicks Encapsulation, Polymorphism and trusty ol’ Abstraction. There is some pretty sweet documentation on the subject, but I thought I’d demo something supercool I learnt by combining two articles from the Force.com wiki.

Read more