Thread: ZO_Object
View Single Post
07/07/15, 12:47 PM   #10
Atropos
 
Atropos's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 19
Originally Posted by XanDDemoX View Post
In general functional programming vs oop can actually be a bit of a contensious topic. Theres a few comparisons of varying biases to be found on google
I understand the difference between functional and OO. I was trying to encourage some discussion to quantify the advantages of using objectification in actual ESO addon applications.

For example, the following thought exercise:

Suppose you have 20 objects in a table containing data that updates several times per second. You want to render this data in a way that updates every 10th of a second (10x per second). Two ways to approach the problem might be:

Functional - Have a single OnUpdate function which loops over the elements of the table and executes some function on each element sequentially.

Object Oriented - Create each element of the table as an object that inherits its own methods and updating function. Each child object updates itself.

Is one approach more efficient (in terms of performance)? It's generally not clear to me whether there is a gain from trying to use object inheritance in LUA other than simply making it easier to think about certain types of problems.
  Reply With Quote