|
I wrote my reply (The Lounge[^]) before I read yours, but I see we got to the same place on DI. Very interesting. Great post.
|
|
|
|
|
I think IoC/DI should all be explained with the simpler statement:
"Prefer composition over inheritance."
When I began learning OOP all the books, articles & gurus could talk about was Inheritance.
It even became one of the 3 Tenets of OOP (PIE - Polymorphism, Inheritance, & Encapsulation).
Inheritance was touted like crazy because people though it meant "REUSE!". It caused other problems.
So, then we saw a shift to "Prefer composition over inheritance" ala the Gang of 4 Book.
Composition simply meant build up a class from other classes.
But then, the challenge -- how do those internal classes get configured properly for construction.
Then came the DI which is very easy (pass it into the constructor).
But then, something happened. People wanted Frameworks to do this whole thing & then came THE GURUS to write books about those frameworks & aaaaaaahhh...... It all became so complicated so you had to buy a $50 book that would explain the framework to you.
That's my view of the whole thing.
The heart of "Prefer composition over inheritance" is a great principle to follow in some cases which makes for some really nice code. But all the other slopped on top of it, is blech!
And so it is in the IT / Development Community.
|
|
|
|
|
I was in awe of "DI" until I found having parameterized constructors also was "DI" (which I already used). If I need to get fancy, and don't want to spell it out, I pass a list of object types and cast them on the receiving end. As per the (MS) "sender pattern".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
|
If one understands the *how* and *why* of dependency injection, then no tool or framework is necessary.
In the same vein, IMHO, EF is way overcomplicated bloatware compare to a lean data access layer and knowing how to write stored procedures correctly.
Microsoft, when it comes to developer tools, has gone from making tools that enhance productivity with elegant simplicity to making tools that decreases, not increases, simplicity and productivity.
“The more they overtake the plumbing, the easier it is to stop up the drain.”
|
|
|
|
|
There is a lot of angst and wisdom in all of the other replies. My take is that, like many things of late, developers do not use judgement and assume "if a little is good a lot is better" without doing the analysis of what is really needed. I was doing "Dependency Injection" (hate the term, it should actually be "Dependency Abstraction") before the term was ever coined simply because I needed a little bit of it to make certain things more general.
As to why it seems simpler these days perhaps it is because the tooling (such as Unity, et al) have made it simpler to use and when you're less concerned about how the gas ignites to drive the piston it is easier to see the utility of the engine.
But that simpler tooling comes at a price, namely we don't always know what is going on under the hood, which can be both a good thing and a bad thing depending on what we're doing and the issues being faced.
|
|
|
|
|
I'm leaving within the hour for a weeklong trip to Marathon, FL for a much needed vacation. Of course the laptop is going with me just in case something needs fixing. Hopefully I won't have to use it too much!
So long suckers!
"Go forth into the source" - Neal Morse
"Hope is contagious"
|
|
|
|
|
kmoorevs wrote: Of course the laptop is going with me just in case something needs fixing
That's not a vacation.
Leave it at home. Disable all work related devices (and/or work related notifications)
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Enjoy - and take the battery out and leave it at home ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If you have MS Teams on your phone just remember to disable it so you don't get notifications over both mobile data & Wi-Fi
|
|
|
|
|
|
Dear Boss,
I'm leaving for Florida on <day> for a vacation and I will be gone for <days>.
I'm leaving all digital devices at home and cannot be reached for <days>.
This is my vacation, I have earned it and I plan on enjoying it by unplugging.
Thanks for your understanding, or not!
Your loyal employee
The most expensive tool is a cheap tool. Gareth Branwyn
JaxCoder.com
|
|
|
|
|
I turned last weekend from a 3-day weekend into a 4-day one by taking Friday off as a holiday. It's been years I've done that.
I was rewarded with tornadoes and a power failure that lasted for nearly 48 hours. I'm not sure whether I've jinxed myself, but this would be in line with my typical luck.
OTOH...I'm trying very hard to tell myself I'm lucky I haven't suffered any actual damage, other than one dead PC that (I'm guessing) didn't like the brownouts, even though it was sitting behind a UPS...
|
|
|
|
|
If you’re gone for a week and it all falls apart - ask for a big raise!!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
Unless it fell apart because of your code.
|
|
|
|
|
|
But when I got home I realized I picked 7 up.
I'll let myself out.
|
|
|
|
|
This left me a sour taste.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Sickly sweet for me.
|
|
|
|
|
Agreed! that's why one must always have a good supply of Tito's vodka on hand, you have to offset that sweetness somehow.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
I've heard that apparently italian Sprite is that much sourer than European and US Sprite. We also had a small production of sugar-free Sprite that I loved, but it was too sour and bitter even for Italian taste (it was much closer to Schweppes than to standard Sprite).
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Again, I'm thinking Tito's to the rescue!
You want bitter, consider this stuff Jeppson's Malört[^] a local (Chicago) specialty.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
modified 25-May-22 13:30pm.
|
|
|
|
|
|
Malört, turning taste buds into taste foes for generations!
modified 25-May-22 15:07pm.
|
|
|
|
|
Sounds like the voice of experience.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|