SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Jun 2006
    Location
    Durban, South Africa
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    YUI, extjs and similar coding styles

    Hi all.
    Looking around the net lately, it seems that more and javascript is being written in the same style as the YUI, extjs and openwysiwyg style. Example below

    Code:
    var test = {
      a_func: function() {
        blah blah
      }
    }
    What are the benefits to coding this way?
    From what it looks like to me, it simulates a class, is that correct?
    So how exactly does it all work?
    How do you create private / public variables?
    Are there any sights out there that explain how this style of coding works?

    Thanks in advance

  2. #2
    SitePoint Member RIAguy's Avatar
    Join Date
    Jul 2008
    Location
    Boston
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is basically JSON (JavaScript Object Notation) style notation. The major advantage is that it allows you to build very complex objects and namespace with a relatively small amount of script.

    A side advantage is that the script tends to become more readable to people who are used to working in curly-bracket style object oriented languages like C#, Java or C++.

    If you work with very large blocks of JavaScript (as I do), you'll find that the code become somewhat easier to manage when you look at it. It's neater when you get used to it.


    RIAspot.com

    RIA Community

  3. #3
    SitePoint Addict
    Join Date
    Jun 2006
    Location
    Durban, South Africa
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool thanks for the reply. Seems replies on this topic are a bit scarce...
    Do you have any good reference sites. Iv had a look on the net, but so far have found really bad sites.

    Thanks a lot for the reply though, has helped a bit

  4. #4
    SitePoint Member RIAguy's Avatar
    Join Date
    Jul 2008
    Location
    Boston
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's one i came across, which seems to be OK.

    I don't have any great references. I've been programming JavaScript for about 10 years now, so I don't use them much.

    mckoss.com/jscript/object.htm


    RIAspot.com

    RIA Community

  5. #5
    SitePoint Addict
    Join Date
    Jun 2006
    Location
    Durban, South Africa
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man looks pretty good.


Bookmarks

Posting Permissions

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