
AstonJ
Has learning a functional language changed the way you use or think about OOP languages?
Yes? No? If yes, how/in what way?
Most Liked

dimitarvp
FP really drove home the message to me that I was doing programming wrong my entire life before that.
…Namely “data structures > code”. If you know the shape of your data and can think in data then the code kind of comes naturally after – LISP is an excellent demonstration of this approach but Elixir is quite close with its metaprogramming abilities as well.
So I am looking into getting more into the math foundations of FP and then learn a ton of data structures and algorithms.
FP taught me that the programming language syntax, 99.9% of the time, doesn’t matter one bit. What’s important is the data. And having an excellent runtime like the BEAM VM.

brentjanderson
Absolutely. Ultimately both OOP and FP can get great work done, but I’ve found that a functional style helps clarify my thinking. Separating the data structures from the functions brings a tremendous clarity to my designs.
These days, I actually use classes for dependency injection containers - the meat of the program still tends to be highly functional.

Korbin73
My biggest takeaways while learning and now preferring FP that have changed my perspective on OOP languages is the following (some of them are not good):
- Quarantine side effects. This has help a lot with reducing bugs and making unit testing easier since it means that my pure functions aren’t intermingled with all of the effectful code.
- It made me realize how much harder OOP is to get the same result. Mutability adds complexity that most of us don’t even notice: Time. When a value changes over time you pretty much have to us a debugger to see it change and why it’s changing. In FP it’s just a new binding. Also, coupling behavior with data makes it even harder to manage because you end up with temporal coupling when one property or method changes a value and a method was depending on the value of a member var to be in a certain state. In FP, new state changes are very explicit (and far simpler). State (data) goes in… and new state comes out.
- The bad part is that FP has made me realize that is so much simpler to program in so I get annoyed in OOP languages when I have to do something simple like create a class just to add behavior to my program when a simple function will do.
Popular Backend topics










Other popular topics










Latest in Backend
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /sublime-text
- /textmate
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim