DEV Community


Discussion on: Functional VS Object-Oriented Programming

krtb profile image
Kurt Bauer Author

haha, yessss, this is exactly what happened to me when I built my first large rails project. I created more objects to plug the holes in a sinking ship and then gave up and how to do a lot of refactoring. But it's also spurred me into looking at different back-end languages like Node and Golang, to see how forgiving either one can be when hitting that wall. Still working through them though. Have you found an OO back-end language where you feel it's easier to do that refactoring?

ssimontis profile image
Scott Simontis

Hmm...not quite. C# is what I have been using for the past 7 years straight and is the language I know best by far. I'm so used to it, it might be difficult for me to objectively compare things. I think the implementation of generics is really solid, which reduces the number of objects I have to write. My only qualm that is language-specific is that functional programming constructs look really weird and take a ton of code...10 lines of F# can take 100 lines of C#, and the C# code looks hideous with generics everywhere.

I think that having a base Object class inherited by all objects is a huge mistake and brings no value whatsoever. All it does it ensure that I need to do a ton of defensive type checking and reflection whenever I try to compare two objects. There isn't really any behavior that belongs on that level that is applicable to every single object. I believe C++ does not fall victim to this base object mentality, and I have been studying C++ lately to try and get back into embedded/AI stuff.

Ironically, I have also been looking into Ruby because I have heard it is a developer's language and a really enjoyable experience. I have not gotten to the point of appreciating much of it, but I am going to keep trying, dammit!

I also played around with Racket (a Scheme dialog) and found myself intrigued by LISPs. Blurring the line between code and data is pretty neat, but sometimes it's so abstract that I have no idea if what I am doing works. And no way in hell I could explain the code to someone else confidently.

Honestly, maybe TypeScript? I like the typing because it prevents a bunch of stupid errors and guarantees some consistency between objects. It's such an easy language to hack around in, but most uses these days seem too primitive. Why deal with Express and write the same middleware that a million other developers have written to? Why not abstract that all away to a more mature back-end runtime? I guess that's the downside to needing thousands of random dependencies to accomplish anything, big building blocks are hard.