Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|---|---|---|---|---|---|
Hard coding in Apex Salesforce means directly embedding specific values or variables into the code instead of referencing them from a configurable source such as Custom Settings, Custom Metadata, or Custom Labels.
It is generally advisable to avoid hard coding in Apex Salesforce for the following reasons:
Maintainability: Hard-coded values are often difficult to maintain and update as they require code changes every time the value needs to be modified. This makes it harder to manage and scale the application over time.
Flexibility: Hard-coded values make the application less flexible, as changes cannot be made without editing the code. By using configurable sources such as Custom Settings, Custom Metadata, or Custom Labels, values can be easily modified without requiring code changes.
Reusability: Hard-coded values are not reusable and cannot be shared across multiple classes or triggers. By using configurable sources, values can be easily accessed and shared across the entire application.
Testing: Hard-coded values make it more difficult to test the application since the values are fixed and cannot be changed during testing. By using configurable sources, values can be easily changed during testing to ensure that the application is working as expected.
Here are some examples of how hard coding in Apex Salesforce can be problematic and how using configurable sources can be a better solution:
Hard coding a specific email address in Apex code to send email notifications. Instead, you can create a Custom Setting or Custom Metadata type to store the email address and reference it in the code.
Hard coding a record type ID in Apex code to create a new record of a certain type. Instead, you can create a Custom Setting or Custom Metadata type to store the record type ID and reference it in the code.
Hard coding a specific currency exchange rate in Apex code to perform currency conversions. Instead, you can create a Custom Setting or Custom Metadata type to store the exchange rate and reference it in the code.
Hard coding a specific picklist value in Apex code to update a field on a record. Instead, you can create a Custom Label or Custom Metadata type to store the picklist value and reference it in the code.
By using configurable sources such as Custom Settings, Custom Metadata, or Custom Labels, values can be easily modified without requiring code changes. This makes the code more maintainable, flexible, and reusable.
In summary, avoiding hard coding in Apex Salesforce can make the application more maintainable, flexible, reusable, and easier to test. It is generally best practice to use configurable sources such as Custom Settings, Custom Metadata, or Custom Labels instead of hard-coded values.
1 | Eray Dere | 130 |
2 | Sercan Kara | 60 |
3 | Ciro Miguel Gongo | 35 |
1 | Derya Baskol | 2487 |
2 | Solmaz Aliyeva | 1115 |
3 | Sercan Kara | 860 |
4 | Nyaradzai Shoko | 661 |
5 | Eray Dere | 490 |
6 | Okan Ozcelik | 385 |
7 | Efe Kadioglu | 374 |
8 | Ciro Miguel Gongo | 347 |
9 | Ridvan Ay | 285 |
10 | Esranur Bozdemir | 260 |
11 | Alaattin Kokcu | 245 |
12 | Bahar Erdagi | 240 |
13 | Osman Demirel | 212 |
14 | Nora Arslan | 200 |
15 | Aysun Bilgic | 160 |
16 | Ahmet Derdiyok | 130 |
17 | Evren Akcay | 125 |
18 | Mira Ince | 100 |
19 | EA | 95 |
20 | Sevilay Zencirkiran | 90 |
1 | Derya Baskol | 2167 |
2 | Solmaz Aliyeva | 1065 |
3 | Sercan Kara | 790 |
4 | Nyaradzai Shoko | 661 |
5 | Eray Dere | 490 |
6 | Ciro Miguel Gongo | 347 |
7 | Okan Ozcelik | 330 |
8 | Ridvan Ay | 260 |
9 | Alaattin Kokcu | 230 |
10 | Esranur Bozdemir | 225 |
11 | Nora Arslan | 200 |
12 | Bahar Erdagi | 195 |
13 | Osman Demirel | 182 |
14 | Aysun Bilgic | 130 |
15 | Evren Akcay | 115 |
16 | Mira Ince | 100 |
17 | EA | 95 |
18 | Sevilay Zencirkiran | 90 |
19 | Yeliz Celiker | 80 |
20 | Ahmet Derdiyok | 65 |
1 | Derya Baskol | 98011 |
2 | Solmaz Aliyeva | 49880 |
3 | Okan Ozcelik | 31073 |
4 | Tugbag Tamer Yilgin | 28630 |
5 | Engin Basturk | 27031 |
6 | Fatih | 24338 |
7 | Bahar Erdagi | 21617 |
8 | Zehra Bulut | 21598 |
9 | Emel Sarli | 20845 |
10 | Zeynep Yildiz | 19597 |
11 | Alaattin Kokcu | 18067 |
12 | ZY | 18011 |
13 | Burcu Derdiyok | 16651 |
14 | Cavidan | 16514 |
15 | Ozlem Helva | 16258 |
16 | Sebahattin Dalgic | 15751 |
17 | Esra Balci | 15333 |
18 | Ada Lozzy | 14760 |
19 | Ahmet Derdiyok | 14426 |
20 | Hakan Can | 13232 |