4

I am interested in understanding what is modernly (2023) considered a good practice in writing packages in mma.

There are already many beautiful SE posts when it comes to packages, but they are relatively old (6+ years) which makes me wonder whether i'm missing a bigger or newer picture.

I am creating a list with various links that I believe cover the most useful concepts of packages that I've seen so far which I hope could act as a starting point for others.

  1. How to create packages
  2. How to best organise a package
  3. How to use mma packages + Git
  4. How to autogenerate packages
  5. How to make MMA documentation for a package.
  6. How to install packages
  7. How to create packlets from packages for easy distribution

These above steps appear to me like a strong starting point to also allow some level of version control, but I do not know if things have moved on to different methods or 'tricks' over the last few years.

alex
  • 1,396
  • 7
  • 18
  • 2
    I saw basic introduction on making package here but it does not know about git and auto-generate, these are too advanced. – Nasser Feb 20 '23 at 13:30
  • Hi @Nasser, thank you for the link. I am thankful that there is a fair amount of documentation about how one makes a package. But the fact that the vast majority of them is fairly old made me wonder if the field has moved to a different method instead (and I've been left behind!). – alex Feb 20 '23 at 13:47
  • 4
    This question is vague, and it isn’t clear how it is different from the linked questions – Jason B. Feb 20 '23 at 17:35
  • 1
    In the last few years, packages themselves haven't changed. The tools to edit and document them have improved and now we have paclets. I understand that this question is too vague, but I find it useful to have all those five links in a single page. – Gustavo Delfino Feb 21 '23 at 14:13
  • Thank you all for your comments. Should I edit the post to make it a compilation page rather than a question? I could add further resources for those who might want a more comprehensive intro to packages and paclets. – alex Feb 21 '23 at 14:47
  • @alex - come up with a specific question to make this topic distinct, otherwise it does not belong on stack exchange. – Jason B. Feb 21 '23 at 18:13
  • Hi Jason, I think i'm struggling to make my point across mostly based on my inexperience. My question is simply whether "packages" and "paclets" are a heavily used tool or whether they are good coding practice in the MMA world. The reason of my doubt was simply how old the SE posts regarding packages were. I anticipated that a heavily used tool or practice would have raised more posts over the last 6 years. I just wanted to know whether there is a better practice out there. – alex Feb 21 '23 at 18:17
  • I think there are few questions on packages here, because my guess is that 99.9% of users of Mathematica simply use the notebook to write Mathematica code (i.e. just functions). There are few who write packages, those will be advanced users who write packages for use by others or may be for themselves. – Nasser Feb 21 '23 at 20:49
  • 1
    @alex You could add this info to the "tag wiki" at https://mathematica.stackexchange.com/tags/packages/info or https://mathematica.stackexchange.com/tags/paclets/info – Chris K Feb 21 '23 at 21:33
  • Hi @Nasser, this is actually getting to the crux of my question: Why is that the case that 99% of users do not use packages? Is it because it is an advanced topic or is it because there is no real need for their existence? Is 'the package' something that we should all try to use for good form or is it a niche tool? – alex Feb 21 '23 at 23:05
  • My guess is that Mathematica is looked at by most users and students as a very fancy/advanced interactive calculator. Something to use to compute things/do some calculations/solve one problem/exploring and trying ideas, analyze some data, make fancy plots, use Manipulate to make some small animation/simulation and so on. It is not looked at as platform to develop and deploy a standalone application, like one does with C,C++, Java and so on. Mathematica does not even have a debugger. So most users do not see a need to develop their code using packages, and just use notebooks to write code. – Nasser Feb 22 '23 at 06:47
  • 1
    Mathematica does not even have a debugger. I take this back. There is a build in debugger in Mathematica, but only 3 people in the whole world know how use it. And it works only on code written inside a notebook, not a package, this is if you can figure how to use it. The debugger that comes in workbench does not even work half the time and is broken. I tried it and gave up on the workbench. But I digress. – Nasser Feb 22 '23 at 06:57
  • Hi @Nasser, I feel that this is pretty much what I wanted to understand, so thank you for giving me your point of view. In your opinion, at which point should one stop writing functions and then starting to write packages. I can see that if one has many standalone projects it would not necessitate packages, but of course once you start using the same function over and over, you don't want to have to copy/paste initialisation cells and packages are better. But is there a certain type of work that should use packages over functions? – alex Feb 22 '23 at 09:54
  • @ChrisK, thank you for the suggestion, I do not have priviledges to post without peer review and the queue is full apparently for the last few hours. I'll try again later. :) – alex Feb 22 '23 at 09:55

0 Answers0