TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-02-2009, 09:39 PM   #1 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default I love maintaining legacy code (priceless snippet of ASP code)

At work we have a terrible (massive) ASP CMS we have to manage. No documentation, near no comments and code straight out of basic tutorials. I came though the following piece of code in it (follow bTemplateUpdate).
Code:
    Dim bTemplateUpdate

    If sNewTemplate <> "" Then
        bTemplateUpdate = True
    End If
    If oReq.Form("oldTemplate") <> sNewTemplate Then
        bTemplateUpdate = True
    End if
    bTemplateUpdate = True

    If bTemplateUpdate And (sNewTemplate<>"") Then
   (big process)
   end if
__________________

Village Idiot is offline  
Reply With Quote
Old 04-02-2009, 09:49 PM   #2 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
At work we have a terrible (massive) ASP CMS we have to manage. No documentation, near no comments and code straight out of basic tutorials. I came though the following piece of code in it (follow bTemplateUpdate).
Code:
    Dim bTemplateUpdate

    If sNewTemplate <> "" Then
        bTemplateUpdate = True
    End If
    If oReq.Form("oldTemplate") <> sNewTemplate Then
        bTemplateUpdate = True
    End if
    bTemplateUpdate = True

    If bTemplateUpdate And (sNewTemplate<>"") Then
   (big process)
   end if

haha so basically you're doing all this for nothing because you're setting bTemplateUpdate to TRUE anyways!!!

If sNewTemplate <> "" Then
bTemplateUpdate = True
End If
If oReq.Form("oldTemplate") <> sNewTemplate Then
bTemplateUpdate = True
End if
allworknoplay is offline  
Reply With Quote
Old 04-02-2009, 10:11 PM   #3 (permalink)
The Contributor
 
Join Date: Feb 2009
Posts: 65
Thanks: 0
Krik is on a distinguished road
Default

LOL

I don't use ASP, but it's a simple if/else and very funny.

So 9 lines of code to set the bTemplateUpdate variable to true. So if the that sample hold true for the rest of the code 3/4 of the code for that CMS is a waste O.o .

Yea good luck with all that.
Krik is offline  
Reply With Quote
Old 04-03-2009, 02:30 AM   #4 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Krik View Post
LOL

I don't use ASP, but it's a simple if/else and very funny.

So 9 lines of code to set the bTemplateUpdate variable to true. So if the that sample hold true for the rest of the code 3/4 of the code for that CMS is a waste O.o .

Yea good luck with all that.
Its not all that bad, but my predecessor was an amateur at best. I keep finding pieces I recognize from beginner level tutorials I read when I initally learned ASP. His coding style reflected mine when I had 2 months of experience. He was an expert BS thrower though, he has everyone who can't read code fooled. We're rebuilding the whole freaking thing soon enough; it needs it.
__________________

Village Idiot is offline  
Reply With Quote
Old 04-03-2009, 04:03 AM   #5 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Its not all that bad, but my predecessor was an amateur at best. I keep finding pieces I recognize from beginner level tutorials I read when I initally learned ASP. His coding style reflected mine when I had 2 months of experience. He was an expert BS thrower though, he has everyone who can't read code fooled. We're rebuilding the whole freaking thing soon enough; it needs it.
Well I give you credit for knowing ASP. I learned a little bit of ASP way back in the days around 1999-2000 when it was quite young.

I'm sure it has change tremendously since then....
allworknoplay is offline  
Reply With Quote
Old 04-03-2009, 04:08 AM   #6 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
Well I give you credit for knowing ASP. I learned a little bit of ASP way back in the days around 1999-2000 when it was quite young.

I'm sure it has change tremendously since then....
No, actually. Microsoft has been putting all their efforts into .NET, asp has been a thing of the past for many years now. Everything you know about asp classic probably still remains true today. They haven't come out with anything new for it for quite a few years.
__________________

Village Idiot is offline  
Reply With Quote
Old 04-03-2009, 08:45 PM   #7 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Oh dear, judging from that snippet its gonna be a right ordeal to un-kludge the CMS.
Very amusing however, brought a smile to my face.

We don't have much code like that at work (I hope!), ours is just littered with comedic code comments.

I keep meaning to have a proper look at asp.net, I spent about 2 years writing VB (vb6.0 and .net, about a year each non professional) spent a few months faffing with C# too so it would be a logical choice for me to learn, I do prefer the simplicity of PHP development however.

I must say I really like the new Beast of Redmond languages / tools especially the Express editions.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 04-03-2009, 09:11 PM   #8 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by sketchMedia View Post
Oh dear, judging from that snippet its gonna be a right ordeal to un-kludge the CMS.
We're not even trying, we're wiping it out soon enough. We have been bandaging it for about nine months now, but they are all fixes made with a temporary mentality.
__________________

Village Idiot is offline  
Reply With Quote
Old 04-03-2009, 09:20 PM   #9 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
We're not even trying, we're wiping it out soon enough.
haha, don't blame you.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Snipply.com - Code snippet website codyodell Show Off 27 04-13-2008 02:09 PM


All times are GMT. The time now is 10:05 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design