DEV Community

Discussion on: SOLID principles in the Go programming language

Collapse
 
jonasbarka profile image
Jonas Barkå

I feel like SOLID has lost much of it's relevance even for OO languages. Looking at my main language C# it is moving away from many of the classic OO patterns to something that looks a bit like Go.

That said I think you let Go off the hook too quickly on the Open-Closed principle. I don't think not having inheritance mean it doesn't apply. And you certainly do not get it "for free".

Collapse
 
jrwren profile image
Jay R. Wren

Could you give an example where the open closed principle applies in Go?

Collapse
 
jonasbarka profile image
Jonas Barkå

"... Robert C. Martin and others redefined the Open/Closed Principle to the Polymorphic Open/Closed Principle. It uses interfaces instead of superclasses to allow different implementations which you can easily substitute without changing the code that uses them. The interfaces are closed for modifications, and you can provide new implementations to extend the functionality of your software."

google.com/amp/s/stackify.com/soli...

Noone likes inheritance anymore :)

Thread Thread
 
jrwren profile image
Jay R. Wren

OK, and that is part of my point.