Skip to content

This guide recommends software tools and practices to help with developing reproducible, reusable, and production software with MATLAB.

License

Notifications You must be signed in to change notification settings

mathworks/MATLAB-Software-Workflows-Adoption

Repository files navigation

When and Why to Adopt Software Development Workflows in MATLAB

The Reluctant Developer's Guide to the Software Developer's Galaxy

Do you write MATLAB code that needs to keep working tomorrow (or every day), or on somebody else's machine (or on thousands of machines)? Has it ever not worked? If so, read on for recommended tools and practices to help increase your likelihood of success.

MATLAB® code is sometimes just a means to an end - an ephemeral artifact created and discarded on the path to insight. But more often than not, the code itself has intrinsic value and is worth preserving. It's a record of the work that was done. It's a script to automate a time-consuming process. It's a runnable program to reproduce an analysis. It's a collection of useful utilities for daily work. It's a detailed simulation and app supporting a large team's design process. It's an algorithm going into a production system.

If your code is going to stick around, you are likely to face increasingly difficult questions as more people expect more from your code:

  • Can you run it and get the same result a month from now?
  • Can somebody else run it and get the same result?
  • Can a team of engineers rely on it for their daily work?
  • Can you scale the development of the code across a large team of people?

So how do you address these challenges? Turn to software developers. They've developed great tools and techniques for exactly this. Lots of tools. Lots and lots of tools. Before even starting to learn how to use these tools, it can be overwhelming just figuring out which tools are worth adopting and why. That's where this guide hopes to help.

Some of these tools and techniques are quite useful for any MATLAB code that is going to stick around, while others may be overkill for simple projects. This guide has suggestions for each of three use cases. The most important tools for each use case are marked in bold with a ⭐️.

Use Case Primary Goal Recommended Tools and Practices
Reproducible Software Ensure that code to solve a specific problem consistently runs and produces the same result
  • MATLAB Projects ⭐️
  • Git™ version control ⭐️
  • Dependency Analyzer
  • README file
Reusable Software Enable reuse across contexts and users Reproducible Software Tools, plus:
  • Unit Tests ⭐️
  • Git branches
  • Releases
  • Pull requests/merge requests
  • Comparison (diff/merge) tool
  • Project structure standards
  • Coding standards
  • Build/develop directions in README
Production Software Reliably deliver a release whenever needed Reusable Software Tools, plus:
  • Build tool ⭐️
  • CI/CD ⭐️
  • Code coverage

This guide is primarily targeted at the "Reluctant Developer" - an engineer or scientist with a need to adopt software development practices while still keeping their "day job." Our goal is to help you learn and apply just enough of these practices "just in time" to address specific challenges, not to make you a software developer. Professional Developers may find this guide to be slow and pedantic, but you may also find helpful pointers to useful tools in MATLAB you didn't know. You will hopefully find it useful to share this guide with the Reluctant Developers who work with you. This guide uses the term "developer" loosely to refer to all of you; anybody who works on code that has some intrinsic value.

This guide does not offer specific advice on how to write good MATLAB code. See MATLAB Coding Guidelines for standards and best practices guiding the development of professional-quality MATLAB Code. It also tries to avoid suggesting best practices, beyond recommending the most useful tools and conventions to adopt. See MATLAB Toolbox Best Practices for recommendations on how to structure your codebase and release toolboxes.

One last bit of advice before we start - generative AI tools like GitHub Copilot®, Claude™ Code, and MATLAB Copilot™ are getting quite good at software development. They can be very helpful for learning and applying unfamiliar software development tools and practices, helping you spend more of your time focused on engineering and science. The MATLAB Discussions Generative AI Channel is a great resource for using generative AI with MATLAB.


CC-BY-4.0

About

This guide recommends software tools and practices to help with developing reproducible, reusable, and production software with MATLAB.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published