My cool new Slideshow!


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

My cool new Slideshow!

  1. 1. Apex Language Construct Study Guide Presenting By: Abhijita Panigrahy Trainer Ceptes Software Pvt. Ltd. Email: [email_address]
  2. 2. Content <ul><li>What is Apex </li></ul><ul><li>Language Construct </li></ul><ul><li>Testing Apex </li></ul>
  3. 3. What is Apex <ul><li> Apex code is a strongly-typed, object-oriented programming language that allows developers to execute flow and </li></ul><ul><li>transaction control statements on the platform server in conjunction with calls to the API. </li></ul><ul><li>All Apex runs entirely on-demand on the platform, as shown in the following architecture diagram: </li></ul>
  4. 4. Supports <ul><li>Data manipulation language (DML) </li></ul><ul><li>Inline Object Query Language (SOQL) and Object Search Language (SOSL) queries that return lists of sObject records </li></ul><ul><li>Looping </li></ul><ul><li>Locking syntax </li></ul><ul><li>Custom public API calls etc. </li></ul>
  5. 5. When Should I Use Apex <ul><li>Create Web services </li></ul><ul><li>Create email services </li></ul><ul><li>Perform complex validation over multiple objects </li></ul><ul><li>Create complex business processes that are not supported by workflow </li></ul><ul><li>Create custom transactional </li></ul><ul><li>Attach custom logic to another operation, such as saving a record </li></ul>
  6. 6. Limitations of Apex <ul><li>Render elements in the user interface other than error messages </li></ul><ul><li>Change standard functionality—Apex can only prevent the functionality from happening, or add additional functionality </li></ul><ul><li>Create temporary files </li></ul><ul><li>Spawn threads </li></ul>Apex cannot be used to:
  7. 7. Understanding Apex Core Concepts A typical Apex script contains many things that you might be familiar with from other programming languages:
  8. 8. Writing Your First Apex Script To create a apex class click Setup ➤ Develop ➤ Apex Classes, click New
  9. 9. Testing Apex Script Testing and unit tests are an important part of the development. You must have at least 75% of your Apex scripts covered by unit tests to deploy your scripts to production environments. In addition, all triggers should have some test coverage. recommends that you have 100% of your scripts covered by unit tests, where possible. Calls to System.debug are not counted as part of Apex code coverage in unit tests. @isTest private class TestClassName{ static testMethod void methodName() {} }
  10. 10. Language Constructs <ul><li>Data Types </li></ul><ul><li>Variables </li></ul><ul><li>Expressions </li></ul><ul><li>Assignment Statements </li></ul><ul><li>Conditional Statements </li></ul><ul><li>Loops </li></ul><ul><li>Exception Statements </li></ul>
  11. 11. Data Types <ul><li>Decimal </li></ul><ul><li>Double </li></ul><ul><li>ID </li></ul><ul><li>Integer </li></ul><ul><li>Long </li></ul><ul><li>String </li></ul><ul><li>Time </li></ul><ul><li>sObject Types (eg: Account a = new Account(); </li></ul><ul><li> MyCustomObject__c co = new MyCustomObject__c();) </li></ul>
  12. 12. Collections <ul><li>Lists </li></ul><ul><li>Maps </li></ul><ul><li>Sets </li></ul>
  13. 13. List The following are ways to declare and populate a set:
  14. 14. Set & Map The following are ways to declare and populate a set or a map:
  15. 15. Variables <ul><li>Case Sensitivity </li></ul><ul><li>Constants </li></ul><ul><li>eg : static final IntegerPRIVATE_INT_CONST; </li></ul><ul><li> static final IntegerPRIVATE_INT_CONST2 = 200; </li></ul>
  16. 16. Loops <ul><li>Do-While Loops </li></ul><ul><li>While Loops </li></ul><ul><li>For Loops </li></ul><ul><li>Traditional For Loops </li></ul>
  17. 17. Exception Statements <ul><li>Throw Statements </li></ul><ul><li>Try-Catch-Finally Statements </li></ul><ul><li>throw statements can be used to generate exceptions, while </li></ul><ul><li>try, catch, and finally can be used to gracefully recover from </li></ul><ul><li>an exception. </li></ul>