Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Unnecessary Commented Code

Unnecessary Commented Code

Scheduled Pinned Locked Moved The Weird and The Wonderful
sharepointdatabasetutorial
11 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Monjurul Habib
    wrote on last edited by
    #1

    Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

    /// Traverse between Rows
    //public virtual bool TraverseRecord(string TraverseFor, string Id)
    //{
    // bool HasRows = false;
    // string sql = "";
    // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
    // iMHUtility.ExecuteStoredProcedure(sql);
    // if (iMHUtility.IsErrorOnExecution() == false)
    // {
    // if (iMHUtility.HasMoreRecords())
    // {
    // HasRows = true;
    // ValueInitialize();
    // }
    // }
    // return HasRows;
    //}
    public virtual bool TraverseRecord(string TraverseFor, string Id)
    {
    bool HasRows = false;
    string sql = "";
    sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
    iMHUtility.ExecuteStoredProcedure(sql);
    if (iMHUtility.IsErrorOnExecution() == false)
    {
    if (iMHUtility.HasMoreRecords())
    {
    HasRows = true;
    ValueInitialize();
    }
    }
    return HasRows;
    }

    Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

    F J Sander RosselS R J 8 Replies Last reply
    0
    • M Monjurul Habib

      Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

      /// Traverse between Rows
      //public virtual bool TraverseRecord(string TraverseFor, string Id)
      //{
      // bool HasRows = false;
      // string sql = "";
      // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
      // iMHUtility.ExecuteStoredProcedure(sql);
      // if (iMHUtility.IsErrorOnExecution() == false)
      // {
      // if (iMHUtility.HasMoreRecords())
      // {
      // HasRows = true;
      // ValueInitialize();
      // }
      // }
      // return HasRows;
      //}
      public virtual bool TraverseRecord(string TraverseFor, string Id)
      {
      bool HasRows = false;
      string sql = "";
      sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
      iMHUtility.ExecuteStoredProcedure(sql);
      if (iMHUtility.IsErrorOnExecution() == false)
      {
      if (iMHUtility.HasMoreRecords())
      {
      HasRows = true;
      ValueInitialize();
      }
      }
      return HasRows;
      }

      Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

      F Offline
      F Offline
      fjdiewornncalwe
      wrote on last edited by
      #2

      I've seen similar stuff in places that for some unknown reason didn't use source control, but rather comments as a versioning mechanism. (No, that place is no longer in business... Surprise) The OP probably just copied and pasted it with the intention of modifying the code, but in this case I think he forgot to perform the latter.

      I wasn't, now I am, then I won't be anymore.

      M 1 Reply Last reply
      0
      • M Monjurul Habib

        Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

        /// Traverse between Rows
        //public virtual bool TraverseRecord(string TraverseFor, string Id)
        //{
        // bool HasRows = false;
        // string sql = "";
        // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
        // iMHUtility.ExecuteStoredProcedure(sql);
        // if (iMHUtility.IsErrorOnExecution() == false)
        // {
        // if (iMHUtility.HasMoreRecords())
        // {
        // HasRows = true;
        // ValueInitialize();
        // }
        // }
        // return HasRows;
        //}
        public virtual bool TraverseRecord(string TraverseFor, string Id)
        {
        bool HasRows = false;
        string sql = "";
        sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
        iMHUtility.ExecuteStoredProcedure(sql);
        if (iMHUtility.IsErrorOnExecution() == false)
        {
        if (iMHUtility.HasMoreRecords())
        {
        HasRows = true;
        ValueInitialize();
        }
        }
        return HasRows;
        }

        Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

        J Offline
        J Offline
        Jeroen De Dauw
        wrote on last edited by
        #3

        Someone give them a git or svn already, srysly >_>

        Jeroen De Dauw
        Blog ; Wiki

        1 Reply Last reply
        0
        • M Monjurul Habib

          Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

          /// Traverse between Rows
          //public virtual bool TraverseRecord(string TraverseFor, string Id)
          //{
          // bool HasRows = false;
          // string sql = "";
          // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
          // iMHUtility.ExecuteStoredProcedure(sql);
          // if (iMHUtility.IsErrorOnExecution() == false)
          // {
          // if (iMHUtility.HasMoreRecords())
          // {
          // HasRows = true;
          // ValueInitialize();
          // }
          // }
          // return HasRows;
          //}
          public virtual bool TraverseRecord(string TraverseFor, string Id)
          {
          bool HasRows = false;
          string sql = "";
          sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
          iMHUtility.ExecuteStoredProcedure(sql);
          if (iMHUtility.IsErrorOnExecution() == false)
          {
          if (iMHUtility.HasMoreRecords())
          {
          HasRows = true;
          ValueInitialize();
          }
          }
          return HasRows;
          }

          Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

          Sander RosselS Offline
          Sander RosselS Offline
          Sander Rossel
          wrote on last edited by
          #4

          Where I work we have classes that consist for about 50% of code like that. And that while we use SVN :p I guess some people just do not dare to delete code. And probably you would not dare either if you worked at my company :laugh:

          It's an OO world.

          1 Reply Last reply
          0
          • M Monjurul Habib

            Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

            /// Traverse between Rows
            //public virtual bool TraverseRecord(string TraverseFor, string Id)
            //{
            // bool HasRows = false;
            // string sql = "";
            // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
            // iMHUtility.ExecuteStoredProcedure(sql);
            // if (iMHUtility.IsErrorOnExecution() == false)
            // {
            // if (iMHUtility.HasMoreRecords())
            // {
            // HasRows = true;
            // ValueInitialize();
            // }
            // }
            // return HasRows;
            //}
            public virtual bool TraverseRecord(string TraverseFor, string Id)
            {
            bool HasRows = false;
            string sql = "";
            sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
            iMHUtility.ExecuteStoredProcedure(sql);
            if (iMHUtility.IsErrorOnExecution() == false)
            {
            if (iMHUtility.HasMoreRecords())
            {
            HasRows = true;
            ValueInitialize();
            }
            }
            return HasRows;
            }

            Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

            R Offline
            R Offline
            Rod Kemp
            wrote on last edited by
            #5

            A place I worked at had the same thing because they didn't have any form of source control, once I got them to implement source control most of this sort of stuff was cleaned out. This particular code may also be the result of someone who doesn't "trust" source control and thinks that this is a better option, of course than person is a deluded fool but you never know.

            People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs

            1 Reply Last reply
            0
            • F fjdiewornncalwe

              I've seen similar stuff in places that for some unknown reason didn't use source control, but rather comments as a versioning mechanism. (No, that place is no longer in business... Surprise) The OP probably just copied and pasted it with the intention of modifying the code, but in this case I think he forgot to perform the latter.

              I wasn't, now I am, then I won't be anymore.

              M Offline
              M Offline
              Monjurul Habib
              wrote on last edited by
              #6

              Thats why code source control and review is important.:thumbsup:

              1 Reply Last reply
              0
              • M Monjurul Habib

                Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

                /// Traverse between Rows
                //public virtual bool TraverseRecord(string TraverseFor, string Id)
                //{
                // bool HasRows = false;
                // string sql = "";
                // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
                // iMHUtility.ExecuteStoredProcedure(sql);
                // if (iMHUtility.IsErrorOnExecution() == false)
                // {
                // if (iMHUtility.HasMoreRecords())
                // {
                // HasRows = true;
                // ValueInitialize();
                // }
                // }
                // return HasRows;
                //}
                public virtual bool TraverseRecord(string TraverseFor, string Id)
                {
                bool HasRows = false;
                string sql = "";
                sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
                iMHUtility.ExecuteStoredProcedure(sql);
                if (iMHUtility.IsErrorOnExecution() == false)
                {
                if (iMHUtility.HasMoreRecords())
                {
                HasRows = true;
                ValueInitialize();
                }
                }
                return HasRows;
                }

                Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #7

                I have seen that happen because some people either do not understand what source control is or do not trust it.

                1 Reply Last reply
                0
                • M Monjurul Habib

                  Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

                  /// Traverse between Rows
                  //public virtual bool TraverseRecord(string TraverseFor, string Id)
                  //{
                  // bool HasRows = false;
                  // string sql = "";
                  // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
                  // iMHUtility.ExecuteStoredProcedure(sql);
                  // if (iMHUtility.IsErrorOnExecution() == false)
                  // {
                  // if (iMHUtility.HasMoreRecords())
                  // {
                  // HasRows = true;
                  // ValueInitialize();
                  // }
                  // }
                  // return HasRows;
                  //}
                  public virtual bool TraverseRecord(string TraverseFor, string Id)
                  {
                  bool HasRows = false;
                  string sql = "";
                  sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
                  iMHUtility.ExecuteStoredProcedure(sql);
                  if (iMHUtility.IsErrorOnExecution() == false)
                  {
                  if (iMHUtility.HasMoreRecords())
                  {
                  HasRows = true;
                  ValueInitialize();
                  }
                  }
                  return HasRows;
                  }

                  Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

                  T Offline
                  T Offline
                  thatraja
                  wrote on last edited by
                  #8

                  It's really disgusting. At least they might comment only the particular line instead of whole thing & new copy of that.

                  public virtual bool TraverseRecord(string TraverseFor, string Id)
                      {
                          bool HasRows = false;
                         string sql = "";
                          //sql = "SP\_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
                          sql = "SP\_NAVIGATE\_CHILD\_T '" + TraverseFor + "', '" + Id + "'";//Calling new Stored procedure
                          iMHUtility.ExecuteStoredProcedure(sql);
                          if (iMHUtility.IsErrorOnExecution() == false)
                         {
                              if (iMHUtility.HasMoreRecords())
                              {
                                  HasRows = true;
                                  ValueInitialize();
                              }
                          }
                          return HasRows;
                      }
                  

                  Also they may create another parameter for sp_name in the method.

                  thatraja


                  **My Tip/Tricks
                  My Dad had a Heart Attack on this day so don't...
                  **

                  B 1 Reply Last reply
                  0
                  • T thatraja

                    It's really disgusting. At least they might comment only the particular line instead of whole thing & new copy of that.

                    public virtual bool TraverseRecord(string TraverseFor, string Id)
                        {
                            bool HasRows = false;
                           string sql = "";
                            //sql = "SP\_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
                            sql = "SP\_NAVIGATE\_CHILD\_T '" + TraverseFor + "', '" + Id + "'";//Calling new Stored procedure
                            iMHUtility.ExecuteStoredProcedure(sql);
                            if (iMHUtility.IsErrorOnExecution() == false)
                           {
                                if (iMHUtility.HasMoreRecords())
                                {
                                    HasRows = true;
                                    ValueInitialize();
                                }
                            }
                            return HasRows;
                        }
                    

                    Also they may create another parameter for sp_name in the method.

                    thatraja


                    **My Tip/Tricks
                    My Dad had a Heart Attack on this day so don't...
                    **

                    B Offline
                    B Offline
                    BillW33
                    wrote on last edited by
                    #9

                    Oh, come on, you are just talking sense now! ;) ;) :laugh:

                    Just because the code works, it doesn't mean that it is good code.

                    1 Reply Last reply
                    0
                    • M Monjurul Habib

                      Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

                      /// Traverse between Rows
                      //public virtual bool TraverseRecord(string TraverseFor, string Id)
                      //{
                      // bool HasRows = false;
                      // string sql = "";
                      // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
                      // iMHUtility.ExecuteStoredProcedure(sql);
                      // if (iMHUtility.IsErrorOnExecution() == false)
                      // {
                      // if (iMHUtility.HasMoreRecords())
                      // {
                      // HasRows = true;
                      // ValueInitialize();
                      // }
                      // }
                      // return HasRows;
                      //}
                      public virtual bool TraverseRecord(string TraverseFor, string Id)
                      {
                      bool HasRows = false;
                      string sql = "";
                      sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
                      iMHUtility.ExecuteStoredProcedure(sql);
                      if (iMHUtility.IsErrorOnExecution() == false)
                      {
                      if (iMHUtility.HasMoreRecords())
                      {
                      HasRows = true;
                      ValueInitialize();
                      }
                      }
                      return HasRows;
                      }

                      Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

                      D Offline
                      D Offline
                      drummerboy0511
                      wrote on last edited by
                      #10

                      Ahh... admittedly, I've been guilty of leaving commented code behind, but they were left behind to work with later. However, I don't think I ever commented copied code like that...

                      1 Reply Last reply
                      0
                      • M Monjurul Habib

                        Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:

                        /// Traverse between Rows
                        //public virtual bool TraverseRecord(string TraverseFor, string Id)
                        //{
                        // bool HasRows = false;
                        // string sql = "";
                        // sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
                        // iMHUtility.ExecuteStoredProcedure(sql);
                        // if (iMHUtility.IsErrorOnExecution() == false)
                        // {
                        // if (iMHUtility.HasMoreRecords())
                        // {
                        // HasRows = true;
                        // ValueInitialize();
                        // }
                        // }
                        // return HasRows;
                        //}
                        public virtual bool TraverseRecord(string TraverseFor, string Id)
                        {
                        bool HasRows = false;
                        string sql = "";
                        sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
                        iMHUtility.ExecuteStoredProcedure(sql);
                        if (iMHUtility.IsErrorOnExecution() == false)
                        {
                        if (iMHUtility.HasMoreRecords())
                        {
                        HasRows = true;
                        ValueInitialize();
                        }
                        }
                        return HasRows;
                        }

                        Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.

                        F Offline
                        F Offline
                        Falterfire
                        wrote on last edited by
                        #11

                        I'll admit to leaving comments behind when I'm designing new stuff but want to be able to refer to the old stuff, but I only leave it there when I forget or get distracted before finishing the new function.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups