title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
Tuesday, April 26, 2016 | |
Edit (27 Apr 16): I should've probably led by saying that I am a big fan of Inversion of Control. That also means I'm a decent fan of DI. But I'm also a fan of not over-engineering, and somehow the "culture" around DI is one where over-engineering seems to be fairly commonplace (see the Joel on Software post I talk about, below -- he's not talking about DI specifically, but I think you can inject it (hahahahaha) into his generic critique in this case). I love separation of concerns. What I don't love is hipster programming. If you're never going to reuse something, and it's significant to insane work to abstract it, don't. If abstraction was a bit more, knock yourself out, but, for instance, QueryOver in NHibernate when you're so deeply invested in SQL Server there's no great business case to leave, stop it. If your devs know SQL, stop it already. A better solution to a potential change in stack is to become familiar with microservices, and use them appropriately. The only place I can think of where this sort of gross abstraction might make some sense is when your stack is just getting off of the ground. But then it's no big deal to rip it all up if your old, crufty C# guy leaves and is replaced by Node Grrrl. Was doing some quick reading before talking about Dependency Injection tomorrow, and ran into a link from an SO question to a Joel on Software post I don't think I've run across before, Don't Let Architecture Astronauts Scare You:
Man, that's good. Honestly, Wikipedia currently does an excellent job explaining the pros and cons of Dependency Injection. Here are a few from each...
Okay, I admit it. I kept all of the disadvantages up there. I have worked with a system that overused DI before, and we had it so far upstream of our entities and controllers that you could work for months without ever coming into contact with the construction of a repository. That's not necessarily good. The "explosion of types" was definitely a problem, which means that over-abstraction was as well. "DI! DI! We can run the whole world with DI! DI venture capital funds!" /sigh I like interfaces. And my C# rdbms finally talked its way to using DI. I'm (slowly; I haven't had much time to work with it right now, as I don't have a product for which it's an absolute requirement) factoring it into a portable library, and that means I have to inject a class in that writes to files. Not a big deal, and certainly The Right Way to do it. What I dislike is when the DI is so abstracted that you're essentially cargo culting your way through repo instantiation, where you can create a repo from scratch and the inheritance hides that some base class is doing all the DI for you. That is, it's way too easy to end up in that last "con" from above: "Ironically, dependency injection can encourage dependence on a dependency injection framework." Wikipedia has an interesting link to some Uncle Bob Consulting jive. I haven't closely read it all, but some of this rings true on first skim...
That sounds about right, though it also seems to create a situation where you've got at least one of the "secret module" situations he was trying to avoid. The takehome message when considering Dependency Injection? Never outsmart yourself. Or, as Zakas put it a while back, "don't be too clever". posted by ruffin at 4/26/2016 01:33:00 PM |
|
| |
All posts can be accessed here: Just the last year o' posts: |
||||||||||||||||||||||
|