What are Constants in project resources?

4
In my project resources I have three options: Images, Regular Expressions & Constants. What are 'Constants' exactly?
asked
2 answers
8

Constants are a set of, well, 'constants'. These are values that never change and always have the same value in your project. The cool thing about them is that you can change them between different DTAP settings (dev, testing, acceptation, production).

This helps you if you were to, for instance, want to use a different URL in different environments to call a webservice. Note that you can set the settings for OT in the modeler, but you need to configure them in your application.conf in AP

Constant_mywebserviceURLconstantname = http://www.example.com
answered
1

In a lot of projects use a settings object to store all settings like, usernames, passwords, etc. You could use constants the same way. The difference between a settings object and constants is that settings can be configured in the client at runtime. Constants have to be configured in a text file at the server and the server has to restart in order to use these new values.

In most cases it is easier to use a settings object since usernames, passwords and email adresses can change a lot and you don't want to restart the server each time you change one.

Basically if your application depends on a specific property, an external url, an ip adres think or any other (hardware related) property that the network adminstrator should be able to configure. You should use the constants.

answered