shal
shal

Reputation: 3024

How to refactor dynamic languages safely?

For example I decided to fuse two classes. The problem with JS or LUA is that it gets very hard to find implicit problems, for example it shows you a error only when your runtime actually executes the piece of code you are trying to implement. The advantage of strict languages like Haxe or C++ is that your code won't compile until you fix everything.

Does anyone know what are the best practices for refactoring dynamic languages?

Upvotes: 4

Views: 199

Answers (1)

Ira Baxter
Ira Baxter

Reputation: 95324

The problem isn't really specific to "refactoring".

It is that "it (the dynamic language interpreter) shows you a error only when your runtime actually executes the piece of code which is wrong (and sometimes not even then)". This is probably the major defect of dynamic languages.

What is needed is a tool that can reason deeply about your code to decide statically, where practical, if executing it might produce a runtime error or a useless computation. Such tools are pretty hard to find.

The discussion here is instructive: Programming Language Properties that facilitate refactoring?

Upvotes: 3

Related Questions