Dependency injection discourages object-oriented programming?
Group items matching
in title, tags, annotations or url
22More
shared by kuni katsuya on 12 Dec 12
- No Cached
Dependency injection discourages object-oriented programming? @ Blog of Adam Warski - 0 views
www.warski.org/...es-object-oriented-programming
java javaee6 CDI CdiDependencyInjection OO Object-Oriented procedural DI DependencyInjection

-
if you’re using DI, and you have an X entity, do you have an XService or XManager with lots of method where X is the first argument?
-
previous way is more procedural
- ...12 more annotations...
-
service/manager is a set of procedures you can run, where the execution takes a product and a customer as arguments
-
encourages the ProductService approach
-
well, dependency injection, but moreover, the soa approach to service design tends to force otherwise intelligent software engineers into doing procedural design the services just end up being bags of method calls that implement any type of behavior, with the domain objects or entity beans being reduced to mere data structures with little responsibility or behavior beyond persistence. (which, in this anti-pattern, is typically mostly provided by the repository or dao class! ie. domain object crud)
-
-
it’s just easier
-
many benefits
-
it’s not for small projects
-
problems with DI frameworks:
24More
Dependency Injection in Java EE 6 - Part 1 - 0 views
-
high-level look at CDI, see how it fits with Java EE overall and discuss basic dependency management as well as scoping.
- ...21 more annotations...
-
CDI allows you to manage the scope, state, life-cycle and context for objects in a much more declarative fashion, rather than the programmatic way
-
well-defined create/destroy life-cycle that you can get callbacks for via the @PostConstruct and @PreDestroy annotations.
-
CDI does not directly support business component services such as transactions, security, remoting, messaging
-
JSR 330 defines a minimalistic API for dependency injection solutions and is primarily geared towards non-Java EE environments.
-
none of this uses string names that can be mistyped and all the code is in Java and so is checked at compile time
-
are additional pieces of meta-data that narrow down a particular class when more than one candidate for injection exists
4More