TransWikia.com

Making a notebook unsavable, so that I don't accidentally mess up the code

Mathematica Asked on May 7, 2021

I have an algorithm in a notebook that I don’t want to change. I used it regularly. I’m afraid I might accidentally modify a parameter. I’d like the notebook to be executable, perhaps editable, but permanently unsaveable. I’ve tried to accomplish this by:

Preferences>Advanced>OptionsInspector>NotebookOptions>FileOptions>Savable->False

However, it appears that this setting is lost when I quit Mathematica. Is there a way to make it permanent?

2 Answers

An extended comment...

I believe your post opens up the much larger question of refactoring code.

Martin Fowler wrote a brilliant book on the topic Refactoring - Improving the Design of Existing Code

The book addresses almost every conceivable way to protect the code that works and iteratively improve it.

Fowler (with Kent Beck) published the 2nd edition of this classic work in 2018.

It will make anyone that writes code in any language better at the craft of coding and leave the world with better code.


It also occurred to me to edit this post and recommend Martin Fowler's other books and contributions, e.g.:

Analysis Patterns and of course his work with both: Agile Software Development and Software Architecture.

All of Fowler's work has direct application in developing/writing/managing Mathematica code.

enter image description here

Answered by Jagra on May 7, 2021

The setting is lost because precisely the notebook is not saveable (in this case, you will not be asked if you want save the notebook), because precisely you don't want it to be saved (!).

To force the saving use the menu "Save as...".

This is documented. Look "saveable" in the documentation.

Answered by andre314 on May 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP