Why do you think the Gang of Four book uses Smalltalk and C++ without any traces from Java?
Why do you think the Gang of Four book uses Smalltalk and C++ without any traces from Java?
… perhaps came later, with embellishment
DI allows a generic runtime to instantiate and compose component graphs [via declarative initialization contexts]. The idea was we'd have reusable components. Somewhere along the line came Spring ("J2EE is too complex" lol) and before you knew it, any old application was using DI and now (per a scan of comments in this thread) everyone is quite confused what is the purpose of "passing variables to your functions" in this obscure manner.
> NEO was re-positioned as a Java system with the introduction of the "Joe" framework,[2] but it saw little use. Components of NEO and Joe were eventually subsumed into Enterprise JavaBeans
https://en.m.wikipedia.org/wiki/Distributed_Objects_Everywhe...
And we did just the same with objects factories and directories on the listed technologies.
Perhaps "What people like to blame Java for…" is how it was required to be done in Java.
Perhaps Java became a victim of enterprise culture, just like nowadays everyone is doing system level DI with Kubernetes orchestrations and WebAPI?
When those are the appropriate search keywords.
But, unlike Java, Smalltalk is (utterly) dynamic, and you don't have to declare a class for your code block. In Java, you had to dance that dance, until lambdas were introduced to let the compiler do that for you.
"Smalltalk blocks and closures origin and evolution" Juan Escalada
And no lambdas are not implemented that way, rather they take advantage of invokedynamic.
"Every object in Smalltalk, even a lowly integer, has a set of messages, a protocol, that defines the explicit communication to which that object can respond. Internally, objects may have local storage and access to other shared information which comprise the implicit context of all communication."
p290 Byte Magazine 1981
http://worrydream.com/refs/Ingalls%20-%20Design%20Principles...
> > > … instead of a function…
Instead of a function, a message.
Let's take that literally —
perform: aSymbol with: anObject
Answer the result of sending a binary message
to the receiver with selector aSymbol and argument
anObject. Report an error if the number of arguments
expected by the selector is not one.
(For more of those methods, see p425https://rmod-files.lille.inria.fr/FreeBooks/SmalltalkVTutori... )
Last-time I remember using those #perform methods, it was for testing — walking the code sending arbitrary messages and and arguments.
"Design Patterns: Elements of Reusable Object-Oriented Software"
You forgot to check the publishing date,
https://en.wikipedia.org/wiki/Design_Patterns
Publication date => 1994
https://en.wikipedia.org/wiki/Java_(programming_language)
First public release => 1995
No I did not.
You don't. I do.
The authors’ statement is clear.