We are back, and now we have a different problem with scripts.
On the one hand we want things just work, on the other hand we don’t want always to expose our code to the end user.
So what the dilemma?
1. We can use the same code for production and for debugging. It is good enough when we don’t have some special features in our code.
2. We can obfuscate the code in the production stage. Why would we this at all? Perhaps we have some meaningful algorithm or we don’t want to expose functions and variables names.
And then we have a problems.
How the code should be obfuscated? The question is so difficult, so for sure I can say it depends.
There are some possible scenarios for obfuscation.
1. change names. We get the same code structure and we have auto generated dictionary to translate real name to obfuscated name and vice versa.
2. Change code. We get a different code structure. It differs from the real one. In this case our debugging capabilities are not so high.
3. We can use both 1 and 2 thus providing unreadable and not debuggable code.
4. I didn’t mention it before, but we can also optimize our code. Here we get the different code in the production.
5.compilation. Some script engines provide support for internal byte code. We can compile our script code to the byte code, so there will be no any original text.
Thoughts.
The problem is very interesting yet not trivial.
If you are sure in your code, the best is to obfuscate, optimize and compile to byte code. This brings almost no additional information about you code.
But, if your are not sure in your code, or you want to be able to debug it (especially if you want to debug in the production code), you can throw away thoughts about obfuscation.
I belive that the real answer depends on the situation.