IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesVB.NetLanguage Details  Print This     

Cross Ref > Language Details

By Mike Prestwood

VB.Net versus ASP Classic: A side by side comparison between VB.Net and ASP Classic.

 
Language Details
 

Language Details is kind of a catch all for stuff that didn't make it into language basics nor any other category.

Custom Routines

[Other Languages] 

Languages Focus

For non-OOP languages, a custom routine is a function, procedure, or subroutine and for pure OOP languages, a custom routine is a class method. Hybrid languages (both non-OOP and OOP) combine both.

VB.Net:   Sub, Function

VB.Net is a fully OOP language so both Subs and Functions are methods of a class. A Sub does not return a value while a Function does.

Syntax Example:  
Private Sub DoSomething(ByVal pMsg As String)
'...some code.
End Sub

Private Function GetAge(ByVal x As String) As Integer
GetAge = 7
End Function
ASP Classic:   Sub, Function

ASP Classic is a non-OOP language with some OOP features. It offers both Subs and Functions. A Sub does not return a value while a Function does. When Subs and Functions are used in a defined class, they become the methods of the class.

Syntax Example:
Sub SayHello(ByVal pName)
  Response.Write "Hello " + pName + "!<br>"
End Sub
 
Function Add(ByRef pN1, ByRef pN2)
  Add = pN1 + pN2
End Function




Inline Code

[Other Languages] 

Languages Focus

Also known as embedded code where you embed another syntax language within the native code of the development environment you are using. The inline code can be compiled by the current development's compiler or by an external compiler.

Do not confuse with inlining which is a coding technique where custom routines are moved inline where the code is executed either by you, by a compiler directive, or automatically by the compiler.

VB.Net:   Not Supported

Since all the .Net languages compile into intermediate language (IL), and not to a specific CPU, they do not provide support for inline assembler code.

ASP Classic:   Not Supported




Inlining

[Other Languages] 

General Info: Inline Routines

Instead of calling a routine, you move the code from the routine itself and expand it in place of the call. In addition to manual inlining, some languages support automatic inlining where the compiler or some other pre-compiler decides when to inline a code routine. Also, some languages allow for developer defined inlining where the developer can suggest and/or force the inlining of a code routine. Inlining can optimize your code for speed by saving a call and return, and parameter management.

Languages Focus

Does it support inlining? If so, does it support developer defined inlining? Does it support automatic inlining? Both?

VB.Net:   Automatic

In VB.Net, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.

More Info / Comment  
ASP Classic:   Not Supported




Overloading

[Other Languages] 

Types of overloading include method overloading and operator overloading.

Method Overloading is where different functions with the same name are invoked based on the data types of the parameters passed or the number of parameters. Method overloading is a type of polymorphism and is also known as Parametric Polymorphism.

Operater Overloading allows an operator to behave differently based on the types of values used. For example, in some languages the + operator is used both to add numbers and to concatenate strings. Custom operator overloading is sometimes referred to as ad-hoc polymorphism.

VB.Net:   Overloads, or implicit

VB.Net supports both method and operator overloading.

For method overloading, you either use implicit overloading (no special syntax like C#) or use the Overloads keyword. If you use the Overloads keyword, all overloaded methods with the same name in the same class must include the Overloads keyword.

ASP Classic:   Not Supported

ASP Classic does not support any type of overloading.

  • Operator - No.
  • Method - No.

Some developers like to pass in an array and then handle the array for a pseudo technique. Although not overloading, it's useful.





Parameters

[Other Languages] 
VB.Net:   ByVal, ByRef

By Reference or Value
For parameters, you can optionally specify ByVal or ByRef. ByVal is the default if you don't specify which is changed from VB Classic (in VB Classic, ByRef was the default).

Syntax Example:  
Private Function Add(ByRef a As Integer, _
ByRef b As Integer) As Integer
  Add = a + b
End Function
ASP Classic:   ByRef, ByVal

By Reference or Value
For parameters, you can optionally specify ByVal or ByRef. ByRef is the default if you don't specify.

Syntax Example:  
Function SomeRoutine(ByRef pPerson, ByVal pName, Age)




Self Keyword

[Other Languages] 
VB.Net:   Me

To refer to the current instance of a class or structure, use the Me keyword. Me provides a way to refer to the specific instance in which the code is currently executing. It is particularly useful for passing information about the currently executing instance.

The Me keyword is also used as a modifier of the first parameter of an extension method.

You cannot use Me with static method functions because static methods do not belong to an object instance. If you try, you'll get an error.

Syntax Example:  
Sub SetBackgroundColor(FormName As Form)
  //FormName.BackColor = ...some color
End Sub
  
//Pass Me.
SetBackgroundColor(Me)
ASP Classic:   me

Same as VB. The Me keyword is a built-in variable that refers to the class where the code is executing.

Syntax Example:
Class Cyborg
 Public CyborgName
 
 Public Function IntroduceYourself() 
  'Using Me. Prints Cameron.
  Response.Write("Hi, my name is " & Me.CyborgName & ".")
  
  'The above is just a demo. You could also not include "Me." 
  'in this case because we are in context of Me now. Using Me 
  'makes more sense when you start to pass Me as a parameter 
  'to a method.
 End Function 
End Class




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]