Skip to content
DevMeme
6382 of 7590
FunctionalProgramming Post #6996 · source on Telegram

When a Functional Programmer Explains Object-Oriented Programming

Description

This meme uses a well-known still from the movie 'Pulp Fiction,' featuring characters Vincent Vega (John Travolta) and Jules Winnfield (Samuel L. Jackson) driving in a car. Vincent is in the foreground, smiling slyly, while Jules is in the passenger seat. White, all-caps text is overlaid on the image. The top text poses a question: 'YOU KNOW WHAT THEY CALL OBJECTS IN FUNCTIONAL PROGRAMMING?'. The punchline at the bottom of the image is 'SIDE EFFECTS'. The humor is rooted in the fundamental differences between programming paradigms. In functional programming (FP), the ideal is to use 'pure functions' which avoid changing state or having observable interactions with the outside world, collectively known as side effects. Object-Oriented Programming (OOP), in contrast, is built upon objects that encapsulate both state and behavior. From a purist FP perspective, the mutation of an object's state is a classic example of a side effect, making the meme a clever jab at how FP devotees view the core construct of OOP

Comments

10
Anonymous ★ Top Pick The main difference is that in OOP, you encapsulate state in objects to control side effects, whereas in FP, you encapsulate side effects in monads to control your sanity
  1. Anonymous ★ Top Pick

    The main difference is that in OOP, you encapsulate state in objects to control side effects, whereas in FP, you encapsulate side effects in monads to control your sanity

  2. Anonymous

    If your junior insists objects belong in your Haskell module, just remind them that’s what the IO monad is already apologising for

  3. Anonymous

    After 15 years of explaining to junior devs why their singleton pattern is actually a monad in disguise, you realize the real side effect was the friends we mutated along the way

  4. Anonymous

    In functional programming, we don't have objects - we have 'unfortunate necessities' that violate referential transparency. It's like showing up to a Haskell conference with a mutable variable: technically possible, but everyone knows you're breaking the social contract. The real joke? After 20 years of OOP, senior engineers finally understand why Lisp developers were smirking at us the whole time

  5. Anonymous

    In FP they’re “side effects”; in the boardroom they’re “metrics” - congrats, your pure function now returns IO[Unit]

  6. Anonymous

    In FP, an “object” is just state you forgot to quarantine - IO[SideEffect] is the witness protection program

  7. Anonymous

    FP purists calling OOP objects 'side effects' - like blaming divine intervention for every impure monad in prod

  8. @coodi 1y

    You know how they call the procedural programming? - Functional programming

  9. @deadgnom32 1y

    you know how they call higher order functions in OOP? design patterns

  10. @Azure_Developer 1y

    Royal with cheese

Use J and K for navigation