# Thursday, 29 April 2010

The VMForce value proposition:
  1. Download Eclipse and SpringSource
  2. Signup for a Salesforce Development account and define your data model
  3. Write your Java app using objects that serialize to Salesforce
  4. Drag and drop your app onto a VMWare hosted service to Force.com to deploy
The partnership breaks down as:
  1. VMWare hosts your app
  2. Salesforce hosts your database
The 2 are seamlessly integrated so that Java Developers can effectively manage the persistence layer as a black box in the cloud without worrying about setting up an Oracle or MySql database, writing stored procedures, or managing database performance and I/O.

This is all great news for Java Developers. It's yet another storage option on the VMWare cloud (I'm assuming VMWare remains fairly agnostic beyond this relationship and Force.com becomes one of many persistence options to Spring Source developers).

For larger organizations already using Salesforce but developing their custom Java apps, this opens up some new and attractive options.

Existing Salesforce Developers may have wondered if Java would replace Apex and Visualforce, prompting a Salesforce blog post aptly titled "In case you were wondering...". In short, "no". Apex and Visualforce will continue to evolve and be the primary platform for developing Salesforce native apps. I personally will continue to use Apex and Visualforce for all development when the data is stored in Salesforce unless compelling requirements come along to use VMForce (most likely that have particular DNS, bandwidth, or uptime needs).

So why the partnership between VMWare and Salesforce? When Salesforce announced Apex back in 2007 it was met with broad acceptance, but some common criticisms were:
  • Why another DSL (Domain Specific Language)?
  • Why can't I leverage my existing Java skills to write business apps?
  • Salesforce is written in Java. Can I upload my existing Java apps to the cloud?
These criticisms were coupled with some looming 800 pound Gorillas in the room (Amazon and VMWare) pushing virtualization as the basis for cloud computing while Salesforce promoted the non-virtualized, multi-tenant path to cloud computing.

They both can't be right. Or can they? CIO's are being bombarded with virtualization as a viable cloud computing solution, so I think Salesforce has wisely taken a step back and taken a position that says "We do declarative, hosted databases better than anyone else. Go ahead and pursue the virtualization path for your apps and leverage our strength in data management as the back end".

Over time, the bet is that VMForce customers will also discover the declarative configuration tools for form-based CRUD (Create/Read/Update/Delete) apps can meet the rapid prototyping and development needs of most any line of business apps.

For object-oriented developers, Salesforce provides a persistence layer that meets or exceeds any ORM (Object Relational Mapping) or NoSQL solution. The impedance mismatch between objects and relational databases is widely known, and VMForce solves this problem very elegantly.

I think other ORM Developer communities, such as Ruby on Rails Developers, will appreciate what is being offered with VMForce, prompting some to correctly draw parallels between VMForce and Engine Yard.

In my experience working with Azure, I cannot emphasize enough how difficult it was to work through the database and storage aspects on even the most simplest application design. Sure, C# is a dream to work with (compared to both Java and Apex) and ASP.NET works well enough for most applications, but Microsoft leaves so many data modeling and storage decisions to the Developer in the name flexibility, which ultimately means sacrificing simplicity, reliability, and in some cases scalability.

Some final thoughts, observations and questions on VMForce:
  • Are there any debugging improvements when using VMForce relative to Apex/VF?
  • The connection between VMWare and Salesforce is presumably via webservices and not natively hosted in the same datacenter. Does this imply some performance and latency tradeoffs when using VMForce? (Update: No. Per the comment from David Schach, the app VM is running in the same datacenter as the Force.com DB)
  • Licensing: No idea what the pricing will be. Will there be a single biller or will Developers get separate invoices from VMWare and Salesforce for bandwidth/computing and storage?
  • It strikes me as quite simple to develop Customer/Partner portals or eCommerce solutions in Java that skirt the limitations of some Salesforce license models when supporting large named-user/low authentication audiences. Will Salesforce limit the types and numbers of native objects that can be serialized through VMForce?
  • Will VMForce apps be validated and listed on the AppExchange? If so, will they be considered hybrid or native? What security review processes will be enforced?
  • Why only the teaser? Ending a great demo with "and it should be available sometime later this year" just seemed deflating. I think Business Users and Developers respond to this kind of promotion much differently. It would be far better to leave Developers with some early release tools in hand immediately after the announcement and capitalize on the moment. Business Users, however, can be shown Chatter, and other future release features, to satiate their long term interests.

Update:Jesper Joergensen has an excellent blog post that answers many of these questions. Thanks Jesper!

Thursday, 29 April 2010 14:38:34 (Pacific Daylight Time, UTC-07:00)
# Tuesday, 09 March 2010

If you just want the high level summary, I can spare you the time of reading this lengthy blog article and summarize Chatter in the following image.

Salesforce Chatter is basically Facebook for the enterprise and one of the greatest things to come along since sliced bread (besides Jack Bauer). Chatter is a collaboration platform that supports status publishing and the ability to follow people and objects (Salesforce records).

After seeing a Tweet with instructions to email iwantchatter@salesforce.com to participate in the pilot program, I contacted Salesforce and got on the waiting list. I executed some standard legal agreements (Chatter is still considered pre-launch) and Chatter was enabled in our Salesforce org within a couple days. I would suggest "selling" your org in the body of your pilot program request with facts that might help the already overwhelmed Salesforce staff determine which clients might make the best case studies for using Chatter.

Chatter enables the new UI theme, which I've been requesting for several weeks since the launch of Spring '10. Awesome news since this was not available with the initial Spring 10 rollout.

Setting expectations with users.
I was the eager admin excited to get my hands on new features, then it dawned on me that other users might have questions about the change. In a company of < 10 users, this is no big deal. But I'm guessing a larger org may want to do a more methodical rollout.

After enabling Chatter I sent out an email to everyone simply stating "This is going to rock. If you've used Facebook, then you'll understand what the new feature is about. There's also a new theme activated."

Some Salesforce admins on Twitter have suggested just enabling the new UI, setting off the fire alarm as a distraction, then running out of the building. Whatever works! :-) My feeling is that there should be no delay enabling the new UI. The majority of users will love it.

Email Alerts
One feature that really stands out is the ability to receive an email alert whenever certain events occur. I think this is a smart move on Salesforce's part. Each user has the new ability to enable/disable email alerts under Personal Setup "My Chatter Settings".

As much as Google Wave, Wikis, and other social business software may promote the benefits of replacing email with collaboration platforms, it's just never really panned out. There are just too many Outlook and Gmail users out there with investments in email filters and routing rules for driving business process. I left these features enabled (the default setting).

Based on past experience, I had a concern that Chatter emails might eventually overwhelm my inbox (which I have a particular GTD obsession for managing), so before proceeding any further I created a GMail label and filtering rule specifically for Chatter.

Now all emails from "Salesforce Chatter" automatically get tagged and sorted into their own folder in GMail. The equivalent can be easily accomplished in Outlook Rules. This might be a good tip for Salesforce Admins to share in their Chatter rollout email.

Chatter Settings and Feed Tracking

Administrators can define which objects are enabled for Chatter collaboration and which fields on those objects will trigger automatic Chatter updates.

This is a very simple and easy to use 2 panel user interface with Objects on the left and fields on the right. You select which fields will trigger a Chatter alert when modified. The left panel has an excellent UI element that tells you how many fields are being tracked on that particular object, so you don't have to drill down to each object one at a time to identify feed tracking hot spots.

If you've worked with object history tables in Salesforce, you'll be familiar with what this interface is providing. Now with Chatter, in addition to logging history changes, you're also posting messages to the Chatter stream. History table and Chatter feeds are 2 completely separate features, athough they are semantically the same.

Some objects had feed tracking enabled by default. Most did not. Of the ones enabled, they had 2-5 fields already pre-selected. I could not discern any particular pattern as to how or why certain defaults were configured. I'd say the defaults look "balanced" and it does appear that someone put some thought into a reasonable amount of feed traffic on frequently used CRM object/field combinations. There is a "Restore Defaults" link in the right panel of each object. Clicking these restores the defaults.

People and Profile Tabs
One final Administrative step is to add the People and Profile tabs to your main applications. Just as you can view/manage your profile and find your friends in Facebook, Chatter provides Profile and People tabs to accomplish similar tasks.

Chatter will work without these tabs, but users will only be able to incrementally discover other people who comment on particular objects. I added these 2 tabs to all our applications to get the full benefit of Chatter and apply some consistency in the UI. The People tab provides a list view of all "Colleagues" within the Salesforce Org. The Profile tab allows users to define how they appear to other people; including photo, status, and description.

The "Update Photo" feature with image cropper file is probably one of the first features Chatter users will use on the Profile page.

I found it interesting that I could, as a System Administrator, edit other peoples profiles. That initially struck me as "big brother-ish" since I'm so accustomed to passively using social media platforms, and not actually administrating them. The Chatter Profile pages also contain a link to the existing User Detail page template, which I know Admins will appreciate.

One thing I really like about Chatter is that Salesforce didn't complicate the configuration by providing a full access control list (ACL) wrapper with specific Read/Write permissions per object. If you can view a object, you can jump right in and chime in on Chatter without wondering if you only have read only permissions to watch what other people are saying, but not be able to contribute yourself.

Granted somebody at some time likely raised the concern "But what if some CEO only wants employees to read his status messages and not comment on them?". I'm glad Salesforce resisted that level of access permissions in Chatter.

The first introduction to "Following" will likely be on the People page where users are given the opportunity to subscribe to what particular people are posting as their status message. In such a small org, such as ours, you can follow everyone with just a few clicks. But it made me wonder if a "Follow All" button might be handy for larger orgs.

Chatter uses what is commonly referred to as an "asymmetric follow" architecture. In other words, I can follow you but you don't necessarily have to follow me. This is how Twitter works. Facebook, however, uses a symmetric system where we must both mutually agree to be friends to follow each others posts and activities.

It makes sense Salesforce would not want to use Facebook's symmetric following because it's assumed right out of the box all users are colleagues in a single organization. You only need to decide which colleagues activity you want in your stream.

Maybe one day when Chatter is enabled in a Salesforce-to-Salesforce configuration it may be beneficial to limit who is following your activity (for example, would Michael Dell want all his suppliers following his Chatter simply because a SForce-to-SForce bridge was enabled? I'd guess not.... but only Michael can answer that question).

I can see dialogues taking place in the workspace along the lines of "Yeah, I track that industry pretty closely. Follow me on Chatter if you want more information".

Using Chatter
I never really used the Salesforce Home page for much more than reviewing my Tasks lists. 99% of my time in Salesforce has aways been working in records. But that now changes with Chatter since the Home page is the central hub for aggregating all the people and content you are following. The home page is now "the business stream" and the potential opportunity for exploiting its power is huge.

(Note about Screenshot: Yes, Chatter can be pretty boring when you're the first person using it. Fortunately, I have the StanBot API User to keep me company (future post) until adoption catches on with the others :-) )

The first time you drill down on any record details with Chatter feeds enabled you're prompted with some next step options and the option to view a 2 minute video on Chatter.

As developer, we can all appreciate the detail that goes into not only developing a new feature, but also deflecting support calls and questions with simple, easy to understand tutorials and documentation. I give Salesforce 5 out of 5 stars here.

Chatter is so well designed and so very similar to Facebook and other social apps, that I'd be surprised if 80% of Salesforce users couldn't click on "Close", skip the tutorials, and figure out most of Chatter on their own.

Collaboration and Development In The Cloud
While there are many cool features in Chatter, the fact that this platform is hosted in the cloud and can be extended to include pretty much any web service into the business stream is what makes it so powerful. There is no software to install, any Admin can setup Chatter in just a few minutes, and collaboration is baked into the platform as a core feature (ie there's no additional license fee to use Chatter).

Part 2 of my Chatter review will get into the specifics of Chatter enabling existing Salesforce apps and taking a peek into the Chatter API and new types of apps that can be developed. Stay tuned!

Tuesday, 09 March 2010 13:55:26 (Pacific Standard Time, UTC-08:00)
# Thursday, 25 February 2010

The eXtreme Programming Portland user group, XPDX, is going through some changes. Several members want to change the name to something like the Portland Agile Developers Group to reflect the group's openness to a variety of development methodologies.

I happen to love XP and have used it since 1999 as a general framework and reminder of key principles to keep in mind on any software project. XP, Scrum, Kanban, and every other agile development methodology I've researched have so much in common that I felt it was easier and more pragmatic to just stick with a single name rather than appear to be chasing the latest fad.

But Agile has become a very academic topic and apparently the minor differences between the various methodologies are not to be dismissed lightly.

This forced me to reflect on why I, and many many other people, were initially attracted to XP and why interest has waned. The answer suddenly became very obvious to me.

eXtreme Programming, at one time, promoted "extreme" ideas that challenged the status quo. It was easy to fill a room with 50+ people who wanted a revolution. And the revolution was successful. Most XP best practices are no longer "extreme". We take many XP and Agile practices for granted now. In fact, Agile is now the new status quo!

It's actually pretty boring to attend or present at an agile group meeting and rehash the same ideas. Attendance is way down. So, if changing a group name is a branding effort to increase attendance, I don't believe that will succeed. Sure, it may draw 3-5 more people like an "Under New Management" sign outside an old restaurant, but it won't change the fact that the same old stuff is on the menu.

An aura of infantilism is creeping into Agile. Agile Coaches and Practitoners now seem more like parents than mentors. Agile meeting topics are increasingly about games and tactics that have short term productivity gains of bringing teams around a single purpose. When I ask presenters about the longevity of their agile teams or the software they produced, it's rare to encounter an answer over 6 months, leading me to believe many agile projects are getting by on the initial "honeymoon" inertia before reality sinks in. All successful software projects are ultimately faced with what seems like a daunting and unachievable task that puts tremendous pressure on the team. What a team does at that inflection point is the true test of "agility".

In many cases, Agile practitioners don't even code or have not evolved their skills beyond 1999 object oriented programming techniques. If practitioners spent more time coding, they would have a sense of the new revolution and extreme ideas that are brewing.

OK. So that's out of the way. My intent is not to push people away, but to pull them towards a new way of thinking. I titled this post to promote forward thinking, so let's switch gears.

If XP was extreme in 2000 by virtue of challenging the status quo, then what is extreme in 2010? Many of the following ideas may be tough to accept. If any of these ideas make you feel uncomfortable, threatened or obsolete, then you may be part of the current status quo. But trust me, these ideas are getting traction and are not going away. The sooner we as a development community embrace these changes, the more relevant our meetings will become.

"Feature Democratization"
XPs core tenet of achieving customer satisfaction through customer driven feature stories has evolved in 2010 to make use of idea voting sites. The customer is now the product manager and has become very involved with providing ideas, feature requests, and UI mockups.

"The 24 Hour Iteration"
The recent launch of Google Buzz had millions of people up in arms over privacy concerns while others applauded the new feature. Google had to act fast and update the software within 24 hours in response to the first wave of customer feedback. This was not a "patch". This was an extremely compressed iteration backed by a process that supports this kind of change. Developing in the cloud is living on the extreme.

"Writers Write"
Software Development is not a 9 to 5 job. Many people go home then build websites for their churches, contribute to open source projects, or just simply enjoy programming over the weekends. A personal growth goal for some Developers is to develop their own style, much like a literary writer. The days of seeking validation from a venture capitalist to pursue an idea are over. We don't all need to conform to a universal set of rules or conventions when writing software.

"No Outsourcing"
Great software development projects are not outsourced. No more than a great video game title, movie, song, or book gets outsourced. Let's get over the false idea that software development is an easily outsourced task and embrace the uniqueness and originality any person or team can contribute.

"No SQL"
Many greenfield projects are breaking away from the long history of using relational data stores. The NoSQL movement is developing applications faster and more scalable by sacrificing relational features like JOIN. Many NoSQL projects have characteristics similar to early object oriented database solutions.

"All Javascript All The Time"
A little Javascript in a product like Google Maps can go a long way. Taking this to the extreme and developing entire products in Javascript, such as Google Apps and Microsoft's upcoming Web Office 2010, requires a different approach to software development. New layers of abstraction like GWT, Closure, and JQuery should be explored and embraced by anyone working on web applications.

"See The Forest For The Trees"
Really not an extreme idea, but one I think has been lost. When agile discussions quickly devolve into focusing on a small detail and make an academic issue out of the process, the survivalist in me says "Yeah that's great, but let's not lose sight of the big picture". Maybe the "big picture" just can't be coached. A good team needs to internalize the value being received by the customers and, ideally, be a consumer themselves of what they're developing. How do people discover software? What compels them to try it? What is the install/config process like? Why would they stay engaged? Can game mechanics can be added? How can the customer be given a voice and opportunity to participate in the evolution of the software? For agile teams, this process is "fun". For other teams, the Developers actually need to be told what to do, how to do it, and when to deliver it.

"Work from home / Distributed collaboration"
The essence of pair programming is to collaborate with other Developers on a single task. In reality, most software is not written with 2 Developers physically in the same space. The Internet allows for more distributed collaboration opportunities in 2010. How are successful projects taking this to an extreme and using this to their advantage?

"Quit Unit Testing and Write Better Code"
Unit testing is largely used in object oriented projects as a check on the side effects and loose contracts inherent in OOP. Design by Contract and Functional Programming have evolved (actually FP has been around quite awhile) to address these quality issues up front. One extreme idea is to "not do unit testing" and actually improve the quality of code by removing side effects with functional programming and using design by contract for runtime enforcement. Several agile projects with tons of unit tests just end up being "well tested crap". What's wrong? Unit testing is not a silver bullet. Let's get that out on the table.

"Pair Programming Sucks"
Let's face it. When 2 people with compatible coding and social skills work together, they'll produce something well beyond what they'd create on their own. If the pair is not compatible, then the code will suffer and they'll possibly make life worse for others around them. You can't "coach" people to work together. Dogmatic pairing of programmers cannot be universally applied to all projects. Good teams and collaborations take time to develop.

"Develop In The Cloud"
Do you really need to spend an iteration "0" setting up servers, getting everyone's desktop on the same version, and installing a database? Once the project goes live do you want to take a 3am call to address a load balancing bug? If you encounter any measure of success, are you really prepared to scale and meet the demand of that success? The status quo says "Yes, how else will get ROI from the datacenter we just built?". The extreme programmer would say "No way. Writers write. You handle the rest".

"Federated Cloud"
We've all been conditioned to avoid "Vendor lock-in" when making a significant investment in IT infrastructure, but are we making the same mistakes as more software development moves to the cloud? Will all software eventually run on one of 4 large datacenters? The cloud was built on open source. Now the open source movement needs to be revitalized in the cloud, move beyond HTTP/SMTP, and federate a more abstract layer on the Internet using open source.

"Bootstrap to Success"
How relevant is a Computer Science degree or VC funding in your decision to using software? Anyone can develop great software and become financially independent using proven bootstrapping techniques and the Internet as a distribution channel.

I've itemized just over a dozen extreme ideas here. There are many more. Do XP groups need re-branding or does XP itself need to be redefined to take on new extremes? Should we recalibrate and invoke XP's FixIt rule?

If even one other person in Portland wants to discuss these ideas, I'd be happy to meet over a Beer (or two) to explore the "new extremes" on a regular basis.

Comments? Ideas? Suggestions?

Thursday, 25 February 2010 12:08:06 (Pacific Standard Time, UTC-08:00)
# Monday, 22 February 2010

I'm presenting "Developing In The Cloud" at the Portland JavaScript Admirers Group this month. If you're in Portland this Wednesday, February 24th, 2010, come check it out 7pm-10pm!

The talking points are below. There'll be several visual examples and live coding demonstrations.

Monday, 22 February 2010 10:40:29 (Pacific Standard Time, UTC-08:00)
# Sunday, 21 February 2010

There are several bank specific rules for validating credit cards, but all card numbers can be validated using the Luhn algorithm. The Luhn algorithm, aka the Luhn formula or "modulus 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers.

It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from collections of random digits.

Programmers accustomed to using '%' as a modulus operator need only to shift gears slightly and use the Math.mod(int1, int2) library function when working with Apex.

public static boolean isValidCheckSum(List<integer> numbers){
	integer sum = 0;
	integer len = numbers.size();
	for (integer i = len - 1; i >= 0; i--)
		if (math.mod(i , 2) == math.mod(len,  2) )
			integer n = numbers[i] * 2;
			sum += (n / 10) + ( math.mod(n, 10));
			sum += numbers[i];
	return ( math.mod( sum, 10) == 0 );
Sunday, 21 February 2010 12:15:00 (Pacific Standard Time, UTC-08:00)
# Tuesday, 16 February 2010

I spent a few hours tackling this problem, so hopefully this blog post will spare someone else the difficulty of using Salesforce Spring '10 features before it is broadly released.

Spring '10, aka version 18, is a big release for Salesforce Developers. The current version of Eclipse Force IDE defaults to using the version 16 API.

Once Spring '10 was installed on my org (NA1) I committed to using the v18 features on a couple new projects. Unfortunately the Spring '10 release hit a snag, so now the release is being staggered over 30-45 days and the new Force IDE release has been put on hold.

Fortunately, there are a couple workarounds to using the v18 API and features today.

Option 1)
a) Create an Apex class as you normally would in Eclipse and accept version 16 as the default.
b) Eclipse will create a second file next to the class with a 'meta.xml' extension.
c) Edit the -meta.xml file by changing the version to 18 then save.

Option 2)
a) Create an Apex class through the Salesforce browser interface but do not accept the default version 18. Instead, select version 16.
b) Open the Salesforce project in Eclipse and confirm the Apex class is available in the IDE (the current IDE apparently won't automatically sync with classes > v16. At least that was my experience).
c) Back in the Salesforce browser, change the version from 16 to 18.

Finally, depending on which approach used, you'll need to synchronize the Eclipse IDE with Salesforce servers using either the "Deploy to" or "Refresh from" server options by right clicking on the class and selecting from the Force.com option. (Option 1 requires "Deploy to". Option 2 "Refresh from").

Hope this helps!

Tuesday, 16 February 2010 18:28:19 (Pacific Standard Time, UTC-08:00)
# Tuesday, 02 February 2010

Every once in awhile I run into a requirement when using Apex where I think there must be a real obvious way to do something, only to hit a wall and decide to develop the functionality myself.

When this happens, the result either ends up being:
a) I later discover there actually is a faster/better way to do something and I feel stupid for taking the NIH path (Not Invented Here).
b) The functionality really is missing and the effort invested turns out to be well spent.

Let's just hope the time spent on this wrapper class is in the latter category :-)

In this use case, a custom database object is wrapped in an Apex class that abstracts the underlying object properties and provides some methods. One of the properties (a database custom field) is a multipicklist that is stored in semicolon delimited format, but is better represented in object-oriented terms as a List. Methods for Adding and Removing items from the list are also needed.

public class Foo{
	private Foo__c m_record = null;
	public Foo(Foo__c record){
		m_record = record;

	private MultiSelectProperty m_categories = new MultiSelectProperty();
	public List<string> Categories{
		get{return m_categories.ToList(m_record.Category__c);}
	public void AddCategory(string category){
		m_record.Category__c = m_categories.Add(m_record.Category__c, category);
	public void RemoveCategory(string category){
		m_record.Category__c = m_categories.Remove(m_record.Category__c, category);

The MultiSelectProperty class is defined here. The unit tests should help tell the story on how it can be used and the assumptions it makes.

//Manages semicolon-delimited multipicklist data. 
global class MultiSelectProperty {
	public List<string> ToList(string storedValue){
		List<string> values = new List<string>();
		if(storedValue == null || storedValue == '')
			return values;
			string[] splitValues = storedValue.split(';');
			for(string v : splitValues){
				if(v != null && v != '')
			return values;
	public boolean Contains(string field, string value){
		List<string> values = this.ToList(field);
		for(string v : values){
				return true;
		return false;
	public string Add(string field, string value){
		if(field == null)
			field = '';
		if(value == null || value == '')
			return '';
		if(this.Contains(field, value))
			return field;
			return field + value;
			return field + ';' + value;
	public string Remove(string field, string value){
		if(field == null || field == '')
			return '';
		if(value == null || value == '')
			return field;
		if(!this.Contains(field, value))
			return field;
		List<string> values = this.ToList(field);
		string formattedFields = '';
		for(string v : values){
			if(v == value)
			formattedFields += v + ';'; 
		return formattedFields;		
	@IsTest public static void tests(){
		final string SINGLE_VALUE_NULL = null;
		final string SINGLE_VALUE_EMPTY = '';
		final string SINGLE_VALUE = 'first option;';
		final string SINGLE_VALUE_EMPTY_TRAIL = 'first option';
		final string DOUBLE_VALUE = 'first option;second option;';
		final string TRIPLE_VALUE = 'first option;second option;third option;';
		MultiSelectProperty categories = new MultiSelectProperty();
		System.assert(categories.ToList(SINGLE_VALUE_NULL).size() == 0);
		System.assert(categories.ToList(SINGLE_VALUE_EMPTY).size() == 0);
		System.assert(categories.ToList(SINGLE_VALUE).size() == 1);
		System.assert(categories.ToList(SINGLE_VALUE_EMPTY_TRAIL).size() == 1);
		System.assert(categories.ToList(DOUBLE_VALUE).size() == 2);
		System.assert(categories.ToList(TRIPLE_VALUE).size() == 3);
		System.assert(categories.Contains(SINGLE_VALUE, 'first option') == true);
		System.assert(categories.Contains(SINGLE_VALUE, 'second option') == false);
		System.assert(categories.Contains(DOUBLE_VALUE, 'second option') == true);
		System.assert(categories.Contains(DOUBLE_VALUE, 'third option') == false);
		System.assert(categories.Contains(TRIPLE_VALUE, 'first option') == true);
		System.assert(categories.Contains(TRIPLE_VALUE, 'second option') == true);
		System.assert(categories.Contains(TRIPLE_VALUE, 'third option') == true);
		string fields = categories.Add(SINGLE_VALUE, null);	
		System.assert(categories.ToList(fields).size() == 0);
		fields = categories.Add(null, null);
		System.assert(categories.ToList(fields).size() == 0);
		fields = categories.Add(null, '');
		System.assert(categories.ToList(fields).size() == 0);
		fields = categories.Add(SINGLE_VALUE, '');
		System.assert(categories.ToList(fields).size() == 0);
		fields = categories.Add(SINGLE_VALUE, 'second option');
		System.assert(categories.ToList(fields).size() == 2);
		System.assert(categories.Contains(fields, 'second option') == true);
		fields = categories.Add(SINGLE_VALUE_EMPTY_TRAIL, 'second option');
		System.assert(categories.ToList(fields).size() == 2);
		System.assert(categories.Contains(fields, 'second option') == true);
		fields = categories.Add(DOUBLE_VALUE, 'second option');
		System.assert(categories.ToList(fields).size() == 2);
		System.assert(categories.Contains(fields, 'second option') == true);
		fields = categories.Remove(null, '');
		System.assert(categories.ToList(fields).size() == 0);
		fields = categories.Remove(null, null);
		System.assert(categories.ToList(fields).size() == 0);
		fields = categories.Remove(SINGLE_VALUE, '');		
		System.assert(categories.ToList(fields).size() == 1);
		fields = categories.Remove(SINGLE_VALUE, null);		
		System.assert(categories.ToList(fields).size() == 1);
		fields = categories.Remove(SINGLE_VALUE, 'second option');
		System.assert(categories.ToList(fields).size() == 1);
		System.assert(categories.Contains(fields, 'second option') == false);
		fields = categories.Remove(SINGLE_VALUE, 'first option');
		System.assert(categories.ToList(fields).size() == 0);
		System.assert(categories.Contains(fields, 'first option') == false);
		fields = categories.Remove(TRIPLE_VALUE, 'first option');
		System.debug('results from remove ' + fields);
		System.assert(categories.ToList(fields).size() == 2);
		System.assert(categories.Contains(fields, 'first option') == false);
		System.assert(categories.Contains(fields, 'second option') == true);
		System.assert(categories.Contains(fields, 'third option') == true);
Tuesday, 02 February 2010 12:23:21 (Pacific Standard Time, UTC-08:00)
# Saturday, 30 January 2010

Have you ever wondered about the "priority" field on support Cases? It makes sense for internal use, but I've never seen a priority other than "High" when the option is given on customer portal Web-to-Case forms. :-)

Saturday, 30 January 2010 16:27:09 (Pacific Standard Time, UTC-08:00)
# Tuesday, 26 January 2010
(Note: This blog post is based on an idea I have for setting up a non-profit dedicated to promoting the Creative Commons licensing model for music using cloud infrastructure. I may revisit and modify this post periodically as the model gets fleshed out.)

As a musician growing up in the 80's, the "hip" thing to do was sampling other works and incorporating them into new arrangements. It was, and still is, a very creative and rewarding process that produces what are commonly referred to today as "mashups". I typically used Jazz samples. Others, like Vanilla Ice, used more recognizable samples from artists like Queen and David Bowie.

The artists of the sample source rarely received royalties for the redistribution of their work. Eventually, litigation started and a new precedence became established that prevented the creation of new works from existing works without the owners consent.

I had no problem with the concept of attributing other peoples work or sharing in any commercial success as a result of repurposing work into my own. I got in the habit of working with the Harry Fox Agency before pursuing such projects and budgeting appropriately for using samples. But still, artists (and most their publishers) had to be "pulled" into remixing opportunities.

Some visionary artists, like Peter Gabriel, were going out of their way to re-mix and "push" their samples to us and gave control of the faders to remix their songs into new and unimaginable soundscapes.

Lawrence Lessig's work "Remix" touched on the very heart of this issue and several questions are being raised about the future of music in light of the entertainment "cloud".

Is not the creative work of Danger Mouse's (probably not his real name) Grey Album a brilliant piece of creative work and masterpiece in it's own right, even though it is a mashup of existing digital media?

Should a parent be penalized for adding background music to the video of their childs 5th birthday and publishing it to YouTube?

Would a song like Chris Brown's 'Forever' had achieved such stellar commercial success had it not been viewed on YouTube over 40 million times in a non-commercial use?

There is a solution to this problem. The Creative Commons was established as a nonprofit corporation dedicated to making it easier for people to share and build upon the work of others, consistent with the rules of copyright.

They provide free licenses and other legal tools to mark creative work with the freedom the creator wants it to carry, so others can share, remix, use commercially, or any combination thereof.

To truly embrace the cloud and the Creative Commons involves:
  • Artists and labels rethinking the publication of their works and undergoing a 2.0 release of their works as reusable samples for use in other works.
  • Artists allowing non-commercial use of their works and defining the terms of commercial use.
  • Mashup artists attributing works to other artists and participating in the re-distribution of works through both commercial and non-commercial channels.
There are those that oppose this model.
  • Performance Rights Organizations (PROs) like BMI and ASCAP are entrenched in securing performance royalties on-behalf of commercial artists.
  • The ability for artists to allocate ownership percentages to studio musicians and other contributors threatens the traditional 50/50 Publisher/Artist model in common use today and would displace traditional royalty accounting systems.
  • Commercial Music labels are wedded to decades-old formulas that control the 360 degree image and distribution of an artists work.

To make this work:
  • New publishing and accounting systems are required that allow artists to offer the equivalent of fully vested 'stock options' on works.
  • New mashup publishing systems that allow original and mashup artists to negotiate the percentile distribution of commercial redistribution revenue (for example, an artist may use 5 samples in a song, giving each artist 10% and keeping 50% for the new work. The other 5 artists should have a voice in accepting proposed terms).
  • Artists must consider bypassing traditional "record deals" and work with progressive publishers.
  • Artists must write-off the non-commercial use of their music as a marketing expense.
  • Artists must package their work for convenient use by mashup artists and editors.
  • Consumers and Mashup Artists must attribute use of all works to the original artist.
  • It must be convenient for a Consumer or Mashup Artist to register their new works for commercial use and revenue must be quickly, easily, and fairly redistributed.

Tuesday, 26 January 2010 16:03:30 (Pacific Standard Time, UTC-08:00)
# Monday, 18 January 2010

Apex is a programming language supported by the Force.com platform.

A fluent interface is a way of implementing an object oriented API in a way that aims to provide for more readable code.

An example of a fluent interface looks like:

Contact c = new Contact();
ITransaction trx = new FluentTransaction()
		.Initialize(c, 5.0)

Transactions are a good use case for implementing a fluent interface because they often execute the repeated steps of initializing and validating input values, executing, and logging data. An API designer can expressly define these methods in an interface using Apex (very similar to Java and C# interfaces). When implementing a transaction object, the compiler will check to ensure the proper interfaces are implemented.

A fluent interface is normally implemented by using method chaining to relay the instruction context of a subsequent call. Generally, the context is defined through the return value of a called method self referential, where the new context is equivalent to the last context.

public class MethodChaining {
	public interface ITransaction{		
		ITransaction Initialize(Contact c, double d);
		ITransaction Validate();
		ITransaction Execute();		
		ITransaction Log();
		ITransaction Finish();
		boolean IsValid();
		boolean IsSuccessful();
	public class FluentTransaction implements ITransaction{
		private Contact m_contact;
		private double m_amount;
		private boolean m_isSuccessful = false;		
		private boolean m_isValid = false;
		public ITransaction Initialize(Contact c, double d){
			m_contact = c;
			m_amount = d;
			return this;
		public ITransaction Validate(){
			//Validate the m_contact and m_amount inputs
			//Setting this to false will instruct other execution chain methods to halt
			m_isValid = true; 
			return this;
		public ITransaction Execute(){
				// Execute the transaction here
				m_isSuccessful = true;
			return this;
		public ITransaction Log(){
				//Add any transaction audit logging here
			return this;
		public ITransaction Finish(){
				//Finalize method. Manage any required cleanup
			return this;
		public boolean IsValid(){
			return m_isValid;
		public boolean IsSuccessful(){
			return m_isSuccessful;
	public MethodChaining(){
		Contact c = new Contact();
		ITransaction trx = new FluentTransaction()
			.Initialize(c, 5.0)
			//Do something
			//Do something else

Monday, 18 January 2010 15:06:41 (Pacific Standard Time, UTC-08:00)