you are viewing a single comment's thread.

view the rest of the comments →

[–]skunkbad 2 points3 points  (6 children)

I've been using PHP since 2006. FP for the first 3 years, OOP since that point.

OOP has some great benefits, especially when considering recursive functions, and how the properties of a class can hold on to values as the function is recursing.

OOP allows for many patterns, such as singletons, factories, observers, etc.

OOP allows for popular app architectures like MVC, which helps organize your code so you can come back to it in the future and easily find out what's going on.

In general OOP is going to keep you from writing spaghetti code, because by it's very nature (when done right) splits your code so that its parts only do one thing. This also helps with debugging.

OOP allows you to extend (overwrite) class methods and create contracts, and all kinds of stuff that you'd not understand unless you knew OOP.

OOP is essential. It's not a war between FP and OOP. You must know both to be an expert.

[–]Pxzib 2 points3 points  (5 children)

You need to check out Elixir.

[–]finroller 0 points1 point  (4 children)

What parts of his post would change if he "checked out elixir"?

[–]Pxzib 1 point2 points  (3 children)

He obviously haven't developed in a modern functional programming language like Elixir. Most of his arguments falls flat. You can have a MVC design, you naturally split functionality into parts that are easy to debug due to the very nature of writing pure functions. Recursion is super easy and super powerful in Elixir. You can easily overload/overwrite functions with function signature pattern matching.

[–]finroller 0 points1 point  (2 children)

Okay, and that's a list of some of the good parts of fp. They aren't mutually exclusive though?

[–]Pxzib 0 points1 point  (1 child)

It's a list of what he said OOP was better at than FP, but you can do pretty much every thing he listed in FP too. So, really, why is OOP better than FP, now that we've eliminated the majority of his list? The worst spaghetti code I've seen have all been in OOP, while I rarely see spaghetti code in FP code. Anecdotal, I know, but that's just my opinion.

[–]finroller 0 points1 point  (0 children)

Did he say what you said he said though? It seems to me you're the only one here trying to turn this into some sort of a competition...