What is dynamic code and static code?

9

Recently in a conversation with friends came the term dynamic code and static code . With that came a certain discussion. Some have said that dynamic code is related to scaffolding , others with code analysis . Others say it's the simple fact that the system generates the code for you.

But in fact, what is dynamic code and static code ? Are some or all of these descriptions correct?

    
asked by anonymous 18.01.2016 / 14:31

1 answer

15

Code analysis is something that looks different than what is being addressed. There is static analysis (a tool similar to the compiler does this in the source code) and the dynamic analysis that tracks the actual execution of the code.

Static code, in a given context, is a term that has little use. It indicates that the code was generated, either manually or automatically (in scaffolding , for example) at development time.

Dynamic code is one that is generated at runtime. This requires that the language and the environment in which it revolves allow this to occur. There are several methods to accomplish this. Some are safer, some are dangerous. Eventually we can say that simple code injection can be a dynamism. But I do not know if it can be applied here if the code was generated earlier.

You may be talking about self modifying code .

In other contexts, it could mean something else.

    
18.01.2016 / 14:48