Converting generated code to something readable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tolkienarda
    Contributor
    • Dec 2006
    • 316

    #1

    Converting generated code to something readable

    hi all

    i came to work for the company i work for now in september and they have a lot of Dreamweaver generated ASP, PHP and Javascript. as well as some other scripts that no one understands but they work. my job it to maintain and upgrade these scripts. my question is should i go through all of the hidious code we currently use and replace it with clean code or should i leave the mess Dreamweaver made and just try to fix it bit bit as we need upgrades.
    example. today i had to add some creative form validation to a online application and the software used to generate the code did a terriable job. and the script was several pages long. i could have re written the same thing in about a half page of php and had a better grasp on what was going on for future changes. i chose to work with what was there and know three hours later i am starting to regret my decision.

    what do you all think
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    Originally posted by tolkienarda
    hi all

    i came to work for the company i work for now in september and they have a lot of Dreamweaver generated ASP, PHP and Javascript. as well as some other scripts that no one understands but they work. my job it to maintain and upgrade these scripts. my question is should i go through all of the hidious code we currently use and replace it with clean code or should i leave the mess Dreamweaver made and just try to fix it bit bit as we need upgrades.
    example. today i had to add some creative form validation to a online application and the software used to generate the code did a terriable job. and the script was several pages long. i could have re written the same thing in about a half page of php and had a better grasp on what was going on for future changes. i chose to work with what was there and know three hours later i am starting to regret my decision.

    what do you all think
    It has been my experience that when you use Dreamweaver/Frontpage/GoLive etc.. you get a ridiculous amount of code and like you said you could have done a client + server side validation in less than half length. If you are comfortable with doing the validation yourself I would reccomend doing it that way. Also, don't forget that extra length is increasing the file size and perhaps the processing time as well.

    HTH,
    Aric

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      If you can rewrite it then do so. Document it well and there will be no reason for anyone to complain. Three pages of a mess to one-half is worth it in my book.

      The only code I would change, though, is the code that needs changing. If it isn't broke, don't fix it. But if they need you to make changes, that's when I would consider rewrites if faced with the part you mentioned above.

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        I don't know much about Dreamweaver generated code but in my experience if time allows then replacing 'hideous' code with concise well designed code saves time in the long run. The time you waste trying to interpret what the hideous code is doing is better done now when it is non urgent then trying to do it later during a time critical change.

        Mary

        Comment

        • tolkienarda
          Contributor
          • Dec 2006
          • 316

          #5
          that is what i was thinking. and after the nightmare i just went through with this simple change i think i will do that from now on

          thanks

          eric

          Comment

          Working...