-
Notifications
You must be signed in to change notification settings - Fork 7
Programming modes
A useful way to approach scientific programming is by thinking in terms of various programming modes. Currently, many scientific programmers concentrate on prototyping and optimizing modes, while software engineers - on maintaining, sharing, and standardizing ones. They often require different programming approaches and tools and switching between the modes is often hard, so it is important to pick an appropriate one for your goals.
Much of scientific coding shouldn't be prototyping: you almost always will need to use the same code to answer different questions, so planning it out carefully to be modular, robust, etc. is extremely valuable. In the long run it takes more time either working with the poor design or refactoring it to be better - if you have a good design to start with, you don't need to refactor as much. Decent design does not always mean long, hard planning. In practice, it is important to find a balance between quick code and well-designed code, to optimize the long-run efficiency.
Writing code to test an idea.
Important:
- speed of coding: minimal overhead, few lines of code
- ability to make a definite decision about the idea hypothesis
Good to have (but should not be a focus if it takes too much extra time):
- code robustness: ability to run under various regimes, inputs, and systems
- code readability
- code speed and memory usage
- ability to get results other than testing the idea
- ability to easily expand code beyond idea testing
Can benefit from using high-level packages/libraries and searching for available similar projects (literature search in science).
Refactoring code to:
- minimize execution time
- minimize memory consumption
- increase ability to run under various regimes, inputs, and systems
- display results better
Can benefit from using debugging tools.
Expanding existing code and fixing bugs.
Important:
- good modular data and code design
- code readability
Can benefit from from implementing version control system and applying standard software engineering techniques described in this wiki.
Writing code that can be easily used by others and/or working on code together with other people.
Important:
Can benefit from using GitHub and applying standard software engineering techniques.
Writing code which will become a standard in the field. This is extremely hard because it requires:
- top-notch code quality
- ability to solve important users problems better than existing alternatives
- great marketing (or power to enforce using your software)