Recently i get in touch with Empire-db. The project doc. stated that they are using "string-free coding", intended to use less constant strings as possible to avoid typos and use the force of the compiler.
I was always a big fan of this principle, because i think as Java is a formal language it could be expresive for configuration like properties or xml and gives extra value by checking thru the compiler. Maybe at runtime there are less posibilities to changes without recompiling but this depends on each case.
Do you now more references or readings about this term/principle/design pattern ?
This is the same thing as magic number vs constants. Using constants raises maintainability and readability. Constants also encapsulate change: a change in constant value is automatically propagated and, as for string-free coding, a misspelled constant is a compile-time error.
I know little about Java, but this idiom is famous in modern C++. For example, Xpressive is a regular expression library that allows the programmer to write regex in C++, and does compile-time checking. Spirit is another example, where you could write EBNF in C++, and the compiler can check the syntax for you also :)
I think the term you are looking for is Embedded Domain Specific Languages.
Never heard the particular expression, but Effective Java recommends to "avoid strings where other types are more appropriate" (Item 50).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With