<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jonathanrico.</title>
	<atom:link href="http://jonathanrm.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanrm.com</link>
	<description></description>
	<lastBuildDate>Thu, 15 Jul 2010 03:37:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<script type="text/javascript">

if (typeof Meebo == 'undefined') {

Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)};
(function(q){

	var args = arguments;
	if (!document.body) { return setTimeout(function(){ args.callee.apply(this, args) }, 100); }
	var d=document, b=d.body, m=b.insertBefore(d.createElement('div'), b.firstChild); s=d.createElement('script');
	m.id='meebo'; m.style.display='none'; m.innerHTML='<iframe id="meebo-iframe"></iframe>';
	s.src='http'+(q.https?'s':'')+'://'+(q.stage?'stage-':'')+'cim.meebo.com/cim/cim.php?network='+q.network;
	b.insertBefore(s, b.firstChild);

})({network:'jonathanrico_jo56qo'});	}</script>	<item>
		<title>App inventor for android</title>
		<link>http://jonathanrm.com/2010/07/app-inventor-for-android/</link>
		<comments>http://jonathanrm.com/2010/07/app-inventor-for-android/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 03:37:02 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=171</guid>
		<description><![CDATA[Here&#8217;s a nice tool from Google for building apps for Android: Learn more here : http://appinventor.googlelabs.com/about/ document.getElementById("post-171-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a nice tool from Google for building apps for Android:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/8ADwPLSFeY8&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/8ADwPLSFeY8&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>Learn more here : <a href="http://appinventor.googlelabs.com/about/">http://appinventor.googlelabs.com/about/</a></p>
<img style='display:none' id="post-171-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/07/app-inventor-for-android/',title:'App inventor for android',tweet:'Here&#8217;s a nice tool from Google for building apps for Android:  Learn more here : http://appinv',description:'Here&#8217;s a nice tool from Google for building apps for Android:  Learn more here : http://appinv'})"><script type='text/javascript'>document.getElementById("post-171-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/07/app-inventor-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Font API makes the web a little nicer</title>
		<link>http://jonathanrm.com/2010/05/google-font-api-makes-the-web-a-little-nicer/</link>
		<comments>http://jonathanrm.com/2010/05/google-font-api-makes-the-web-a-little-nicer/#comments</comments>
		<pubDate>Fri, 21 May 2010 21:05:45 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=151</guid>
		<description><![CDATA[#GFontTangerine{ font-family: 'Tangerine', serif; font-size: 28px; } #GFontReenie{ font-family: 'Reenie Beanie', serif; font-weight:bold; font-size: 28px; } Almost everyone who has worked with web design understands the limitations of font styling, you are restricted to work with fonts that are available on most users&#8217; computers in order to make things look &#8220;nice enough&#8221;. Thanks to CSS3 [...]]]></description>
			<content:encoded><![CDATA[<p><head></p>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Reenie+Beanie">
<style>
      #GFontTangerine{
        font-family: 'Tangerine', serif;
        font-size: 28px;
      }
      #GFontReenie{
        font-family: 'Reenie Beanie', serif;
        font-weight:bold;
        font-size: 28px;
      }
    </style>
<p>  </head><br />
Almost everyone who has worked with web design understands the limitations of font styling, you are restricted to work with fonts that are available on most users&#8217; computers in order to make things look &#8220;nice enough&#8221;. Thanks to CSS3 standards, browsers can now make use of web fonts and Google Font API provides a collection of open source web fonts for <span id="GFontTangerine">Making the Web Beautiful!</span></p>
<p><span id="GFontReenie">More information available <a href="https://code.google.com/intl/es-ES/apis/webfonts/" target="_blank">here</a>.</span></p>
<img style='display:none' id="post-151-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/05/google-font-api-makes-the-web-a-little-nicer/',title:'Google Font API makes the web a little nicer',tweet:'          #GFontTangerine{         font-family: \'Tangerine\', serif;         font-size: 28px;       }',description:'          #GFontTangerine{         font-family: \'Tangerine\', serif;         font-size: 28px;       }'})"><script type='text/javascript'>document.getElementById("post-151-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/05/google-font-api-makes-the-web-a-little-nicer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMForce!</title>
		<link>http://jonathanrm.com/2010/04/vmforce/</link>
		<comments>http://jonathanrm.com/2010/04/vmforce/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 06:31:02 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=140</guid>
		<description><![CDATA[Java inside Force.com! Salesforce and VMWare are introducing vmForce, the first enterprise cloud for Java developers. No need to worry about hardware, complex software stacks, scalability, databases, etc&#8230; let Force.com handle all that! document.getElementById("post-140-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>Java inside Force.com!</p>
<p>Salesforce and VMWare are introducing vmForce, the first enterprise cloud for Java developers.</p>
<p>No need to worry about hardware, complex software stacks, scalability, databases, etc&#8230; let Force.com handle all that!</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/LpO6whOCAmQ&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/LpO6whOCAmQ&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<img style='display:none' id="post-140-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/04/vmforce/',title:'VMForce!',tweet:'Java inside Force.com! Salesforce and VMWare are introducing vmForce, the first enterprise cloud for',description:'Java inside Force.com! Salesforce and VMWare are introducing vmForce, the first enterprise cloud for'})"><script type='text/javascript'>document.getElementById("post-140-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/04/vmforce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new Google Docs</title>
		<link>http://jonathanrm.com/2010/04/a-new-google-docs/</link>
		<comments>http://jonathanrm.com/2010/04/a-new-google-docs/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 00:39:42 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=134</guid>
		<description><![CDATA[Google just released new features for Google Docs, including a new addition to the suite called Drawings! As a user of google spreadsheets I was very aware of performance issues when working with large data files and this new version of the application seems to boost performance and at least scrolling seems to work very [...]]]></description>
			<content:encoded><![CDATA[<p>
Google just released new features for Google Docs, including a new addition to the suite called Drawings!</p>
<p>As a user of google spreadsheets I was very aware of performance issues when working with large data files and this new version of the application seems to boost performance and at least scrolling seems to work very well.</p>
<p>These are some great enhancements to the Google Docs suite and hopefully this brings more ideas for integrating Google Docs with Force.com through the <a href="http://wiki.developerforce.com/index.php/Google_Data_API_Toolkit" target="_blank">Google Data API Toolkit</a>.</p>
<p>Here&#8217;s a video with more info:
</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/6_hJ3R8jEZM&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/6_hJ3R8jEZM&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<img style='display:none' id="post-134-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/04/a-new-google-docs/',title:'A new Google Docs',tweet:' Google just released new features for Google Docs, including a new addition to the suite called Dra',description:' Google just released new features for Google Docs, including a new addition to the suite called Dra'})"><script type='text/javascript'>document.getElementById("post-134-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/04/a-new-google-docs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nexus One</title>
		<link>http://jonathanrm.com/2010/02/124/</link>
		<comments>http://jonathanrm.com/2010/02/124/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:20:37 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=124</guid>
		<description><![CDATA[The nexus one video series are awesomee, one nexus one please. document.getElementById("post-124-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>The nexus one video series are awesomee, one nexus one please.</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/R1sz5c-R9h0&#038;hl=es_ES&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/R1sz5c-R9h0&#038;hl=es_ES&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<img style='display:none' id="post-124-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/02/124/',title:'Nexus One',tweet:'The nexus one video series are awesomee, one nexus one please.  ',description:'The nexus one video series are awesomee, one nexus one please.  '})"><script type='text/javascript'>document.getElementById("post-124-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/02/124/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Force.com Apex Merge/Replace Class ;)</title>
		<link>http://jonathanrm.com/2010/02/force-com-apex-mergereplace-class/</link>
		<comments>http://jonathanrm.com/2010/02/force-com-apex-mergereplace-class/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 07:26:10 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[force.com]]></category>
		<category><![CDATA[visualforce]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=85</guid>
		<description><![CDATA[Hello again! I just developed an Apex class for performing replace/merge operations on any kind of object, and yes any kind of relations as well! , so it doesn&#8217;t matter if you have master-detail relationships that can&#8217;t be modified, objects tied in a master-detail relationship will be cloned, deleted and inserted with the new values [...]]]></description>
			<content:encoded><![CDATA[<p>Hello again!</p>
<p>I just developed an Apex class for performing replace/merge operations on any kind of object, and yes any kind of relations as well! , so it doesn&#8217;t matter if you have master-detail relationships that can&#8217;t be modified, objects tied in a master-detail relationship will be cloned, deleted and inserted with the new values to simulate a merge operation!</p>
<p>To use the Merge class  just create an ObjectMerge instance, passing as an argument of the constructor your current record:</p>
<p><strong>ObjectMerge oMerge = new ObjectMerge(SourceObject); </strong></p>
<p>And to peform the merge operation just use the replaceRecord method and thats it!, you can specify if you want to delete the source record after the merge operation is done.</p>
<p><strong>oMerge.replaceRecord(MergeToThisObjectID,DeleteSourceObject);</strong></p>
<p>You can limit the number of records that will be processed in the merge operation for Master-Detail relations  to avoid hitting governor limits. The ObjectMerge class will let you know if there are any objects left, and if this is the case just continue performing the merge operation.</p>
<p>Force.com provides a merge DML operation but it&#8217;s only available for some of their standard objects, this class can help you get around that.  There are still some limitations with this class due to governor limits in the number of describe calls but unless you have a large amount of objects related to the replaced/merged record it should work pretty well.</p>
<p>For now, the Object Merge class only merges/replaces custom objects related to your record, but this can be changed  in the class , however keep in mind that no more than 10 relations can be processed due to describe calls limitations so be careful when removing the custom objects limitation because there can be many Non-Custom objects related to your record.</p>
<p>I&#8217;ll leave a link in this post to the files but for now here&#8217;s an example of how to use the ObjectMerge class in a VisualForce controller that merges contacts, if you have custom objects tied a contact A and want to merge contact A to Contact B you will see how the ObjectMerge class changes all of the objects from contact A to contact B then deletes contact A. Remember, you can try it with any custom object <img src='http://jonathanrm.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   Enjoy!</p>
<p>Download the files from here &#8211;&gt; <a title="ObjectMerge Files" href="http://jonathanrm.com/wp-content/uploads/2010/02/ObjectMerge1.zip" target="_blank">ObjectMerge</a></p>
<p>(NOTE: There&#8217;s a bug with the code viewer plug-in, please ignore the second viewer)</p>
<img style='display:none' id="post-85-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/02/force-com-apex-mergereplace-class/',title:'Force.com Apex Merge/Replace Class ;)',tweet:'Hello again! I just developed an Apex class for performing replace/merge operations on any kind of o',description:'Hello again! I just developed an Apex class for performing replace/merge operations on any kind of o'})"><script type='text/javascript'>document.getElementById("post-85-blankimage").onload();</script><textarea cols="40" rows="10" name="code" class="Java">public class MergeController{
    
    //This is just an Aux Object to get a Lookup Field in the VisualForce Page
    public Contact MergeAux{get;set;}
    //Declare an instance of the Object Merge Class
    private ObjectMerge oMerge;
    //Save the current contact in the controller (optional)
    private final Contact currentContact;
        
    public MergeController(ApexPages.StandardController controller){

        //Initialize all of our objects
        currentContact = (Contact)controller.getRecord();    
        MergeAux =new Contact();
        oMerge = new ObjectMerge(currentContact);        
        
    }
    
    //Merge Action
    public PageReference doMerge(){

        try{
     
            //Run the merge operation!, you can specify a second argument to delete the record after merge or not
            oMerge.replaceRecord(MergeAux.ReportsToId,false);
            
            //Do corresponding actions if merge operation was successful
            if(oMerge.bAppliedReplace){
                PageReference ref = new PageReference('/'+MergeAux.ReportsToId);
                ref.setRedirect(true);
                return ref;
            }else{
                return null;


        }catch(Exception e){
            
            ApexPages.addMessages(e);
            return null;    
        }
        
    }   

}

//And the Visual Force page will look something like this:

<apex:page standardController="Contact" extensions="MergeController">
     
     <apex:form >
         <apex:pageBlock >
             <apex:pageMessages id="messages">
             </apex:pageMessages>
             
             <apex:pageBlockButtons >
                 <apex:commandButton value="Merge" action="{!doMerge}" rerender="messages"/>
             </apex:pageBlockButtons>
             <apex:pageBlockSection columns="1">
                 <apex:outputField value="{!Contact.Name}"/>
                 <apex:inputField value="{!MergeAux.ReportsToId}"/>                
                 
             </apex:pageBlockSection>
         </apex:pageBlock>
     </apex:form>
     
</apex:page>

</textarea>
	<!-- Wordpress Code Snippet -->
	<script type="text/javascript" src="http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/js/shCore.js"></script><script type="text/javascript" src="http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/js/shBrushJava.js"></script>
	<link type="text/css" rel="stylesheet" href="http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/css/SyntaxHighlighter.css"/>
	
	<script language="javascript">
	dp.SyntaxHighlighter.ClipboardSwf = 'http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/js/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');
	</script>
	<!-- End Wordpress Code Snippet -->
	]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/02/force-com-apex-mergereplace-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting ways of architecting Apex Triggers</title>
		<link>http://jonathanrm.com/2010/01/interesting-ways-of-architecting-apex-triggers/</link>
		<comments>http://jonathanrm.com/2010/01/interesting-ways-of-architecting-apex-triggers/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 05:54:55 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[force.com]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=65</guid>
		<description><![CDATA[Hello everyone! I came across a blog post at gokubi.com (http://gokubi.com/archives/two-interesting-ways-to-architect-apex-triggers) about some interesting ways of architecting Apex Triggers. We have developed a lot of logic in Apex Triggers and ended with some really nasty code in some scenarios; this post got me thinking about new ways to architect triggers using a more object-oriented approach. [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone!</p>
<p>I came across a blog post at gokubi.com (<a href="http://gokubi.com/archives/two-interesting-ways-to-architect-apex-triggers" target="_blank">http://gokubi.com/archives/two-interesting-ways-to-architect-apex-triggers</a>) about some interesting ways of architecting Apex Triggers.</p>
<p>We have developed a lot of logic in Apex Triggers and ended with some really nasty code in some scenarios; this post got me thinking about new ways to architect triggers using a more object-oriented approach. So just to follow the thoughts in this post I&#8217;ll show you what I did to organize our triggers and it has been working pretty good so far.</p>
<p>NOTE: Please refer to the code section below</p>
<p>//Step 1</p>
<p>I started by creating an Apex Class to replicate some of the triggers functionality&#8230;</p>
<p>//Step 2</p>
<p>The next step will be to start coding our Apex Class that will perform all of the logic in our triggers, so let&#8217;s say the we are building a trigger for My_Object__c custom object.</p>
<p>//Step 3</p>
<p>And finally, we just need to create the Apex Triggers that will just initialize our Trigger class and initialize an instance of the corresponding Apex Class that will handle all of the logic.</p>
<p>And that&#8217;s it! Just remeber to cast the the collections correctly before accessing the collections from the ExtTrigger class because we can&#8217;t work with generic sobject collections.</p>
<p>Some of the benefits that I&#8217;ve seen by organizing Apex Triggers in this way are the following:</p>
<ul>
<li>100% Test Coverage in Apex Triggers (although all of the Test Coverage should be done in the handler Apex Class)</li>
<li>Since we can call functions to perform specific actions in Apex Classes, we end up with more organized code, it&#8217;s easier to read in the sense that you can just go to see the calls inside the &#8220;onBeforeInsert&#8221; section for example..</li>
<li>Avoid the max number of characters governor limit:
<ul>
<li>Maximum number of characters for a class: 100,000</li>
<li>Maximum number of characters for a trigger: 32,000</li>
</ul>
</li>
</ul>
<p>Thanks to everyone that posted in gokubi&#8217;s blog post any feedback on this is appreciated <img src='http://jonathanrm.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img style='display:none' id="post-65-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/01/interesting-ways-of-architecting-apex-triggers/',title:'Interesting ways of architecting Apex Triggers',tweet:'Hello everyone! I came across a blog post at gokubi.com (http://gokubi.com/archives/two-interesting-',description:'Hello everyone! I came across a blog post at gokubi.com (http://gokubi.com/archives/two-interesting-'})"><script type='text/javascript'>document.getElementById("post-65-blankimage").onload();</script><textarea cols="40" rows="10" name="code" class="Java">
//--------------Step 1

public class ExtTrigger {

	public List newValues;
	public List oldValues;
	public Map newMap;
	public Map oldMap;

	public Boolean isInsert = false;
	public Boolean isUpdate = false;
	public Boolean isDelete = false;
	public Boolean isUndelete = false;
	public Boolean isBefore = false;
	public Boolean isAfter = false;

	public ExtTrigger(List oldValues,List newValues,Map oldMap,Map newMap){

		this.newValues = newValues;
		this.oldValues = oldValues;
		this.oldMap = oldMap;
		this.newMap = newMap;

	}

}

//--------------Step 2

public class My_Object_Trigger {

	//Attributes
	public ExtTrigger MTrigger;

	public My_Object_Trigger(ExtTrigger MTrigger){

		this.MTrigger = MTrigger;

	}

	public void onBeforeInsert(){

		try{

			doSomething();
			doSomethingElse();

		}catch(Exception e){

		System.debug('Trigger Insert Exception '+e);
		((My_Object_c)MTrigger.newValues[0]).addError(sExceptionMessage);

		}

	}

	public void onBeforeUpdate(){

		try{

			doSomething();
			doSomethingElse();

		}catch(Exception e){

			System.debug('Trigger Update Exception '+e);
			((My_Object_c)MTrigger.oldValues[0]).addError(sExceptionMessage);

		}

	}

	//Etc....

	private void doSomething(){}
	private void doSomethingElse(){}

}

//--------------Step 3

trigger My_Object_Trigger on My_Object__c (before insert, before update) {

	//Create the instance of ExtTrigger and call the constructor in our apex class
	My_Object_Trigger triggerHandler = new My_Object_Trigger(
	new ExtTrigger(Trigger.old,Trigger.new,Trigger.oldMap,Trigger.newMap)
	);

	if(Trigger.isBefore){

		//Now we set the attributes for our trigger depending on the current context
		triggerHandler.MTrigger.isBefore = true;
	
		if(Trigger.isInsert){
	
			triggerHandler.MTrigger.isInsert = true;
			triggerHandler.onBeforeInsert();
	
		}
	
		if(Trigger.isUpdate){
	
			triggerHandler.MTrigger.isUpdate = true;
			triggerHandler.onBeforeUpdate();
	
		}

	}

}</textarea>
	<!-- Wordpress Code Snippet -->
	<script type="text/javascript" src="http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/js/shCore.js"></script><script type="text/javascript" src="http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/js/shBrushJava.js"></script>
	<link type="text/css" rel="stylesheet" href="http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/css/SyntaxHighlighter.css"/>
	
	<script language="javascript">
	dp.SyntaxHighlighter.ClipboardSwf = 'http://jonathanrm.com/wp-content/plugins/wordpress-code-snippet/js/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');
	</script>
	<!-- End Wordpress Code Snippet -->
	]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/01/interesting-ways-of-architecting-apex-triggers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Force.com Spring &#8217;10 Release</title>
		<link>http://jonathanrm.com/2010/01/force-com-spring-10-release/</link>
		<comments>http://jonathanrm.com/2010/01/force-com-spring-10-release/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 04:16:26 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[force.com]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=61</guid>
		<description><![CDATA[Salesforce&#8217;s Spring &#8217;10 is packed with some really nice enhancements, new interface, code scheduler, no limits in collections, and more! For more information go to: http://developer.force.com/releases/release/Spring10 Here&#8217;s a small demo of how code scheduler works: document.getElementById("post-61-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>Salesforce&#8217;s Spring &#8217;10 is packed with some really nice enhancements, new interface, code scheduler, no limits in collections, and more!</p>
<p>For more information go to: <a href="http://developer.force.com/releases/release/Spring10">http://developer.force.com/releases/release/Spring10</a></p>
<p>Here&#8217;s a small demo of how code scheduler works:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/nbfPgr7LLfc&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/nbfPgr7LLfc&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<img style='display:none' id="post-61-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/01/force-com-spring-10-release/',title:'Force.com Spring &#8217;10 Release',tweet:'Salesforce&#8217;s Spring &#8217;10 is packed with some really nice enhancements, new interface, cod',description:'Salesforce&#8217;s Spring &#8217;10 is packed with some really nice enhancements, new interface, cod'})"><script type='text/javascript'>document.getElementById("post-61-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/01/force-com-spring-10-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello.</title>
		<link>http://jonathanrm.com/2010/01/hello-world/</link>
		<comments>http://jonathanrm.com/2010/01/hello-world/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 22:45:09 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=1</guid>
		<description><![CDATA[Hey, happy new year. I just updated to wordpress 2.9, I&#8217;ll be updating the blog with the previous entries. Currently listening to&#8230; document.getElementById("post-1-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>Hey, happy new year. I just updated to wordpress 2.9, I&#8217;ll be updating the blog with the previous entries.</p>
<p><a href="http://farm3.static.flickr.com/2685/4069983287_18827c995a.jpg"><img class="aligncenter" title="Oscar 2010" src="http://farm3.static.flickr.com/2685/4069983287_18827c995a.jpg" alt="hello" width="500" height="375" /></a></p>
<p><a href="http://iampopularculture.com/wp-content/uploads/2009/08/Monsters-Of-Folk-The-Sandman-The.mp3">Currently listening to&#8230;</a></p>
<img style='display:none' id="post-1-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2010/01/hello-world/',title:'Hello.',tweet:'Hey, happy new year. I just updated to wordpress 2.9, I&#8217;ll be updating the blog with the previ',description:'Hey, happy new year. I just updated to wordpress 2.9, I&#8217;ll be updating the blog with the previ'})"><script type='text/javascript'>document.getElementById("post-1-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2010/01/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://iampopularculture.com/wp-content/uploads/2009/08/Monsters-Of-Folk-The-Sandman-The.mp3" length="3967120" type="audio/mpeg" />
		</item>
		<item>
		<title>The Web as random acts of kindness</title>
		<link>http://jonathanrm.com/2009/09/the-web-as-random-acts-of-kindness/</link>
		<comments>http://jonathanrm.com/2009/09/the-web-as-random-acts-of-kindness/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 00:35:42 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[ted]]></category>

		<guid isPermaLink="false">http://jonathanrm.com/?p=11</guid>
		<description><![CDATA[Makes you think about the internet&#8217;s nature, acts of kindness and trust. document.getElementById("post-11-blankimage").onload();]]></description>
			<content:encoded><![CDATA[<p>Makes you think about the internet&#8217;s nature, acts of kindness and trust. </p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="446" height="326" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent"><param name="bgColor" value="#ffffff" /><param name="flashvars" value="vu=http://video.ted.com/talks/dynamic/JonathanZittrain_2009G-medium.flv&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/JonathanZittrain-2009G.embed_thumbnail.jpg&amp;vw=432&amp;vh=240&amp;ap=0&amp;ti=640&amp;introDuration=16500&amp;adDuration=4000&amp;postAdDuration=2000&amp;adKeys=talk=jonathan_zittrain_the_web_is_a_random_act_of_kindness;year=2009;theme=speaking_at_tedglobal2009;theme=media_that_matters;theme=new_on_ted_com;theme=the_rise_of_collaboration;event=TEDGlobal+2009;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><param name="src" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" /><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="446" height="326" src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" flashvars="vu=http://video.ted.com/talks/dynamic/JonathanZittrain_2009G-medium.flv&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/JonathanZittrain-2009G.embed_thumbnail.jpg&amp;vw=432&amp;vh=240&amp;ap=0&amp;ti=640&amp;introDuration=16500&amp;adDuration=4000&amp;postAdDuration=2000&amp;adKeys=talk=jonathan_zittrain_the_web_is_a_random_act_of_kindness;year=2009;theme=speaking_at_tedglobal2009;theme=media_that_matters;theme=new_on_ted_com;theme=the_rise_of_collaboration;event=TEDGlobal+2009;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" bgcolor="#ffffff" wmode="transparent" allowfullscreen="true"></embed></object></p>
<img style='display:none' id="post-11-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://jonathanrm.com/2009/09/the-web-as-random-acts-of-kindness/',title:'The Web as random acts of kindness',tweet:'Makes you think about the internet&#8217;s nature, acts of kindness and trust.   ',description:'Makes you think about the internet&#8217;s nature, acts of kindness and trust.   '})"><script type='text/javascript'>document.getElementById("post-11-blankimage").onload();</script>]]></content:encoded>
			<wfw:commentRss>http://jonathanrm.com/2009/09/the-web-as-random-acts-of-kindness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
