programming efficiency

G

gdp

hi

could i please have some opinion on how efficeint or otherwise my
programming method is.

i have just finished a project for there are six different departments at
the client all using similar management information screens. this is a web
application written in vbscript and using SQL server. the views they have
of the data are similar but not exactly the same. because there are many
calculations (some dealing with invoicing) involved i wanted to only have
one bit of code that did any one thing. these bits of code were done as
subs and functions which were passed many parameters when called. if a
particular department needed slightly different views that would be detailed
in the parameters passed. this way the logic is in only one place and if a
calculation is wrong it gets fixed just once. all well and good....but.

the different departments all have their own directory within the client
directory and i also have a directory called COMMON_LIBRARY where i put a
single long script (around 5000 lines). this script contains all the logic
described above for the whole system. each department directory contains
and script called MAIN which contains "flow" logic for the system. each
page passes form or querystring variables inluding one called SYSSTATE whic
tells the MAIN script what is being done. MAIN contains a big select case
on SYSSTATE and the individual pages are set as includes

eg

select case SYSSTATE
case 1
%>
<!--#include file="do-this.asp" -->
<%
case 2
%>
<!--#include filedo-that.asp" -->
<%

....etc....


the big logic script containing all the subs and funcs that are called from
the includes is also included in this MAIN script.

my worry is....doing it this way, every time I load a page on the system I
am loading all the lines in the COMMON_LIBRARY script, the MAIN script and
also all the includes it contains...this is a lot of code and all the
particular page may be doing is asking the user to fill in their login name
and submit it.

it does not seem a slow system to use and it has been in use for a few weeks
now but it "feels" like a bad way to do it. i really like, however, having
this one source of logic that just gets put in everything. i know that all
my routines are there to do anyhting the system needs to and also that i
have a single point of change for debugging.

any thoughts????

thanks

gdp
 
A

Aaron Bertrand [MVP]

single long script (around 5000 lines).

5000 lines? We have entire full-service ASP applications that are half of
this size, all pages included. Loading 5000 lines every time the user runs
a page is going to bite you eventually, I guarantee it.

The largest ASP script I've ever worked with was 250 lines, maybe. And it
was completely self-supporting. Sounds like you should break apart your
includes by functionality. For example, you don't need your connection,
getRows() or paging helper functions on any ASP scripts that never touch the
database.
 
D

dlbjr

just include the file on all pages.

On the first load the included page will be cached in ram.
After that the page will load from Ram and perform great.

Although, the logic would perform much better in a stored proc on the sql
server and reduce the amount of data received from the sql server.


-dlbjr

Discerning resolutions for the alms
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top