I’ve been doing some stuff with AngularJS and one of the key ideas is dependency injection. Here’s a deconstruction of injector.js which contains all the functions and classes for dependency injection.
The biggest problem I have with dynamically typed languages is that there are no type hints written out. With AngularJS’s implementation of dependency injection, the dependencies are passed around as the first items in a list followed by the function which dependencies on them. Instead of talking about them as functions (which have no dependency) or arrays where the last item is a function or calling it “array notation”, it would be helpful to create a type that represents them. Not a class, but a type. This would give it a name and make it easier to refer to.
Alternatively, contracts could be written for functions and methods that would state how to make a valid call to a function.
Your new post is loading...