(ref:flexiblecode-intro)
You Must - (ref:flexiblecode-must)
You Should - (ref:flexiblecode-should)
You Could - (ref:flexiblecode-could)
|Related Areas: | Comments
Data Structure |
|--------------- |------------------------------------------------------------|
Think about the structure and sequence of your code. Keep inputs and key parameters that might need to change in a separate section which is easy to find.
In some cases it may be appropriate to store such inputs in separate files which are read in, rather than storing them within the code.
You should look to break up your code into chunks rather than working in a single long script or program. Each chunk of code should have a clear purpose. You can then use call on these chunks of code to build your analysis.
There are many reasons to do this:
Don't Repeat Yourself is a common idea in programming. Instead of writing a bit of code several times to repeat an operation, you should re-use the same code by turning it into a function (or some other re-useable chunk - such as a method or subroutine).
Think carefully about the input required for your code to work correctly:
Building checks into your code for issues such as the above can make your code more robust. This will make it easier to repurpose with confidence in future.
You may want to consider adding [error handling]{#error_handling} to handle what happens if what these checks aren't met.
Its likely your code will be asked to do something you didn't design it for, and it will break.
You do know however what your code should be doing, what the input is expected to look like, and the properties of the output. You also probably have an idea of what your would like it to do when it doesn't work correctly.
You can use error or exception handling to control the errors and warnings that your code produces. This can allow you to and choose:
There are automated techniques such as fuzzing available to check how your code and error handling responds to different inputs.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.