Re:CIL (.NET bytecode) to WebAssembly compiler
by moron4hire on Thursday September 03, 2015 @04:37PM
(#10167394)
I don't know what you mean by "weird interface abstractions". Interfaces are how you test the edges between modules in statically typed languages. They are the contracts that get checked at compile time to make sure you're not sending IPAddress-es where DateTime-s are expected.
And I don't know what that last part is supposed to mean. I've never not know "where my dependencies are coming from" or "where the implementation is". It's not like they live in some hidden place that I can't access. I reference them directly and explicitly.
EDIT: you ninja-edited on me. No, you are not at a loss for where IBar is defined. It's extremely easy--a single key press--to find it. Just hit F12 on it. You'll go right to its definition.
Re:CIL (.NET bytecode) to WebAssembly compiler
by tracker1 on Sunday September 06, 2015 @02:48AM
(#10176972)
Yeah, that takes me to the declaration of the IBar interface, but not to the implementation that's being used... The worst case is often when you have dependency injection along with something like EntLib's Data application blocks... it's a mess finding things on a project that you've been tossed in the middle of.
I'm not saying these patterns should never be used... only that there are generally simpler expressions that should usually be favored.
References are consistent and one-way, you no longer have to deal with searching for where a given dependency is coming from... Or where the implementation is... references are always direct this way.
C#: using MyOrg.Base.Interfaces;
JS In the JS case, you know where the implementation of bar comes from when looking into code, trying to resolve a bug. You can also use proxyquire in order to test the module, replacing bar with a shim for the purposes of testing... in the JS case the code is still clean, and you don't have a couple of layers of indirection abstracting you away from finding the next piece in the puzzle. And it doesn't limit your ability to test.