Working Practices - Dick Bowman
Currently using Dyalog APL to develop several single-user desktop applications. Used other versions of APL in the past in development groups of varying sizes. Dabbled with variants like J and K. Has also used other programming languages, but...
General Principles:
- APL has its origins as a way to improve communication between people, never forget this.
- Stick to the "functions take their input from arguments and produce results" wherever possible. As a sub-rule, put "controlling parameters" in the left argument and "data" in the right.
- Keep defined functions (and operators) brief.
- Insulate your code from the outside world by localising any system variables that it depends on.
- If you need to include comments to make your code clear, you aren't making your code clear.
- So long as performance is adequate, maintainability is the most important aspect of coding style.
Dyalog Specifics:
- Use control structures to aid clarity. Especially to avoid arrow-style branching.
- Use in-line dynamic functions to make code simpler.
- Use language constructs which simplify APL, such as the indexing function and dot-syntax. Don't hang onto archaisms like bracket-indexing just because they are familiar.
Current Fads:
- Making increasing use of namespace scripts to hold utility code which is shared across applications.
- Making increasing use of class scripts to handle data.
Detestations:
- Code that is "squished up" to look denser, in particular diamond statement separators.
- Code with comments mingled in and interfering with the real code.
- Error-trapping used to implement application logic.
Disclaimer - this page written on 23 January 2009, preferences and practices may have changed.