Improve Toolbox before publishing / best practices

조회 수: 4 (최근 30일)
Frederik
Frederik 2018년 2월 6일
댓글: Adam Danz 2019년 10월 27일
I have a collection of functions and Simulink-Models which might be worth publishing to help other researchers in my field. However the quality of these files varies and I would like to get them ready for other people. Is there a collection of 'best practices' or some kind of a checklist what to look for before publication?
What I already did:
I would like to get more thoughts and hints on this topic.
Frederik

답변 (2개)

Image Analyst
Image Analyst 2018년 2월 6일
Put double the number of comments into the source code as you think you need.
No one ever complains about too many explanatory statements embedded in the source code. The more the better. Sometimes (later) even when I look over my own code, I'd have trouble understanding what it did if I hadn't put in a comment to explain it.
I'm attaching a comment counter program that I wrote. For comparison, 35% of my code lines are a
  댓글 수: 1
Adam Danz
Adam Danz 2019년 10월 27일
+1
This function should be on the file exchange!
"No one ever complains about too many explanatory statements"
I've been flooding my files with comments including detailed descriptions at the top, inline comments throughout the code, and a list of footnotes at the end. The result is that a simple 10-line function turns into 50 lines and sometimes I ask myself it it's too much but I imagine some day I or someone else will benefit from knowing the background to decisions that were made while writing the code.

댓글을 달려면 로그인하십시오.


Steven Lord
Steven Lord 2018년 2월 6일
Consider writing some basic tests for your functions.
Don't be worried that this page appears in the "Advanced Software Development" section of the documentation. Script-based tests are easy to write as long as you know how to write code sections (starting with %%) and use the assert function.
Function-based and class-based tests provide additional functionality (more advanced setup and teardown capabilities, for example) at the cost of more complexity. But even basic script-based tests can prove invaluable when your users start modifying your functions. Their failures will (or should) alert those users when their changes impact the expected behavior of the functions in ways they didn't expect.
  댓글 수: 1
Adam Danz
Adam Danz 2019년 10월 27일
+1 another great idea that should be more commonly used!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Naming Conventions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by