If you were trying to explain someone how nicely Scala blends functional and object-oriented techniques, which example would you use?
Rather than going for Functional Programming or Object-Orientated Programming exclusively, you can go for a mixed approach, at in languages that support both such as JavaScript or Python. For example, you can still use classes and then pass a class instance to your function.
Functional programming is the programming technique that accentuates the functional factors required for creating and implementing the programs. OOP or the Object-Oriented Programs are the conceptual programming techniques that uses objects as the key.
In my canned Seductions of Scala talk, I end with an Actor example that uses functional-style pattern matching for determining the "kind" of message received and object-oriented-style polymorphic dispatch for one of the message "kinds" (a geometric shape to draw). It starts around slide 76.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With