Skip to content

Commit 6529d39

Browse files
authored
Update README.md
1 parent 6d0c646 commit 6529d39

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Consts
22

3-
Consts framework allows keeping apex's constants in an ordered way.
3+
The Constants Framework provides a structured approach for managing constants in the Apex.
44

55
## Example
66

@@ -24,17 +24,21 @@ System.debug(Consts.OPPORTUNITY.TYPE.EXISTING_CUSTOMER_DOWNGRADE); //'Existing C
2424

2525
## How it works?
2626

27-
All concrete classes are created as *singletons*, so each class is initialized once during the transaction. To decrease heap size getters and setters are in use. It means that the class will be *initialized on demand*. e.g execution of `Consts.ACCOUNT.TYPE.PROSPECT` will create an instance of `AccountConsts` only, without creating `ContactConsts`.
27+
The framework employs the concept of singletons to create concrete classes.
28+
Each class is initialized once during the transaction, reducing heap size usage.
2829

29-
Code Architecture is following *Open/Close* and *Single Responsibility Principle*.
30-
It means that code is easy to extend, and each class is responsible only for a specific set of consts.
30+
Getters and setters are used to lazily initialize the classes.
31+
For example, accessing `Consts.Account.TYPE.PROSPECT` will only create an instance of the `AccountConsts` class without creating `ContactConsts`.
32+
33+
The code architecture follows the Open/Closed and Single Responsibility Principle principles.
34+
This design ensures the code is easily extensible, and each class is responsible for a specific set of constants.
3135

3236
## How to use it?
3337

34-
### Create concrete consts class
38+
### Create a concrete consts class
3539

36-
- Create an `INSTANCE` variable to keep the class instance (singleton).
37-
- Create inner classes to order values.
40+
- Define an `INSTANCE` variable to hold the class instance (singleton).
41+
- Create inner classes to organize the constant values.
3842

3943
```java
4044
public class ContactConsts {
@@ -52,7 +56,7 @@ public class ContactConsts {
5256
}
5357
```
5458

55-
### Add concrete consts class to `Consts`
59+
### Add a concrete consts class to `Consts`
5660

5761
```java
5862
public class Consts {

0 commit comments

Comments
 (0)