jenkins.io
jenkins.io copied to clipboard
Extending with Shared Libraries page - Missing explanation on why to avoid global variables
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.