|We don't bite newbies here... much|
I ment that translate-name to be a function, as it has a verb and should do something, rather than be something.
About the length of the names and code-lines. How understandible a block of code is does not really relate to the length of expressions, but also to the formatting and the names. If the names are well-chosen but long, the formatting should be clear. Together with the way the program is broken up in functions, that determines the accesibility of some code, not whether expressions fit in one line or not.
For example, nested or sequential maps are a pain to read when put on a single line. Spread out over several lines the code often becomes clear. And we are talking about expressions with very short names. In this example it doesn't really matter whether your names are 10 or 30 characters, the code still gobbles up the same number of lines.
From another point of view, lines with more than say three or four variable names are probably hard to read anyway. Spreading it out over multiple lines can help than.
When browsing code like some linux kernel or whatever GPL program I need to tweak a bit to compile, I encounter C consisting of lots of comments intertwingled with short code. (And I wouldn't dare to claim that those are really well written examples) I find these things hard to read as well. The flow of logic in the comments is done by the authors, and is not the programming logic. There already is enough freedom in how to write code, the different ways to comment make code in general harder to read. I'd rather have to code spanning somewhat more lines than having those flexible comments in the way.....
About pre/post conditions. Tough topic, when I think of it. A condition is a circumstance before/during/after a function. I would say that such beasts belong to the interface anyway. They can or should be named in the function-name, or be explicitly mentioned in the parameter lists. Let us for example consider code that retrieves some user-information, and count the ocurrence of a 'p'. Pretty useless of course. Depending on a condition (eg are we running under windowz?) the list has to be pulled from the builtin functions or from an user file:
Depending on the remainder of the program, these interface choices may be a Good or a Bad idea. If we bury the win32 condition a bit further in the interface, which may well be a Good Thing for programs in general:
This can be extended forever, I think the idea is clear by now. With this naming convention, the conditions automatically get into the naming of functions and variables.