Viewing a single comment thread. View all comments

mandogvan t1_iy6twjg wrote

Having worked on functional codebases (legacy code which were actively replacing), I was ready to shit on this article. But it makes salient points, some of which I had not considered.

I think a functional codebase could be successful if architected intelligently and thoroughly beforehand. And everybody on board has to drink the koolaid.

That being said, the functional codebases I have seen have been steam piles of spaghetti. Could it work and work well? Maybe. I’m not going to try it though. Not again.

16

z0mbietime t1_iy6whrd wrote

> 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

11

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.

−16

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

12

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.

−13

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

5

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.

−9

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.

4

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

2

[deleted] t1_iy8pxcu wrote

[removed]

1

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.

1

Netmould t1_iy6xwx9 wrote

«I think a functional codebase could be successful if architected intelligently and thoroughly beforehand» You have waaaay too much faith in humanity.

You write some prototype code, it works 80% of time, it goes into production right away (because PM didn’t plan time/resources for any tests).

Now when you code works in production, 80% of your time is spent fixing bugs “as fast as possible” and “by any means necessary”.

That goes for some time (years in most cases) until you are getting new CTO (or manager high enough in food chain), who proposes “reorganization”, in other words someone (not you, because you left this company some time ago) has to make a new, “better” system instead of old one.

No one working in the company has the slightest idea about how this software works, so manager hires a subcontractor (some Indian or Philippine guys with accent so thick you don’t understand the word).

After some time (and money) spent, your “new” software works 50% of time, has 50% of old’s functionality, and needs to be translated into proper English.

At this point managers either:

  1. go with “new” system regardless of enduser complains.
  2. if backslash is big enough, they hire proper consultants who costs rocket science amount of money, and they make it work somehow.

Edit: I didn’t called out developers from Asia based on their race or something. Its just IT managers are going for the “cheapest option in the World” when they look for contractors, and (imo) some Asian bodyshops made up out of students are the cheapest. You get what you paid for…

4

Fishanz t1_iy6w7xy wrote

Architected intelligently and thoroughly beforehand? What is this blasphemy! It almost smacks of waterfall!!

3

FranticToaster t1_iy6ww2o wrote

Works like a dream until number of users exceeds the size of the UAT group.

0