An initial config object would probably be ideal, and then you could have the chaining to supplement those values. You could have the initial method take in the config and use the values in that in place of the defaults. So
Aren’t these textures already reusable? The constructed texture object (the result of textures.lines(), e.g.) can be called on as many selections as you like to reuse it.
I feel it’s a matter of taste, but one practical reason I prefer chaining to configuration objects is that you get a runtime error when you misspell a property, rather than it being silently ignored.
Comments (61) 30 threads
Show all comments
Showing thread 2 of 30
I feel it’s a matter of taste, but one practical reason I prefer chaining to configuration objects is that you get a runtime error when you misspell a property, rather than it being silently ignored.
Also, use of the "new" keyword is contentious. You can hardly pretend that it is best practice.