<div dir="auto">I know I could look it up in Wikipedia, but posing the question here may probably generate more amusement.</div><div dir="auto"><br></div><div dir="auto">WTF is a “dependency injection”?</div><div dir="auto"><br></div><div dir="auto">MA</div><div dir="auto"><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 6 Feb 2021 at 22:18, Scott McKay <<a href="mailto:swmckay@gmail.com">swmckay@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Nobody in the list community ever invented a fancy pants term like “dependency injection”<br>
because it’s so obvious how to do this that nobody thought to give it a name.<br>
<br>
—Scott<br>
<br>
> On Feb 6, 2021, at 4:07 PM, Manfred Bergmann <<a href="mailto:manfred.bergmann@me.com" target="_blank">manfred.bergmann@me.com</a>> wrote:<br>
> <br>
> <br>
> <br>
>> Am 06.02.2021 um 21:44 schrieb Luís Oliveira <<a href="mailto:luismbo@gmail.com" target="_blank">luismbo@gmail.com</a>>:<br>
>> <br>
>>> On Sat, 6 Feb 2021 at 20:07, Rudi Araújo <<a href="mailto:rudi.araujo@gmail.com" target="_blank">rudi.araujo@gmail.com</a>> wrote:<br>
>>> Class::newInstance() doesn't have any parameters (also, it's deprecated: better to use getConstructor() or getDeclaredConstructor() and call newInstance() on it).<br>
>> <br>
>> I guess this bit about getConstructor() explains why it'd be more<br>
>> convenient to use a Factory, or the Factory method pattern, or some<br>
>> dependency injection framework.<br>
>> <br>
> <br>
> Yeah. Could be.<br>
> But this constructor thingy could be hidden in a function similar as you would create a constructor function make-foo in Common Lisp.<br>
> The reflection stuff is not considered a good practice in certain types of applications.<br>
> <br>
> Dependency injection is about something else IMO. Well, Abstract Factory is about it, too, inversion of control.<br>
> It allows you to create something without having to know the concrete type and without having to have a source dependency on it.<br>
> In Common Lisp this could be solved easily by just separating a protocol from the implementation, maybe in separate packages.<br>
> <br>
> <br>
> <br>
> Manfred<br>
<br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline;float:none">Marco Antoniotti, Associate Professor</span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration:none">                </span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration:none"> </span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline;float:none">tel.</span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration:none;display:inline;float:none;white-space:pre"> </span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline;float:none">+39 - 02 64 48 79 01</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline;float:none">DISCo, Università Milano Bicocca U14 2043</span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration:none">     </span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration:none"> </span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre;word-spacing:0px;text-decoration:none"></span><a href="http://bimib.disco.unimib.it/" style="font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://bimib.disco.unimib.it</a><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline;float:none">Viale Sarca 336</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline;float:none">I-20126 Milan (MI) ITALY</span><br></div></div></div></div>