A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Strict Data Typing

  1. #1
    dubba you tee eff steven_h_2000's Avatar
    Join Date
    Oct 2000
    Columbus, Ohio

    Strict Data Typing

    What are your thoughts on Strict data typing? I uise it as much as possible, check out the article I wrote about it on my blog: Why strict data typing is good

  2. #2
    All 1s and 0s dmonkey's Avatar
    Join Date
    Nov 2005
    Leeds, UK

    The ability to declare variables before actually assigning to them has been around long before strict data typing, simply by using the "var" statement:


    var myVar;

    The "var" statement should always have been used prior to the use of strict data typing. Secondly, you seem to have overlooked one of the most useful features of strict data typing, which is the enhanced debig ability.


    //Without Strong Typing;
    var myString = "Some String";

    var myArray = myString;
    //No error. This is a contrived example, but accidentally assigning wrong data types
    //is a common error, and one that Flash won't always pick up on. We want myArray
    //to be an array obviously, but Flash doesn't know that, so it allows me to assign a
    //string to it, something I obviously don't want.

    //With Strong Typing;
    var myString2:String = "Some String";

    var myArray2:Array = myString2;
    //Flash spits out an error, telling us we made a type mismatch. Not only that, but it
    //tells us exactly where in the code it happened, so we can go and fix it.

    Using strong typing (or strict data typing) brings Flash into line with other common programming languages, that wouldn't dream of allowing you to assign a number to what was previously a string, for example. If you want your code to be robust and readable, then you should definitely take a look at using strict data typing.
    "If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton

  3. #3
    dubba you tee eff steven_h_2000's Avatar
    Join Date
    Oct 2000
    Columbus, Ohio
    Yes it has been around for quite some time, but the history of strict data typing wasn't my goal to explain in my blog post, I was wanting to make it relevant to AS.

    But you are correct, and I thought I had explained it in my post, but code with strict data typing is a hell of a lot easier to debug.

  4. #4
    Join Date
    Oct 2005
    I really get the point of Strict Data typing, but a lot of my code needs to have variables that can change, so for me. It took me ages to be bothered to even comment my code, so it'll be a while until i start using it. lol
    Help build a Flash Online Multi Player RPG:

    trac link

    Will be Open Source
    BETA should be out end of year (hopefully )

  5. #5
    Senior Member RangrJay's Avatar
    Join Date
    Sep 2005
    Las Vegas
    I really get the point of Strict Data typing, but a lot of my code needs to have variables that can change, so for me
    imarock....its bad style to change datatypes midway through your program/project.
    your way better off just creating a new var.

    but i agree, strict data typing is the best way to go. I always use it, just a good habit, especially if you do it for a company and someone else needs to go in a update it or change it or whatever.
    Xero Patience Studios
    Web Design
    Software Development
    Graphic/Logo Design

  6. #6
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    London, UK
    i lurrrrrrrrrrrrve strict data typing
    Flashmatics | Flashmatics Library (free downloads)
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    Flash Certified Developer

  7. #7
    FK Newb Beater
    Join Date
    Dec 2002
    Quote Originally Posted by silentweed
    i lurrrrrrrrrrrrve strict data typing
    Said like a true Englishman....

    I second that!
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  8. #8
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    CFA2h (respect the HEX)
    I just started using it, and so far I havent noticed a difference one way or another. (but Im not very advanced with AS yet)..

    any other nice new things that "help" us in AS 2.0?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center