Submitted by fchung t3_z7hlb0 in technology
z0mbietime t1_iy6whrd wrote
Reply to comment by mandogvan in Why Functional Programming Should Be the Future of Software Development by fchung
> I think a functional codebase could be successful if architected intelligently and thoroughly beforehand.
And there it is. This OOP vs functional argument is idiotic. The reality is either can work assuming they were well architected and implemented cause that's all that matters. So many think it's one or the other instead of using both and determining which with common sense.
Is it a thing that has attributes? Boom class. Are you trying to perform some sort of action? Boom function. Is that action coupled to retrieve or update the remote state of the class? Then you have a method. Can the implementation of the method be reused or broken out into smaller reusable pieces that are easier to test? Back to function(s) but maybe call it/them within a method to improve usability. If every engineer followed this simple flow life would be so much easier
ToughAd4902 t1_iy6ytsu wrote
you clearly dont understand what functional programming is. it has nothing to do with putting code into functions, and your example makes 0 sense, classes have functions too... you can not use a single class and not write functional code.
z0mbietime t1_iy6zefh wrote
Oof you should Google before you comment. OOP and functional programming are design paradigms. There are languages that only supports a single paradigm like java. Also a Class "function" is a method...yup. unless you mean a static method but still a method. What I'm describing is a multi paradigm design (if that's the right term) and how to determine what to use.
So yeah, I'd say you clearly don't understand. Here let me Google that for you
https://www.imaginarycloud.com/blog/functional-programming-vs-oop/
https://stackoverflow.com/questions/155609/whats-the-difference-between-a-method-and-a-function
ToughAd4902 t1_iy704p8 wrote
Holy shit, what, Java has lambda's, that is functional programming. There is no way you just made that statement and think you have even an inkling of an idea what functional programming is, like you didn't even google if Java supports functional programming. Yes, functions in Java are not first class in themself so you can't write fully functional code, but that doesn't mean it doesn't support significant parts of functional programming.
Also, a function is a method you dimwit, that's literally the same thing, you found some random online definition saying they were different once, but they are literally the same exact thing
Java has lambda's, C# has LINQ (implemented with lambdas) there are plenty of OOP designed languages with functional aspects.
z0mbietime t1_iy71n2d wrote
Java has lambdas, cool? I haven't used it in years so I'll concede this is news to me but it's not a secret it was based on OOP. I think you're laying so hard into this one thing to save face when really you couldve just deleted your original comment.
> Also, a function is a method you dimwit
Yes a function... attached to a class...making it a method. Maybe lay off the name calling if you don't follow on the semantics
And as for linq in C# and lambda in java, congrats, you've successfully described a multi paradigm language. Spoiler alert: almost all of them are
ToughAd4902 t1_iy723ej wrote
In years? Java 8 was release in 2014, almost 9 years ago. How many years is "years" in this case? Your entire definition of what functional programming is has NOTHING to do with what actual functional programming is, you should be the one deleting your comment. Every language, literally ever, is going to put code into functions (or methods, if for whatever reason you want to name it that).
According to your definition, C is a purely functional language. Do you understand now how that makes literally 0 sense? C has no classes, nor "methods" with how you want to describe it, and all logic has to exist in functions, this is the first time I've ever heard of C being classified as a functional language
Since you still don't seem to understand the difference: functional languages treat functions as first class citizens. What does that mean? A first class function is when a function can be treated the same as a variable for all purposes. This means they can be assigned to variables, they can be passed as higher order functions and used as a higher kinded type.
Putting logic into a function does not make it functional.
z0mbietime t1_iy733wq wrote
Well if you're really that curious, I haven't touched Java since college in like 2012.
Also, maybe read back over my original comment that you so eagerly misinterpreted. Everything I said was language agnostic.
I'm not sure what your goal is other than to look obnoxious honestly. If you want a recap on what I'd originally said it was to use classes where applicable and functions where it makes sense. There is no class concept in pure functional programming. And a function must be attached to a class (aka method) in pure OOP. In other words, nothing I said was wrong soooo what exactly is your problem here?
And yes I do want to call it a method because that is what it's called.
ToughAd4902 t1_iy8asu2 wrote
Haskell, the definition of a pure functional language, has classes, and then by your definition, methods. Scala, a primarily functional language, has classes. F#, a functional language, has classes. There is like 2 functional languages that don't, and that has no reason about it being functional or not. You are completely wrong, and this is my last response to this. Not a single point you've brought up has been about OOP or Functional, you need to learn them before you can argue them, that is all.
It's just hilarious you led with"you should Google before you comment" when everything you've stated is literally Googleable
[deleted] t1_iy8pxcu wrote
[removed]
AutoModerator t1_iy8pxeg wrote
Thank you for your submission, but due to the high volume of spam coming from Medium.com and similar self-publishing sites, /r/Technology has opted to filter all of those posts pending mod approval. You may [message the moderators](/message/compose?to=/r/technology&subject=Request for post review) to request a review/approval provided you are not the author or are not associated at all with the submission. Thank you for understanding.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
Viewing a single comment thread. View all comments