best way to disable update to code area

In some use cases, I would like to disable any update to the code area?
What is the best way to do so?

The readOnly option.