DEV Community

Molossus Spondee
Molossus Spondee

Posted on

Teleogical Programming

I would comment an exceptional use of exceptions but probably would not stress over such a decision otherwise.

I try to think about programming concepts in a descriptive rather than a prescriptive fashion.

For example, I prefer "const variables in C permit the type checker to disallow writes and possibly link static constants into read only sections" over "a const variable in C is prescribed for read only purposes."

Compilers do not understand the intent behind variable names and they do not understand the intent behind for loops, goto, exceptions and all the rest of program structure. Compilers do not even understand the intent of the language designer. Compilers only do what they were programmed to do.

Sometimes teleogical thinking is important such as for understanding what uses of an API are supported but I try not to get locked into it.

Being locked into a language or API designer's vision also locks you into their mistakes. Dennis Ritchie is not an authority on the correct or permitted use of for loops. There is no correct or prescribed use of for loops just only what for loops actually do. What classes or any other language construct ought to be used for is a similarly pointless discussion.

I try to see things for what they are not what they ought to be.

Exceptions are not for exceptional conditions. Exceptions are a syntax construct. Teleogical thinking mistakes programming languages for human languages. Describing what a program is intended to do is for comments.

Top comments (0)