Scripting vs Business Tier Code
-
I have noticed that my controls can call functions either as Java Script or VB Script. However, I have been implementing event handlers in C# using a separate business layer. What are the tradeoffs? When would I want to use a script instead of compliled code (C# / VB.NET)? I think that perhaps the difference is the scripts run on client side and the C# runs server side? As far as a scripting language, are there any specific versions of javascript or VBscript that are used with .NET, or are any OK? Thanks in advance, just trying not to wipe out on the learning curve, Pualee
-
I have noticed that my controls can call functions either as Java Script or VB Script. However, I have been implementing event handlers in C# using a separate business layer. What are the tradeoffs? When would I want to use a script instead of compliled code (C# / VB.NET)? I think that perhaps the difference is the scripts run on client side and the C# runs server side? As far as a scripting language, are there any specific versions of javascript or VBscript that are used with .NET, or are any OK? Thanks in advance, just trying not to wipe out on the learning curve, Pualee
JavaScript runs on client and has nothing to do with .NET neither has VBscript. Oh vbscript only runs on IE. When to use what? Well I think you should read some material on what JS is and can do, then you will see where to use it. For example: you will not wride DB code in JS, becaouse ju can't :D Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
-
JavaScript runs on client and has nothing to do with .NET neither has VBscript. Oh vbscript only runs on IE. When to use what? Well I think you should read some material on what JS is and can do, then you will see where to use it. For example: you will not wride DB code in JS, becaouse ju can't :D Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
Note to self: "avoid vbscript" :p Thanks for the quick reply, I've pretty much been following a pattern for another website, working on my own. Just trying to learn the ins and outs. It seems overwhelming trying to learn a new IDE, C#, ASP.NET, SQL, and now.... Javascript. Kind of the first time I've tried to pull this many different tools together, but I must say, I like it a lot! Pualee
-
JavaScript runs on client and has nothing to do with .NET neither has VBscript. Oh vbscript only runs on IE. When to use what? Well I think you should read some material on what JS is and can do, then you will see where to use it. For example: you will not wride DB code in JS, becaouse ju can't :D Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
I don't think that was his question. I think his question was more along the lines of how to deliniate the various layers in an application when implemeting the a layering pattern. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
-
I don't think that was his question. I think his question was more along the lines of how to deliniate the various layers in an application when implemeting the a layering pattern. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
Well, my question was answered somewhat, but your interpretation is nice as well. Any thoughts you can share? I know I want to put as much work as possible client side (to keep the server fast) but have to keep some processing on the server for interacting with the DB and possibly other services or applications. The J2EE model is very similar with their Application Servers. Session and Entity beans are used for the business layer while JSPs and CGIs are used for presentation. Perhaps the answer is that scripting is used for presentation, while everything else is deferred to C# event handlers? Pualee
-
I have noticed that my controls can call functions either as Java Script or VB Script. However, I have been implementing event handlers in C# using a separate business layer. What are the tradeoffs? When would I want to use a script instead of compliled code (C# / VB.NET)? I think that perhaps the difference is the scripts run on client side and the C# runs server side? As far as a scripting language, are there any specific versions of javascript or VBscript that are used with .NET, or are any OK? Thanks in advance, just trying not to wipe out on the learning curve, Pualee
Pualee wrote:
When would I want to use a script instead of compliled code (C# / VB.NET)?
You would use a script when you need instant feedback on the user interface. For example, if you have a text box that is supposed to take a number then you can, in javascript, verify that the user is typing in numbers. That way the user doesn't have to wait for a round trip to the server to be told "you can only put numbers in that text box". However, you've probably noticed that doing that won't necessarily fit with your nice layered architecture. And this is a difficult question to answer. With things like AJAX it is possible to have some javascript call some code on the server (which would call into your business layer) and return a value to the javascript so that the page can be updated without the whole thing going back to the server. This offers a good compromise between the whole page going back and putting complex business logic in the javascript.
Pualee wrote:
I think that perhaps the difference is the scripts run on client side and the C# runs server side?
Yes.
Pualee wrote:
As far as a scripting language, are there any specific versions of javascript or VBscript that are used with .NET, or are any OK?
It isn't the version that is used with .NET that is important, but the version that is on the browser - as it is the browser that is doing the work. Does this help? ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
-
I have noticed that my controls can call functions either as Java Script or VB Script. However, I have been implementing event handlers in C# using a separate business layer. What are the tradeoffs? When would I want to use a script instead of compliled code (C# / VB.NET)? I think that perhaps the difference is the scripts run on client side and the C# runs server side? As far as a scripting language, are there any specific versions of javascript or VBscript that are used with .NET, or are any OK? Thanks in advance, just trying not to wipe out on the learning curve, Pualee
Okay its like this. Layers are used to separate functionality. Thats all. Javascript does not or should it EVER manage business rules! Java script is for screen interactions only (UI) The UI layer is for formatting data carried fromm the business layer only The business layer takes information from the data layer. Builds the business object and performs all business validations needed. The data layer just returns data from your data source whatever that may me text files, sql, mysql, oracle, microaprocessors, rs-232 serial input/output, etc... don't let anyone tell you different 1 line of code equals many bugs. So don't write any!!