Sunday, March 21, 2010

Why don't we have a StringBuffer in Apex ???

Dream 20

I used to wonder why don't we have a class like StringBuffer in Apex?? I have used String Buffers in Java (not so long ago) and we have debated a lot those times as to whether we wanted to do a (a+b) operation or a. append ("b"). Let’s review the importance of StringBuffer once again ...

1. Code written using a StringBuffer for concatenation is technically proven to execute faster than the code that uses String for concatenation. It’s all drilled down to the less number of byte codes getting executed when we use StringBuffer.

2. Code written using StringBuffer is easier to debug/maintain. Particularly, when we have those large dynamic SOQLs in our triggers or apex classes.

3. The underlying language for Apex is Java. This being the case, it should be an easy step for Salesforce to expose the StringBuffer API.

I have also put this as an Idea on the IdeaExchange. I would appreciate if the people reading this blog can vote for this Idea. Click here to help me & other fellow Apex devs realize this dream :)

Monday, February 15, 2010

What does HTML5 mean to Force.com ???

Dream 19

There's a lot of buzz around HTML5 making into the W3C recommendation stage later this year. Even Steve Jobs has recently said, HTML5 would kill Flash very soon and hence Apple is not much concerned about its current lack of support for Flash in most of its gadgets. Different people have different thoughts around the evolution of HTML5 but these are what I think would be the minimum impacts/advantages for the Force.com folks.
  • Visualforce APIs would get richer to support the new HTML5 tags such as video, audio, canvas, dialog and many more.
  • I think Drag & Drop and HTML containers would be the deal breaker for us. Again, this would be part of VF enhancements.
  • I also have a sneaky feeling that Force.com developers would be given the luxury to contribute to Visualforce API development. I know I'm dreaming too much... lol.
  • There should be no big enhancements to Apex, because HTML5 is all about the presentation layer.
  • Last but not least Force.com end users need not install flash plug-ins on their browsers if their Salesforce Org. uses flash/flex driven interfaces.
I don't think all these would happen over night. It would be a slow transition but I agree with Jobs. Why should we create a plug-in dependency to run a application on a no-software platform such as force.com ?? I like flex/flash for what it is .. but I wish all the flashy features need to be part of W3C at some point of time.

Saturday, February 13, 2010

Spring'10 exceeded my expectations

Dream 18

As Ben Parker once said,"With great power comes great responsibility". With the Salesforce.com release of spring’10, developers & architects now have great responsibilities to design & develop more efficient & powerful salesforce.com solutions. The release features are so powerful enough to turn certain dreams of force.com developers into a reality... I know, we all know, about the Out-of-the-box enhancements in spring’10. Be it the auto complete on standard search fields, dashboard running user display enhancements, etc... they rock as usual.But I'm most impressed with the implementation of the below ideas:

1. Elimination of the governor limit set on the number of items a collection can hold. Phew ... watt a relief...lolz.

2. Chained relationships... Master -> Child -> Sub-Child. Way to go!

3. When we get into an argument about Cloud vs. Distributed computing, Java/Unix/windows developers/architects used to ask me quite often... what kind of platform is force.com if I cannot have the ability to run my code at scheduled times?? Apex Code Scheduler was made GA. We now have an answer to Cron jobs :)

4.The 3 most wanted aggregate functions in SOQL. Min, Max & Sum.

I'm just excited!!!

Saturday, January 30, 2010

Cloud User Access

Dreams contd. from my SquareSpace posts ...

Dream 17

Do all the users need to have separate licenses to gain access to the cloud based solutions -- be it CRM or ERP or blog spot (when they make it pay-per-use :))??? What if I wanted to access only certain features on the application? Why should I pay the subscription license fee for my user Id then??

These are some of the questions that my peer non-cloud architects post to me quite often. In this post, I wanted to share my views on solving this problem. I cannot talk for all the cloud based solutions but I can talk on how the problem can be done solved for Salesforce.com users. Let’s build an interesting use case here so that I can explain my solution clearly.

Use Case: Organization X uses Sales force as their primary CRM tool but the requirement is to allow all the employees in company to continue their tweets during their office hours using OfficeTweeter, a custom build functionality inside the Salesforce Org. Again, not through twitter.com but through force.com/TwitterForce APIs so that certain restrictions can be applied on what is being tweeted from office. Of course the company does not want to subscribe salesforce logins for all the 30K+ employees in the Org just to use the OfficeTweeter feature. Solve this.

Solution: When I hear such interesting use cases, first words that cross my mind are: Force.com sites, Crypto class, encryption: MD5 or SHA1, flashy interfaces using Visualforce, TwitterForce, etc, etc.
1.Create a common profile called 'OfficeTweeter Users' in your salesforce Org. Public access settings control which database objects and fields are accessible to users.
2.Create a salesforce user login and map it to the OfficeTweeter Users profile.
3.Create a unique user id for each & every employee in the company. The associated passwords can be encrypted using Apex Crypto APIs and stored in the custom object against.
4.Use TwitterForce apex class libraries for accessing the Twitter APIs & posting/reading twitter updates.
5.The presentation layer for the entire site can be designed using Visualforce.

And know what the solution does not need a separate web/app server or a Oracle DB server or a hosting environment. Just a salesforce.com account. Did I ever say which is my most favorite force.com sites driven website.Here it is. Jai force.com sites !!!