Handling unexpected inputs
A program should be designed so that a user entering an unexpected data type, such as a word where an integer is required, would not crash the program. In Python, this can be
achieved with the TRY...EXCEPT statement.
Sanitisation
Sanitisation is the removal of unwanted characters from input data. This is one way we protect against SQL injection.
Maintainability
Most programs are large and worked on by more than one programmer and may well be maintained by different people so there are a number of things that should be done to make
the process simpler.
Using sub-programs
This means the program will be easier to understand. Changes will only need to be made to individual sub-programs.
Naming conventions
As well as basics like no spaces in names, starting with a letter or underscore, and using meaningful names, programmers often use naming conventions. Constants are generally
written in all capitals. For regular variables either snake case or camel case is usually used. Using all lowercase amd underscores to seperate words is snake_case. Starting with
lowercase and using a capital for the first letter of each new word.
Indentation and spacing
As well as basics like no spaces in names, starting with a letter or underscore, and using meaningful names, programmers often use naming conventions. Constants are generally
written in all capitals. For regular variables either snake case or camel case is usually used.
Commenting
Commenting means leaving notes in your code to explain how it works. It is increasingly important in large programs where the person who writes the code may not be the one to
maintain it.
Why maintainability matters
It is quite likely that code you write will end up being maintained by someone else. This is why there is an old saying in programming - Always code as though the person who maintains your code will be a homicidal axe-wielding sociopath that knows where you live.