The parameters have moved to a class method, still within the class, which is now public, but still taking a string and an intrinsic int, the string, as being passed as a parameter is already in the string pool or perhaps on the heap outside the string pool if it was created with New,
Nothing has been elevated outside of the block scope.
Where is anything that was claimed about raising variables to global scope as was suggested above apply.
You still have a constructor btw, just the make() method overloading the missing class construction.
The parameters are just placeholders, they have to be instantiate when invoked even if the implicit construction is hidden.
But in the beginning example and the refactored example they have the same instance variables, with the latter being marked private but that doesn't impact the lifecycle.
The question being if the refactored version uses the new private methods as callable or if optimization removes them.
The point being is that blaming performance regressions on this type of refactoring to improve readability is on thin ground for java.
This example does nothing to suggest that global state APIs etc.. that are a problem in react relate at all to the recommendation, which are still containing everything in a local scope.
I thank you for taking the time to answer, but what I am looking for is how this somehow lifts vars to a global scope, which it doesn't.
But there is such suggestion. In the quoted part of the book I sent above, Uncle Bob uses the words we need: https://news.ycombinator.com/item?id=42489167
-
> This is _simply_ an example
You asked where in the book the idea criticized by GP came from, and I only answered. I'm not trying to argue.
-
> What part of that would even suggest that they are indicating the most performant, idealized code?
Nowhere. You're the one who asked for "the cost". I'm not in an argument, I'm only answering your questions.