Alpha Video Training
Results 1 to 4 of 4

Thread: Does Commented Out Code Still Require Resources

  1. #1
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,627

    Default Does Commented Out Code Still Require Resources

    This is just a general question about whether it is generally better to remove unused code versus commenting it out.


    I'm sure we all do this now and again:
    Say you create some code in an event handler someplace. You then decide for whatever reason you no longer want to use it.
    So you comment it out (in case you might want to re-use it again down the road .. you might not).


    I'm assuming that the browser still needs to actually read that code to determine that it needs to ignore it?
    If so, is it better practice to actually delete the unused code rather than simply comment it out?
    Alpha Anywhere v12.4.6.1.2 Build 6012-5338 IIS v8.5 on Windows Server 2012 in Hyper-V

  2. #2
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,621

    Default Re: Does Commented Out Code Still Require Resources

    I believe that when you publish a component, it removes the commented code, especially if you select pre-render. So it does not affect published components. So, commented code only makes the publish process a bit longer....probably not noticeable.

    If you look at the source code for a running page, you will not see any commented code.
    Pat Bremkamp
    MindKicks Consulting

  3. #3
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,627

    Default Re: Does Commented Out Code Still Require Resources

    Thanks Pat, I didn't know that but it makes sense.
    Alpha Anywhere v12.4.6.1.2 Build 6012-5338 IIS v8.5 on Windows Server 2012 in Hyper-V

  4. #4
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,317

    Default Re: Does Commented Out Code Still Require Resources

    Quote Originally Posted by iRadiate View Post
    This is just a general question about whether it is generally better to remove unused code versus commenting it out.


    I'm sure we all do this now and again:
    Say you create some code in an event handler someplace. You then decide for whatever reason you no longer want to use it.
    So you comment it out (in case you might want to re-use it again down the road .. you might not).


    I'm assuming that the browser still needs to actually read that code to determine that it needs to ignore it?
    If so, is it better practice to actually delete the unused code rather than simply comment it out?
    Hello Stephen,

    Code comments do require space in the file, but they're not computed when the code is interpreted.

    If you are resistant to deleting code but don't want to execute it in your scripts, I highly recommend that you use a source control system, such as Git or Subversion, with your projects. Source control systems will track the changes to your files, allowing you at any time to roll back or check out past revisions. This makes it very easy to retrieve code you previously deleted. Using source control is also a recommended best practice when building software systems.
    Alpha Anywhere latest pre-release

Similar Threads

  1. When is require released?
    By Pat Bremkamp in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 05-12-2016, 09:59 AM
  2. Do A5W pages require a licensed WAS?
    By Bill in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 12-04-2012, 05:21 AM
  3. Does v11 Install Require New Installation?
    By iRadiate in forum General Questions
    Replies: 9
    Last Post: 10-13-2011, 05:24 PM
  4. Commented Action Commands
    By Sam Wagoner in forum Alpha Five Version 5
    Replies: 1
    Last Post: 11-19-2002, 10:04 AM
  5. networking a4 v7 require admin log on???
    By Bob Coneys in forum Alpha Four Versions 7 and 8
    Replies: 2
    Last Post: 08-01-2002, 12:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •