Sunday, 16 April 2017

Apex Programming Basics :

Apex is the world's first Cloud based programming language.
Apex is an Object Oriented programming language, which supports all principles of Object                Oriented programming.
By using apex, we can inplement custom business logic using by one or more salesforce                       applications.
Business Logic should be implemented in terms of Classes and Objects.
By using apex programming, we can perform all DML manipulations(Insert, Update, Delete,              UnDelete) on the object records.
Apex is completely intergates with the Database.com, to fetch the records by using a query                 language called as SOQL (Salesforce Object Query Language)
By using Apex programming, we can search for a keyword in one or more objects by using                 SOSL (Salesforce object search language)
By using Apex programming, we can implement complex validation rules and complex business          processes.
By using Apex programming, we can have the integration of salesforce with any external system        with the help of REST API  and SOAP API.
Apex programming provides a set of Fundamental building blocks to impement the programs.
Datatypes:
----------
Apex is a tightly coupled programming language, which requires to define the variables, before its usage.

For each variable we need to specify the datatype.

Datatype describes the following features.
1. What type of data the variable can hold.
2. How much memory is required to store the data.
Apex provides a 2 types of Datatypes.
1. Primitive Datatypes:
These are the Fundamental / basic Datatypes offered by apex programming.
For All Primitive Datatypes, the memory will be reserved in "Stack Memory".
Ex:
Integer:
By using this datatype, we can define a 32 bit integer value. (It doesn't accept the                                 decimal points)
Note:
The values will be in the range of -2^32 to +2^32
Long:
By using this datatype, we can able to store the values between the range -2^64 to                                 +2^64.
This is a 64-bit integer value.
string:
This datatype is used to store alphanumerical values along with the special                                            characters.
Note: Each character will occupy 2 bytes of memory.
Decimal:
This datatype is used to store integer values along with the Decimal points.
Note:
Each Currency field will reference the Decimal datatype internally by                                                    default.
Double:
This is a 64-bit Integer value along with the Decimal points.
Boolean:
This datatype will store TRUE / FALSE values inside it.
TRUE  --> 1
FALSE --> 0
Note: Checkbox field reference the Boolean datatype by default.
Date:
This datatype is used to hold the Date values.
DateTime:
This datatype is used to Hold the DateTime stamp values.
ID :
This datatype is used to store the 18 characters Id of a record.
Blob: (Binary Large Objects)
This datatype is used to sote the images, large content files inside the variable.