A number of Emacs commands that aren't designed specifically for editing programs are useful for that nonetheless.
The Emacs commands that operate on words, sentences and paragraphs are useful for editing code. Most symbols names contain words (see Words); sentences can be found in strings and comments (see Sentences). Paragraphs in the strict sense can be found in program code (in long comments), but the paragraph commands are useful in other places too, because programming language major modes define paragraphs to begin and end at blank lines (see Paragraphs). Judicious use of blank lines to make the program clearer will also provide useful chunks of text for the paragraph commands to work on. Auto Fill mode, if enabled in a programming language major mode, indents the new lines which it creates.
The selective display feature is useful for looking at the overall structure of a function (see Selective Display). This feature hides the lines that are indented more than a specified amount. Programming modes often support Outline minor mode (see Outline Mode). The Foldout package provides folding-editor features (see Foldout).
The “automatic typing” features may be useful for writing programs. See Autotyping.