ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 15th, 2003, 05:17 PM
Kruzien2002 Kruzien2002 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Using sub-routines in ASP

Ello,

I'm trying to code my apps like I would a program using OOP's seperating the logic from presentation.

Since ASP is a scripting language how far should you go in spliting up the operations into sub-routines.

I'm initially considering using it for user management (authentication, session, etc)

Normally I just put the code where I need the effect but when it comes to alterations it is time consuming.

Are there any guidelines I should follow or best practices which would help in this implementation.

Thanks


--------------------------------------------------------------
So much trouble in the World - Bob Marley
------------------------------------------------------------

Reply With Quote
  #2  
Old January 16th, 2003, 09:20 AM
Kruzien2002 Kruzien2002 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation

Me Again,

Is it better to do them using Jscript or Vbscript my question sounds dumb but i'm not sure if they both work without problems
(interacting with each other that is)



----------------------------------------------------------------------------
Knowledge = Call ForumHelp(status 'begging', matter 'urgent' )

i.e get the idea
---------------------------------------------------------------------------

Reply With Quote
  #3  
Old January 16th, 2003, 03:54 PM
wes wes is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 24 wes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wow, you must not have too big of programs if you aren't using Functions/Subs. Otherwise I bet you have a bunch of code in If statements. Actually, using Functions and Subs isn't really OO, but using Classes is. Each class should have a specific intention and all of its functions and subs will be the methods needed for that class.

For instance, I have a database class that has Functions (they return true/false based on success in completion) to handle various DB tasks such has open connection, open recordset, execute SQL, close recordset, and close connection.

When getting down to object oriented programming though, classic ASP nor PHP really fully fit the bill like Java/C++ do. True OO would involve using classes with subclasses with subclasses, etc.., and ASP & PHP only support 1 class level. Sure you can open classes within classes, but each class is a local object and it is not possible to traverse up/down the class tree.

Reply With Quote
  #4  
Old January 17th, 2003, 02:20 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
If you wanna properly separate your business logic and presentation, your can code some DLL's (called COM objects). You can write these in a few language, usually people use VB or C++. Writing COM's will greatly increase your app's performance.

I'm with wes, how on earth have you survived without functions/subs?!

PS - you can write classes in ASP, but they're not really proper classes.

Reply With Quote
  #5  
Old January 17th, 2003, 08:43 AM
Kruzien2002 Kruzien2002 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Jamaica
Posts: 25 Kruzien2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ello again,

I actually do use them but my problem is how far can I go with them.

I'm used to JSP with beans, etc, so normally I seperate every blessed thing from presentation. Transfering now to ASP and trying out a few things.

Cause the examples you normally find on the net do everything on the page. I wondered if it was a common practice.
If you know of any site that deals with structuring ASP send the link


Thanks again I go split this crap now

Reply With Quote
  #6  
Old January 17th, 2003, 05:36 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Yeah - the ASP language tends to promote sloppy coding. It doesn't exactly make it easy to seperate your business/pres logics.

Try not to get into the habbit of putting the code in the HTML. It's bad because if you want to change the site, it's not the simple act of changing your HTML templates.

Placing your subs/functions in 'include' files is generally idea, as is coding up COM's for larger sites. If you wanna know more, feel free to ICQ me.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Using sub-routines in ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT