>> >I create a system with 8 major steps and each step can go different
>> >direction. General speaking, a lot of if statements and functions inside.
>> >
>> >Each page is over 1000 lines. In order for me to debug, I separate the lines
>> >by function and create a template page.
>>
>> 1,000 lines is big. Big enough that you're likely causing a slowdown
>> somewhere that you don't need to. Modularize the options and put them
>> in separate code pages.
>
>I'm a little confused. I'm somewhat new to this ASP stuff, but I've
>been developing software for over 20 years (way over, come to think of
>it), and to my mind 1000 lines is not a big program. In fact, it's
>barely non-trivial.
VB apps routinely run many thousands of lines of code. But rarely
does the server need to process an entire VB application just to
display a logon screen. Plus, the nature of ASP and the web means you
don't need all the code for an application in one page.
>Is it a matter of terminology? When Lin Ma says "pages" maybe she
>doesn't mean what you guys mean when you say pages.
My take is a "page" means a single "file" processed and sent to the
browser.
>In one of the subsystems of my application I have a main "page" that has
>about 450 lines in it. About half of that is the main code (about half
>of which is comments) and the other half is utility subroutines. There
>is no display code in this file.
If Lin Ma has 1,000 lines and half are comments and another third are
blank, that's a different story. But in the ASP world, 1,000 lines of
code is pretty danged big.
>In this main "page" I include fourteen directly related ASP files and
>four data files. The ASP files collectively have about 700 lines in
>them. In addition I include another nineteen general purpose ASP files
>that do things like capitalize words, query the database, generate
>dynamic "<select>" controls, etc. That adds another 500 lines of code,
>or so.
That can also be dramtically squeezed from the sounds of it. Or at
least broken up.
>Rather than have an unruly, unmanageable string of response.redirect-
>related pages like the system it replaces, it has a central ASP page
>that accepts the client-side input and generates the appropriate
>response pages on the fly.
Unruly and unmanageable aren't the code's fault. But the solution is
rarely putting everything in one large file.
>I don't see how it could be done in less than, well, 1500 - 2000 lines
>of code.
I don't either. But I don't have the code...
>So are you (Aaron, specifically) claiming that I should break that up
>into a dozen individual pages that use the WEB equivalent of "goto"
>(response.redirect) to switch between them?
No. But discreet points where user input is needed probably should be
in discreet pages. You have 500 lines of code that query databases,
capitalize words, create dynamic SELECT controls, all of which could
possibly be better handled elsewhere. (Well, for one thing, ASP.NET
might help with some of your controls...) If you don't need to query
a database at the same time you capitalize words, don't put the
functions in the same page. In fact, handle capitalization on the
input side instead of the output, you capitalize once instead of every
time.
There's no real "method" to handle any of this. And what works in one
case most certainly won't work in all. For example, I have pages
which could easily be optimized, but they rarely get run and the
performance increae would be minimal so why bother? My efforts are
better spent elsewhere.
Jeff