jenkins.io icon indicating copy to clipboard operation
jenkins.io copied to clipboard

Extending with Shared Libraries page - Missing explanation on why to avoid global variables

Open moises-perez-tfs opened this issue 3 years ago • 0 comments

Problem with the Extending with Shared Libraries page, source file

Why would you recommend to avoid global variables just after introducing them? There is not even a reason why.

Avoid defining global variables with methods that interact or preserve state. Use a static class or instantiate a local variable of a class instead.

Possible Solution

I think an explanation would improve the undestanding of that notice/recommendation.

moises-perez-tfs avatar Dec 15 '21 01:12 moises-perez-tfs