Skip to main content

programming - Which Object-oriented paradigm approach to use in Mathematica?


Which Object-Oriented Paradigm (OOP) approach to use in Mathematica for:




  • general implementation, or




  • a particular project?





There are a lot of related questions and answers in MSE on doing OOP that concentrate mostly on the "How?" but not on discussing "Why/which OOP approach?" (Or "What are the pre-conditions and consequences of using ...?")


Here is a mind-map that shows a way to compare the proposed OOP implementations and styles. (The image links to a PDF that has clickable hyperlinks.)


OOP in Mathematica approaches


It is probably best the responses of this question to be summarized in a comparison table with columns and rows derived/related to that mind-map.


Links


Here is a link to a PDF of the mind-map with clickable/linked references also given below.


Core concepts of the implementations


Objects Pure objects



  • ClasslessObjects, Jakub Kuczmarski, (2014), GitHub, MSE




  • JavaScript style




Struct object


Associations Rules

  • “The Mathematica Programmer: Object-Oriented Programming”, Maeder (1990), WLA


Classes (types)

  • Type declarations, Leonid Shifrin (2012), MSE


Object-oriented design patterns



  • “Implementation of OOP Design Patterns in Mathematica”, Antonov (2016), GitHub, WordPress




  • Uses the same approach to classes as Leonid Shifrin’s




Signature overloading

Modeling interactions between classes / objects UML diagrams


  • … included since it emphasizes the necessity of big-picture view in OOP designs

  • “UML diagrams creation and generation”, Antonov, (2016), GitHub, WordPress


Comparison table (example)


\begin{array} {|r|r|} \hline \textbf{Approach} & \textbf{Core concepts} & \textbf{Properties} & \textbf{When to use?} & \textbf{Why use it?} \\ \hline ClasslessObjects \\ \hline MTools \\ \hline Class \; types \; definitions \\ \hline ... \\ \hline \end{array}




Comments