IssueRaiser

We use dependency injection to match State names to parameters of Behavior functions—the State numberOfStates gets injected into any Beha...

We use dependency injection to match State names to parameters of Behavior functions—the State numberOfStates gets injected into any Behavior function that lists is as a parameter, like function(numberOfStates). We need to have a talk. First, this isn't dependency injection - you're passing in data. These "Behavior" functions may depend on the data, but that doesn't make this a dependency . Oh, I can understand how you're confused. You see Angular doing it and reverse-engineered the term. But notice how in Angular it is used to pass services into controllers, services that the controller has a dependency on. Also, notice how this "feature" is broken in production. Any website worth its salt will minify the assets, which changes function parameter names. You did notice that, right, that your clever little hack works great in your development environment but totally breaks when you minify your code? You are testing things minified, right? Why would you spend any time at all working on a feature that is fundamentally broken in production? Kill your darlings.

Posted by couchand on Jun 24, 2015, 1:07 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.5,500 issues0 comments

reliability (Other)

We use dependency injection to match State names to parameters of Behavior functions—the State numberOfStates gets injected into any Beha...

couchandJun 24, 2015, 1:07 PM

We use dependency injection to match State names to parameters of Behavior functions—the State numberOfStates gets injected into any Behavior function that lists is as a parameter, like function(numberOfStates). We need to have a talk. First, this isn't dependency injection - you're passing in data. These "Behavior" functions may depend on the data, but that doesn't make this a dependency . Oh, I can understand how you're confused. You see Angular doing it and reverse-engineered the term. But notice how in Angular it is used to pass services into controllers, services that the controller has a dependency on. Also, notice how this "feature" is broken in production. Any website worth its salt will minify the assets, which changes function parameter names. You did notice that, right, that your clever little hack works great in your development environment but totally breaks when you minify your code? You are testing things minified, right? Why would you spend any time at all working on a feature that is fundamentally broken in production? Kill your darlings.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue