Tech Off Thread

8 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

self-documenting is?

Back to Forum: Tech Off
  • User profile image
    JScript

    Listed as an advantage of strong typing: "self-documenting code"... what exactly does that mean?

  • User profile image
    Manip

    People are too lazy to correctly explain what things do and how they work with one another so they write overly descriptive comments within the code and sometimes use tools to extract these commands into some kind of meta documentation (That is never good).

  • User profile image
    Yggdrasil

    JScript wrote:
    Listed as an advantage of strong typing: "self-documenting code"... what exactly does that mean?


    It means that since each variable is strongly typed - it's a number, or a string, or whatever - it gives you more information about what that variable is supposed to do - if you have a variable named UserID, for instance, you don't have to go around checking if it's a ID number or a username, since the type gives you that information.

    I don't really agree with that, though. I feel that the type of the variable is really a technical detail, not really suitable documentation for your code. The name of the variable is the really important way to make your code understandable even without documentation.

  • User profile image
    geekling

    Its a fancy way of saying, "I don't want to write any formal documentation."

  • User profile image
    JScript

    Ah, self-hinting it is, then. Speaking of technical details, "reserved words" certainly don't help: I spend as much time thinking up untaken descriptive names as writing code, for that matter.

  • User profile image
    Yggdrasil

    JScript wrote:
    Ah, self-hinting it is, then. Speaking of technical details, "reserved words" certainly don't help: I spend as much time thinking up untaken descriptive names as writing code, for that matter.


    Really? What sort of programs do you write that "if", "static" or "string" are used as variable names?

    Generally, I've found reserved words to be a very small hassle.

  • User profile image
    msemack
  • User profile image
    JScript

    Yggdrasil wrote:
    Really? What sort of programs do you write that "if", "static" or "string" are used as variable names?

    Well, there are 75 listed--plus countless others to consider for each name chosen--depending on the host environment, imported code, etc. Sure, they can be modified slightly, but doing so may lead to greater confusion than would synonyms...

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.