Re: Option Strict

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Kevin Spencer (kspencer_at_takempis.com)
Date: 10/14/04


Date: Thu, 14 Oct 2004 11:50:14 -0400

Great point. Let me give an example, from my real-life experience. I came to
work for this company a year and a half ago, and the guy that was directly
underneath me had taught himself VB.Net coming from a VB/ASP background. He
didn't use Option Strict. He had private fields that were integers exposed
via public properties that were strings. Imagine the difficulty tracing down
an issue with a non-integer string value being used to set the value of the
Integer field. Data types are important, moreso as the bigger and more
complex the app becomes. Making sure that your data types are correct not
only speeds up runtime performance, but can prevent some hard-to-identify
errors from happening as well.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Scott M." <s-mar@nospam.nospam> wrote in message
news:urgzotWsEHA.1404@TK2MSFTNGP11.phx.gbl...
> Option Strict also "disallows late binding".
>
> Late binding is when the application doesn't know until run time what an
> object's true type is.  This causes more overhead to your application and
> opens the door to errors.
>
> Not allowing late binding (and therefore enforcing early binding) means
that
> all objects must know their type at design time, because of this, the
> IntelliSense in VS.NET tells you what class members are allowed on the
> object.
>
>
> "Simon Harris" <too-much-spam@makes-you-fat.com> wrote in message
> news:uxdp6OWsEHA.2808@TK2MSFTNGP14.phx.gbl...
> > Hi All,
> >
> > I've been advised to use option strict. I've tried to read up on this,
all
> > i can find is that it...
> >
> > "disallows implicit narrowing conversions"
> >
> > This kinda makes sense - Means I have to explicitly cast or convert data
> > when comparing/setting two different data types right?
> >
> > Is there any more to it than this? What are the benefits of using option
> > strict?
> >
> > Regards,
> > Simon.
> >
>
>


Relevant Pages

  • Re: Option Strict
    ... Option Strict also "disallows late binding". ... This causes more overhead to your application and ... > when comparing/setting two different data types right? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What happens after runtime?
    ... E.g. when you add webcontrols to your markup in the designer, ... when you add controls dynamically while the app is actually ... I learnt the term "late binding" from a book which I am using to learn ... runtime but then variables of other data types are also not processed ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: F#
    ... what is done by default (late binding or not). ... > What would those changes to data types be? ... > How can you define a conversion and have it type-checked? ... I have seen some research papers on the subject, but most concentrated on the mechanis of an upgrade - not that that would be irrelevant, but there's a definitive lack of papers on the semantics. ...
    (comp.lang.functional)
  • Re: Late Binding
    ... |> As you may know you use Option Strict On to avoid late binding! ... It can in my opinion give a complete wrong idea ... Generates an error for late binding. ... late binding, then ergo it is the what you use to avoid late binding, as ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Late Binding
    ... > It would seem obvious to me that if Option Strict On generates an error ... > late binding, then ergo it is the what you use to avoid late binding, as ... I showed in my first sample in this thread how to fix those errors where you ...
    (microsoft.public.dotnet.languages.vb)