Static method usage

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Static method usage

This post was updated on .
Dear ngrinder developers.

While reviewing the recorder code, I found bad habit.

Please keep this word in your mind.

= Never use the static on the stateful method!! =

Previously ngrinder 2.X code was crap and easy to break, because it contain several static methods.

You may have thought it's only way to access the other object which you don't have reference internally.

However this causes very bad design because web application works on the multi thread environment and each thread can mix the state unexpectively. Please never never  use the static methods. PLEASE

Only static methods you can use is the methods which only use local variable. For example.. Math.. utility method.

Check out general discussion on this.