• drboolean
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Hey everyone.  This must be a redundant question, but it's a hard thread to search for.  I'm coming from rails and the 'active record' pattern so forgive me if this is ignorant.

 

How on earth do i extend an SObject with my own functionality?  Or where does my logic 'live'?

 

Should i make a wrapper object with an Apex Class?

 

I'm aware of formula's, but it's slightly limited for what i'm going for.

 

Thanks for your help in advance!

 

- Brian 

 

 

Example:

 

  So i have a visual force view.  I also have this extension.  So how can i implement roadRage()

 

 

public class MileageExtension {

private final Mileage__c mileageObj;

 

    public MileageExtension(ApexPages.StandardController controller) {

this.mileageObj = (Mileage__c)controller.getSubject();

    }

    

        // where do i put all the methods?

        public void roadRage() {

        Car car = mileageObj.getCar();

        Person driver = mileageObj.getDriver();

        car.honk();

        driver.giveFinger();

        car.swerve();

                driver.slowDownInEmbarrassment();

        }

} 

 

Message Edited by drboolean on 08-22-2009 08:39 PM

Message Edited by drboolean on 08-22-2009 08:40 PM

Hi all,

 

I've been doing ruby development for the last few years, but I'm looking for a change and the opportunity to work with apex came up.

 

I love oo, domain driven design, implementing patterns, etc.  I can also write java proficiently.

 

My question is, do you think i'll be happy coding apex?  Is it architecturally satisfying?  Can i create objects to my heart's content?

 

Two things that concern me are the 'governor' and the procedural style mix.

 

I'm ready to start learning, but i need to get over these reservations if i'm going to really give it a shot.

 

Thanks for the help in advance!

 

-Brian

 

Hey everyone.  This must be a redundant question, but it's a hard thread to search for.  I'm coming from rails and the 'active record' pattern so forgive me if this is ignorant.

 

How on earth do i extend an SObject with my own functionality?  Or where does my logic 'live'?

 

Should i make a wrapper object with an Apex Class?

 

I'm aware of formula's, but it's slightly limited for what i'm going for.

 

Thanks for your help in advance!

 

- Brian 

 

 

Example:

 

  So i have a visual force view.  I also have this extension.  So how can i implement roadRage()

 

 

public class MileageExtension {

private final Mileage__c mileageObj;

 

    public MileageExtension(ApexPages.StandardController controller) {

this.mileageObj = (Mileage__c)controller.getSubject();

    }

    

        // where do i put all the methods?

        public void roadRage() {

        Car car = mileageObj.getCar();

        Person driver = mileageObj.getDriver();

        car.honk();

        driver.giveFinger();

        car.swerve();

                driver.slowDownInEmbarrassment();

        }

} 

 

Message Edited by drboolean on 08-22-2009 08:39 PM

Message Edited by drboolean on 08-22-2009 08:40 PM