Callysto
  • Introduction
  • Quickstart Guide
  • Preface
  • What is Computational Thinking?
  • Philosophy
    • Goals of the Callysto Project
    • Software tools - Eat Your Own Dogfood
  • Notebook Design
    • Notebook Format
    • Template
    • Notebook Reviewer's Guide
  • Development Team Structure and Process
  • Extensions
    • Notebook Binders, Pullers, and Viewers
    • Nbplus
      • Geogebra
  • Coding
    • Jupyter, Under the Hood
    • Best Practices for Code Development
    • Coding Mistakes to Avoid
    • Markdown Language
    • Bug Reporting
    • Github Workflow
    • Troubleshooting
  • Information Visualization
    • Plotting
    • Audio Generation
    • Animations - D3.js
    • Animations - HTML5
    • Widgets for Interactivity
  • Online Resources
    • Useful Links
    • Contacts
Powered by GitBook
On this page
  • Use textContent not innerHTML, for text inputs
  • Iframes
  • System time
  • Infovis
  • Use Python for heavy processing
  • Do not parse HTML with regex
  1. Coding

Coding Mistakes to Avoid

PreviousBest Practices for Code DevelopmentNextMarkdown Language

Last updated 4 years ago

Many of these are common mistakes we have seen in Jupyter notebook development. Feel free to add more to this file.

Use textContent not innerHTML, for text inputs

In JS functions if you have a DOM element (divs, svg, etc.) .innerHTML, if you get information from a form, it executes when it reads the form data. Susceptible to XSS attacks. , for more info you can read:

Iframes

Iframes are good if you need to contain things, but if you want to access variables in those things then iframes are bad. Instead use magics and html and javascript function calls from the display library. It produces cleaner code too.

System time

Do not make programs that are dependent on system time.

Infovis

No pie charts or spaghetti plots. Avoid clutter, and volume comparisons. See the infovis section of the manual for more in depth information.

Use Python for heavy processing

JS uses the browser aka local resources. Python uses the remote Callysto Hub resources. Ideally you will do any heavy processing in Python and then pass the results to JS. Try to avoid doing large processing tasks with the user's local resources.

Do not parse HTML with regex

or other level 2 languages.

Use textContent instead
https://stackoverflow.com/questions/21311299/nodevalue-vs-innerhtml-and-textcontent-how-to-choose
Do not parse HTML with regex