TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   The Lounge (http://www.talkphp.com/lounge/)
-   -   I love maintaining legacy code (priceless snippet of ASP code) (http://www.talkphp.com/lounge/4091-i-love-maintaining-legacy-code-priceless-snippet-asp-code.html)

Village Idiot 04-02-2009 09:39 PM

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


allworknoplay 04-02-2009 09:49 PM

Quote:

Originally Posted by Village Idiot (Post 22677)
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

Krik 04-02-2009 10:11 PM

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.

Village Idiot 04-03-2009 02:30 AM

Quote:

Originally Posted by Krik (Post 22681)
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.

allworknoplay 04-03-2009 04:03 AM

Quote:

Originally Posted by Village Idiot (Post 22691)
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....

Village Idiot 04-03-2009 04:08 AM

Quote:

Originally Posted by allworknoplay (Post 22693)
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.

allworknoplay 04-03-2009 05:06 AM

Quote:

Originally Posted by Village Idiot (Post 22694)
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.

That's news to me. That right there tells you how little I know about ASP anymore! :-P

I really don't know what the difference between .NET web programming and ASP. If you want to give me a quick summary feel free to do so, but PHP is rocks and that's all I care about!!

Village Idiot 04-03-2009 02:22 PM

Quote:

Originally Posted by allworknoplay (Post 22696)
That's news to me. That right there tells you how little I know about ASP anymore! :-P

I really don't know what the difference between .NET web programming and ASP. If you want to give me a quick summary feel free to do so, but PHP is rocks and that's all I care about!!

ASP is a lot like PHP, but many less features and overall worse in my opinion. ASP.net only has the name in common, nothing else is the same. ASP.net has you program a page in HTML and their language, then you have a codebehind. The codebehind is unique since it is actually VB or C# (they have ports for languages like C++, but those aren't as featured with Visual Studio). Your code is actually compiled into machine code and hooked up with your script. This means that your core level function are already compiled into machine code, making them very fast.

This also gives you seemless integration with your existing VB applications. For instance, I am making a DLL that can pull and process data from a feed. I will be using it both in a computer and web application. They can both use the same DLL with extreme ease. This ups productivity time and blurs the generally rigid line between computer programming and web programming.

sketchMedia 04-03-2009 08:45 PM

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.

Village Idiot 04-03-2009 09:11 PM

Quote:

Originally Posted by sketchMedia (Post 22727)
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.

sketchMedia 04-03-2009 09:20 PM

Quote:

Originally Posted by Village Idiot (Post 22730)
We're not even trying, we're wiping it out soon enough.

haha, don't blame you.


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

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0