function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StephenDicksonStephenDickson 

Will Salesforce ever move away from Object-Oriented Programming?

Considering the inherent problems with OOP (https://medium.com/@cscalfani/goodbye-object-oriented-programming-a59cda4c0e53), and since Salesforce is always on the cutting edge, is there a universe in which Salesforce would move away from OOP and toward Functional Programing?  

I'm a certified Salesforce professional but still relatively new to writing code. I've been working on learning Apex in order to be able to hold my own as a Salesforce Developer......I'd love to be reassured that I'm not wasting my time learning Object-Oriented Programming.  

Admittedly, my grasp of the two different engineering approaches is very limited so I'm speaking as a newbie :)
Best Answer chosen by StephenDickson
Alain CabonAlain Cabon

Learning Object-Oriented Programming is not a waste of time because Apex is still very used for the server side applications (Visualforce page controllers, back-end applications (batches)).

The big change was the new technologies with Lightning ( Aura, Web component (LWC) and open source now) which uses Javascript ( client and controllers ).

Javascript (Multi-Paradigm Coding Language) is not a pure functional language but given that you can use first-class functions and lambda calculus, that is sufficient to act like a functional language.

Many scripting languages, including Perl, Python, PHP, Lua, Tcl/Tk, JavaScript and Io, have first-class functions.

First-class functions are a necessity for the functional programming style, in which the use of higher-order functions is a standard practice. A simple example of a higher-ordered function is the map function, which takes, as its arguments, a function and a list, and returns the list formed by applying the function to each member of the list. For a language to support map, it must support passing a function as an argument.

FIRST CLASS CITIZEN, HIGHER ORDER : JAVASCRIPT


  // loading a function into a variable => first class citizen
  var f = function(){
    …
  };
  // Higher Order => function used as a parameter
  function callIt(aFunction) {
    aFunction();
  }

  // Higher Order => function returns a function
  function create() {
    return function(param){
      …
    }
  }


R.apex
R.apex is a functional library based on Apex, inspired by Lodash and Ramda.js.
Why R.apex?
Apex is a pure object-oriented lanuage, and it does not provide any builtin features to make functional programming easier. The biggest obstacle in Apex is that functions(methods) are not First Class Citizens, the building blocks in a functional world. R.apex aims to pave the way for functional programming, and makes every attempt to mimic the functional features in Apex as much as possible. So we can adopt a functional paradigm based on R.apex.

https://github.com/PropicSignifi/R.apex

 

All Answers

AbhishekAbhishek (Salesforce Developers) 
Hi Stephen,

Always follow the release notes so that you will have a complete update about salesforce.

From release to release there are many changes coming from salesforce end.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks.



 
Alain CabonAlain Cabon

Learning Object-Oriented Programming is not a waste of time because Apex is still very used for the server side applications (Visualforce page controllers, back-end applications (batches)).

The big change was the new technologies with Lightning ( Aura, Web component (LWC) and open source now) which uses Javascript ( client and controllers ).

Javascript (Multi-Paradigm Coding Language) is not a pure functional language but given that you can use first-class functions and lambda calculus, that is sufficient to act like a functional language.

Many scripting languages, including Perl, Python, PHP, Lua, Tcl/Tk, JavaScript and Io, have first-class functions.

First-class functions are a necessity for the functional programming style, in which the use of higher-order functions is a standard practice. A simple example of a higher-ordered function is the map function, which takes, as its arguments, a function and a list, and returns the list formed by applying the function to each member of the list. For a language to support map, it must support passing a function as an argument.

FIRST CLASS CITIZEN, HIGHER ORDER : JAVASCRIPT


  // loading a function into a variable => first class citizen
  var f = function(){
    …
  };
  // Higher Order => function used as a parameter
  function callIt(aFunction) {
    aFunction();
  }

  // Higher Order => function returns a function
  function create() {
    return function(param){
      …
    }
  }


R.apex
R.apex is a functional library based on Apex, inspired by Lodash and Ramda.js.
Why R.apex?
Apex is a pure object-oriented lanuage, and it does not provide any builtin features to make functional programming easier. The biggest obstacle in Apex is that functions(methods) are not First Class Citizens, the building blocks in a functional world. R.apex aims to pave the way for functional programming, and makes every attempt to mimic the functional features in Apex as much as possible. So we can adopt a functional paradigm based on R.apex.

https://github.com/PropicSignifi/R.apex

 
This was selected as the best answer