Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

Origin of Coding Technique

Origin of a technique used to write subroutines



10:13 pm on Jul 10, 2006 (gmt 0)

10+ Year Member

I've been migrating and cleaning up a bunch of ASP sites at my current job and I've come across a particular coding "technique" that I find annoying and very hard to follow and would greatly appreciate some opinions.

Here's an example:


sub MySub()
Var1 = "foo"
Var2 = "bar"
End Sub


<!--include file="MyInclude.asp"-->
Call MySub()
Response.write Var1 & Var2

Although MySub has no arguments and can't return a value, after it's called two variables automagically appear. Amazing! I've also come across similar subroutines that create connections, recordsets, etc.

Now, if I'm not mistaken a Sub is Public by default, but IMHO no arguments and creating variables to use outside the scope of the sub is just asking for trouble. Is this some old school technique or just plain bad coding?


6:54 am on Jul 11, 2006 (gmt 0)

10+ Year Member

The person who wrote that should be fired! ;-)

Well, although VBscript apparently makes this kind of statement possible, it doesn't score high marks for readability.

A possible refactoring is to create a method that returns a class that contains the properties that are needed on each page (Var1, Var2).


7:55 am on Jul 11, 2006 (gmt 0)

10+ Year Member

This indeed is a very bad coding "technique".
I have more than 20 years experience in coding, mainly C, and if I would code like that my employer would fire me!


1:17 pm on Jul 11, 2006 (gmt 0)

10+ Year Member

Thanks for the input. It's nice to know my eye for bad technique is better than it was 6 years ago before I became a lonely code monkey. :)

Thanks again.


Featured Threads

Hot Threads This Week

Hot Threads This Month