Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

2.9. Commenting your code

Before you leave this chapter, I want to talk to you about comments. Comments in a block of program code are there to help you, the developer, and the people you work with understand what a particular block of code is intended to do and can even be used to generate helpful documentation. This may sound odd at first; surely it's the computer that needs to understand what the code does. You already know what it does because you wrote it. Well, that may be true when you're writing the code, but will you remember what it's supposed to do tomorrow, next week, or next month when you have to come back and modify it? Maybe if you've got a brain like Albert Einstein but the chances are that you will have moved on to new projects and won't remember a darn thing. Or worse, someone else can come onto a project after you have left and have no idea what your intention was with the uncommented code, which slows down development and can give you a bad reputation as the original author of the code.

Take it from me; you don't want to have to trawl through 500-plus lines of ActionScript code on a Monday morning to try to work out exactly what it was that you or someone else was trying to do.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial