Explaining functional programming to object-oriented programmers and less technical people

后端 未结 12 1436
小蘑菇
小蘑菇 2021-01-30 23:09

What are some good examples that I can use to explain functional programming?

The audience would be people with little programming experience, or people who only have ob

12条回答
  •  借酒劲吻你
    2021-01-30 23:48

    Compare it to sentence structure.

    I hit the ball, catch the ball, throw the ball:
    Procedural
    Hit(ball)
    Catch(ball)
    Throw(ball)

    OO
    Ball.Hit()
    Ball.Catch()
    Ball.Throw()

提交回复
热议问题