Message Boards Message Boards

Managing large projects and OOP

I use Object Oriented Programming (OOP) and the Wolfram Language daily. There are huge advantageous to both, but the ones in WL are, in my opinion, greater so I'd like to understand how the benefits of OOP can be paralleled in WL.

OOP makes it very easy to "silo" data into objects, access relevant methods, and understand return types much easier than in WL. There are a hodgepodge of workarounds in WL: Contexts, Associations, Modules, and WSM. But ultimately they're not as easy to use as OOP unless I'm missing something.

The WL has recently added Entities, TimeObjects, and other object formats, but I don't see how this can be generalized to any user-defined class and object instantiation. Any thoughts form the community?

POSTED BY: Eric Smith
2 Replies

Thanks for the response. I was actually able to meet Roman this year at WTC. I've purchased the first edition of the book ($4 on Amazon).

Whatever you want to achieve with OO might also be achievable with just Mathematica's "natural" constructs. Instead of shoe-horning Mathematica into a style you're already familiar with

I'm with you on this. Also, I've used Mathematica longer than I've used OOP. That said, I've never worked on large projects with Mathematica and probably have missed some important aspects of the language. I'll go through the book and see if it's clearer to me. The documentation for UpValues, UpSet, UpSetDelayed never gave me an "ah ha" moment that helped me see the potential of Mathematica in scalability.

POSTED BY: Eric Smith
Posted 9 years ago

Roman Maeder wrote several books on Mathematica programming techniques, in particular "The Mathematica Programmer". That book includes chapters on OOP in Mathematica.

You should also study the documentation for UpValues, UpSet, UpSetDelayed, and so on. These constructs can be put to use to create an OO flavor.

But OO has different meanings to different people, so you might add some specific questions about how to achieve your OO goals in Mathematica. Is it identity your after? Statefulness? Polymorphism? Dispatch? Scoping? Encapsulation?

Be prepared, however, for some pushback. Whatever you want to achieve with OO might also be achievable with just Mathematica's "natural" constructs. Instead of shoe-horning Mathematica into a style you're already familiar with, take the opportunity to expand your knowledge and expertise by embracing Mathematica's inherent strengths.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract