3 ms·
Coding Horror: Pseudocode or Code?
- rimantas 17y agoThose comments on perfectly obvious code look horrible.
- pavel_lishin 17y ago// express agreement echo "I agree.";
- dhimes 17y agoI use pseudocode every time I program in FORTRAN 77
- randombit 17y agoI do sometimes use psuedocode, especially to either work out for myself a complicated algorithm or help provide additional documentation for readers. However one key difference is instead of unstructured natural language, I use Python or Scheme - this is beneficial for me, because it forces me to concretely express what I am trying to do, instead of hand waving, and for a future reader, who will probably have an easier time unambiguously parsing a real language instead of random half-sentences. And it is often succinct - it is amazing and amusing how often (the gist of) hundreds of lines of optimized C/C++ can be expressed in a line or three of Python.
- makecheck 17y agoI prefer something executable (and therefore automatically verifiable). I think English is most useful when used to express test cases. Such statements usually convey about the same information as pseudocode, but are a lot easier to follow. Take one of the pseudocode examples from the article: set the default status to "fail" look up the message based on the error code if the error code is valid if doing interactive processing, display the error message interactively and declare success if doing command line processing, log the error message to the command line and declare success if the error code isn't valid, notify the user that an internal error has been detected return status information All this really means is... for interactive and command line uses: produce the message for an error code, or raise an internal error You can still infer a program from this, it's just that a lot of details are implied.