473,395 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

programming efficiency

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
Jul 19 '05 #1
3 1274
> 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.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
TJS
possibly change the include's to server.execute's and that should help
"gdp" <gp********@blueyonder.co.uk> wrote in message
news:BK*************@news-binary.blueyonder.co.uk...
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

Jul 19 '05 #3
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
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Fred Ma | last post by:
After being away from using the STL for about 6 months and trying to appreciate what I was doing back then, I am realizing that programming is truly an art. You have to be in some kind of manic...
51
by: N4M | last post by:
Dear, May I ask how productivity of a(C++) programmer can be measured? If it is measured by number of code lines per day, what are the estimated productivity of a programmer at beginer,...
32
by: cat_dog_ass | last post by:
I am used to programming in DOS mode via Borland C++. I would now like to create programs for the Windows envirinment. Is it absoultely necessary to use Visual C++ to do this? Are there other tools...
16
by: Jason Heyes | last post by:
class Point { double x, y; public: Point(double x_, double y_) : x(x_), y(y_) { } double get_x() const { return x; } double get_y() const { return y; }
34
by: Volker Hetzer | last post by:
Hi! I've done lots of programming for CAD, which was basically C/C++ and tcl/tk. Now, we are thinking about introducing more web based tools, programming them ourselves and right now the toolchain...
134
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've...
335
by: extrudedaluminiu | last post by:
Hi, Is there any group in the manner of the C++ Boost group that works on the evolution of the C language? Or is there any group that performs an equivalent function? Thanks, -vs
47
by: Thierry Chappuis | last post by:
Hi, I'm interested in techniques used to program in an object-oriented way using the C ANSI language. I'm studying the GObject library and Laurent Deniau's OOPC framework published on his web...
9
by: Royt | last post by:
Maybe it's a stupid question, but I really couldn't figure it out. C++ is expected to be a better C, provides compatibility with C, and is able to do all that C can do. however, the number of...
9
by: OldBirdman | last post by:
Efficiency I've never stumbled on any discussion of efficiency of various methods of coding, although I have found posts on various forums where individuals were concerned with efficiency. I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.