by PaulHoule · 11y ago · 0 comments
http://www.lispcast.com/solid-principles-in-clojure
which elaborates on SOLID OO design in Clojure and provides some code examples. For example there's a pretty clear example of the right way to apply SRP to a functional paradigm.
I'd interpret it as you need SOLID to do successful OO (required but not sufficient), but using as much SOLID as reasonably possible under any paradigm also happens to result in good/better software. In that way there can be a lot of confusion about what is OO and what is merely usually found nearby OO but isn't OO specific.
I think the value of SOLID is that it gives you tools for thinking about your code.
I think there is lots of room for a critique and even a debunking of SOLID. Indeed, Kevin Henney has done just that. http://yowconference.com.au/slides/yow2013/Henney-SOLIDDecon...
Though I already had one foot in that realm with playing around with Racket and learning Scheme in college.
LOOPS in Interlisp-D, here for a time travel to Xerox PARC.
http://www.softwarepreservation.org/projects/LISP/interlisp_...
Check the "LOOPS, A Friendly Prime" book.
Meta-methods are at the core of CLOS, Common Lisp Object System, made famous with the "The Art of Metaobject Protocol" book.
http://www.amazon.de/The-Metaobject-Protocol-Gregor-Kiczales...
They are also used by Dylan, the Lisp with Algol like syntax developed by Apple,
Protocols provide the same type of polymorphism offered by Objective-C protocols, Java/C# interfaces, Go interfaces, ...
Many mainstream developers might only know one way of doing OO, but back in the day we could choose between Smalltalk, Lisp, Beta, Eiffel, Sather, C++, Modula-3, Oberon, Component Pascal, SELF, .....
Each had their own view how encapsulation, polymorphism, message dispatch, type extensions should take place.
So it is kind of funny to have some in FP languages bashing OO, while successful FP languages are actually hybrid. At the same time having people in teh OO side bashing FP, while their languages keep absorbing FP concepts.
Eventually we will get back to Smalltalk and Lisp, which already provided both ways in the late 70's.
> OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them. [1]
You can do this easily with multimethods, in fact they allow for significantly "later" binding than traditional OO languages like Java or C++.
[1] http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay...
protocols are little more than open-ended interfaces (i.e. I can extend them at run-time to my things and to other things).
So, in addition to single dispatch based on class (a la Java), you could also dispatch based on the classes of multiple parameters or on the value of the field 3 objects deep.