Miscellaneous

  • Don't invoke special functionality in MPS at places that don't officially support it e.g. invoking the generator in typesystem rules. This might not working in future versions of MPS.
  • Treat warnings in MPS as errors1 and also don't ignore warnings and errors. Warnings might become errors or even make the compilation fail in the future. Ignoring too many messages can hide real errors that have to be addressed.
  • Use the access language instead of directly calling ModelAccess methods.
  • Use isInstanceof to check if a node is an instance of a concept.
  • Use tasks for asynchronous work or work that takes a long time.
  • Be careful when using unicode inside MPS. It might break something. (ticket #1,ticket #2)
  • Use gradle for build scripts (minimal example).
  • Write tests for new features and bugs that you have fixed that were not caught by a test
  • Use the built-in collection classes such as collection, set, list and map (documentation). Use the correct type of collection2.
  • Be careful with multithreading code in any of the language aspects. It is better placed in an action or background task.
  • Do not leave debug statements in production code (exception debug log statements).
  • When asynchronous code freezes (e.g. on console:), try to call it with ApplicationManager.getApplication().invokeLater(runnable).
  • Implement INamedConcept in concepts that have a name. The name property can be automatically used as the name for root nodes, references etc.
  • Avoid deeply nested call chains e.g. nodea.nodeb.nodec.property. Consider providing a method do access a property or method for the deeper levels.
  • Prefer composition over inheritance (Specific Languages Blog)
  • Warnings should not replace documentation (Specific Languages Blog)

Last update: March 17, 2022

Comments

Back to top