Save 37% off PRO during our Black Friday Sale! »

Switch it up with Apex - TrailheadX 2018

Switch it up with Apex - TrailheadX 2018

3cf3d4d85fad3d196c1127018a370418?s=128

Chris Peterson

March 28, 2018
Tweet

Transcript

  1. None
  2. Switch it up with Apex March 28, 2018

  3. Statement under the Private Securities Litigation Reform Act of 1995:

    This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Forward-Looking Statement
  4. Chris Peterson Senior Product Manager @ca_peterson Principal Engineer Jim Spagnola

    Senior Engineer @anand13s Anand Subramanian Insert photo here Insert photo here Insert photo here
  5. Did you know Apex has a new compiler? You shouldn’t

  6. Switch

  7. Why we picked Switch • 17,000 Idea Exchange Points •

    Simplifies long if/else logic chains • Improve trigger flow with help of context enum • Most popular languages have some form of switching/pattern matching • Show off the new compiler
  8. Values and Obstacles • Values ◦ Reduce code duplication ◦

    Support Enums, String, Integer, Long ◦ Handle fields over polymorphic SObject types ◦ Familiar to developers from all background ◦ Leave the opportunity to expand Switch • Obstacles ◦ Case isn’t a keyword in Apex ◦ Why isn't it exactly like Java? No, I mean exactly.
  9. switch on i { when 2, 3, 4 { System.debug('case

    2 and 3 and 4'); } when 5, 6 { System.debug('case 5 and 6'); } when 7 { System.debug('case 7'); } when else { System.debug('default'); } } Behold Switch
  10. Trailblazer Forum • “Hey that’s not Java.” • “I like

    it.” • “I don’t like it.”
  11. Trailblazer Community • Code Coverage Requirements • case if ->

    when • Clarity { } • Trigger Enum
  12. Thank you

  13. DEMO UP NEXT Switch

  14. switch on i { when 2, 3, 4 { System.debug('case

    2 and 3 and 4'); } when 5, 6 { System.debug('case 5 and 6'); } when 7, 2 { // not allowed System.debug('case 7'); } when else { System.debug('default'); } } Switch Syntax
  15. • List contains() / indexOf() 1,190 points Spring • Switch

    17,000 points Summer • Count SOQL count() as a single row query 6,800 points Summer • Get RecordTypeInfo by API name 4,900 points Summer True to the Core
  16. Roadmap What else is coming, and what we're thinking about

  17. Performance

  18. Performance Improvements! • Faster apex test runs as part of

    metadata deployments ◦ Especially if you use declarative customization tooling - like Flow • Up to 20% faster test runs by skipping code coverage collection • Compile on deploy ◦ Avoid "cold cache" of Apex bytecode after deployments or package install ◦ Enabled in production orgs ◦ Optional for others (scratch orgs, sandboxes, etc)
  19. Secure development

  20. Secure development Inspired by community-developed security-enforcing query builders fflib_QueryFactory qf

    = new fflib_QueryFactory(Contact.SObjectType) .assertIsAccessible() //CRUD check on Contact //for fields shown to a user - we need to check FLS .setEnforceFLS(true) .selectField('Description') //FLS checked //disable FLS enforcement - we're going to use this for internal system purposes .setEnforceFLS(false) .selectField('Value__c'); List<Contact> results = Database.query(qf.toSOQL()); From: FinancialForce fflib-apex-common. On github at https://github.com/financialforcedev/fflib-apex-common
  21. Go to Bootcamp Expert-led instruction and certification programs Get Started

    with Salesforce DX Today Read our 5-part “Getting Started with Salesforce DX” Blog Series http://bit.ly/SFDXblogseries Modernize and speed up your release management Meet with a Program Architect for a development assessment or a Salesforce DX Accelerator Attend an ALM + Salesforce DX Campfire 1-day Workshops designed around Continuous Development on the Lightning Platform
  22. Become a Salesforce DX Trailblazer Earn 7 badges with Salesforce

    DX Getting Started Trail Salesforce DX Quick Start Project Salesforce DX Development Model Git and Github Basics *Partner Module Continuous Integration using Salesforce DX App Development with Salesforce DX Unlocked Packages for Customers Unlocked Packages Quick Start Project
  23. Get the inside scoop on Salesforce DX

  24. None