Monday, 20 October 2014

Scala Notes 28: Object-oriented vs. Functional in Scala

Object-oriented

The motivation of object-oriented is: all but the most trivial programs need some sort of structure. So put data and operations into some form of containers(objects). It combines data with operations under a formalized interface.
Scala is an object-oriented language in pure form: every value is an object and every operation is a method call.

Functional

Functions are first-class values.
The operations of a program should map input values to output values rather than change data in place. In the other words, methods should not have any side effects.
Immutable data structure are one of the cornerstones of functional programming.




No comments:

Post a Comment