none
Commenting your code RRS feed

  • General discussion

  • I programmed on a Commodore 64/ 128. I used to also type in machine code from books I bought. My question is: As nice as it is to have Basic come back, why isn't anyone stressing using "Rem"s to comment what the code is doing.

    When you have to use comments (REMs) in your program, it helps you learn better, plus others can follow your program, perhaps even streamlining it to work better, perhaps teaching them how to program a particular set of codes they want to use.

    Also if you have a project that you want to program plan it out on paper to get your logic in the correct order.

    I would like to see Small Basic have some compatibility with some of the old syntax forms.

    Sunday, December 30, 2012 6:11 PM

All replies

  • SmallBasic doesn't have a REM statement, but you can place a comment after a ' (single quote) even on a line with an other statement on it.

    e.g.:

    'this program does nothing

    variab=17      '  put the value 17 in variable

    '  ===== this is the END =====


    Jan [ WhTurner ] The Netherlands

    Sunday, December 30, 2012 6:34 PM
    Answerer
  • I know you can put comments in with a single quote, I was trying to point out that commenting in your code seems to be a lost programming stipulation to good programming. I learned a lot about what the codes did when there were comments, even when I thought I understood the code. I did Velkommen your replay. I am 65 and trying to restart some learning that I put off when I was younger, and I don't learn so quick anymore.

    John

    Sunday, December 30, 2012 9:41 PM
  • Lots of things are important and overload is an issue when starting out.  I believe structure and planning the logic and variables, comments, subroutines etc is critical, but awareness of this only comes after finding how hard it is when you don't.  Here is an article where I tried to suggest some good practices.  Feel free to add or suggest additions.

    Changing this to a discussion rather than question.


    Sunday, December 30, 2012 10:16 PM
    Moderator
  • Hey litdev

    I clicked on your "here" link and was sent to some profile setup page.

    Any chance you could send me a link on your article re good practices.

    Cheers

    ps. would it be a fair to comment to say that good scripting takes a lot of practice?

    Sunday, December 30, 2012 11:23 PM
    Moderator
  • hi,

    Loading TechNet pages seems to sometimes load your profile page if it times-out in some way.  The link is good (for me anyway) so perhaps try again at some intervals.

    Alternatively also look at all the Small Basic articles, do a Bing search for 'Small Basic' on the MS Technet site here.

    Here are all the Small Basic articles, but may also suffer from the time-out issue.

    Most things worthwhile take practice and always learning new aspects, programming is no different.

    Cheers.



    Sunday, December 30, 2012 11:32 PM
    Moderator
  • The fun thing for me when I started writing code was writing as ideas would occur and not stopping for things like comments.  Of course the code looked horrible when I was done and almost impossible to figure out.  And sure if you're doing this for a job and you don't comment your code you should be let go...  But there's no way to have a language force you to comment.
    Monday, December 31, 2012 8:45 AM