Ioc/DI – Why do I have to reference all layers/assemblies in application’s entry point?

If I wasn’t using a DI container, I wouldn’t have to reference EntityFramework library in my MVC3 app, only my business layer which would reference my DAL/Repo layer. Yes, that’s exactly the situation DI works so hard to avoid 🙂 With tightly coupled code, each library may only have a few references, but these again … Read more

What is a JavaBean exactly?

A JavaBean is just a standard All properties are private (use getters/setters) A public no-argument constructor Implements Serializable. That’s it. It’s just a convention. Lots of libraries depend on it though. With respect to Serializable, from the API documentation: Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do … Read more

AngularJS: Service vs provider vs factory

From the AngularJS mailing list I got an amazing thread that explains service vs factory vs provider and their injection usage. Compiling the answers: Services Syntax: module.service( ‘serviceName’, function ); Result: When declaring serviceName as an injectable argument you will be provided with an instance of the function. In other words new FunctionYouPassedToService(). Factories Syntax: … Read more

AngularJS Dependency Injection when no dependencies

Because angular.module(‘app’) with 1 parameter has a different function – to get an already existing module without having a code reference to it. The reason this: angular.module(‘app’, []); // Define the module. angular.module(‘app’); // Get the module. works as well as this: var app = angular.module(‘app’, []); // Define the module and assign to variable.