Results 1 to 5 of 5

Thread: OOP in JavaScript

  1. #1
    Join Date
    Mar 2010
    Location
    Scotland
    Beans
    258
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    OOP in JavaScript

    Anyway, I have just left Flash in a fit of fury about what happened 5 months ago, so I have decided to start using JavaScript and canvas now! Yay!

    I was/am working on a crude XML interpreter that could be expanded to make it easy to make RPGs and Platformers. Well, that sounds completely useless, maybe. Who knows!? It'll be fun as well, maybe. (See http://i.savagewolf.org/DuskWolf.swf and http://i.savagewolf.org/pong.xml )

    Anyway, I want to use OOP design thingies in JavaScript, but what I've read of it so far suggests to me it's rather hacky and confusing. But I have heard of those "translator" programs that translate, say, Python to JS (Pyjamas), and am wondering if you wise people would recommend me using them for this, or if they are too slow or complicated, or something. Maybe.
    [538] [792] Just because you have a secure OS doesn't mean you are invincible. Be careful out there! Don't trust strange sites and such. Also, don't block JavaScript, It is not some insecure monster who will attack you at every turn!

  2. #2
    Join Date
    Nov 2010
    Location
    Down the rabbit hole
    Beans
    435
    Distro
    Ubuntu Development Release

    Re: OOP in JavaScript

    If you're into online graphics & games then flash so far is the better choice. The canvas support and 2D drawing speed varies wildly across browsers. Otoh Flash is pervasive and fast enough for certain scenarios.
    WebGL requires GL knowledge and is still too bugy and lacks unified sound and keyboard/joystick controls, not to mention IE doesn't support it for political reasons which M$ pretends are technical (security related, which pretty much have already been fixed).
    So, if you're going after JavaScript, then yes, it's rather a procedural language than an object oriented one, but I'd still suggest writing code directly in JavaScript rather than using a translator.
    My 0.02$

  3. #3
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: OOP in JavaScript

    OOP in JavaScript is not really hacky, it's just different to what people are used to.

    http://en.wikipedia.org/wiki/Prototy...ed_programming

    Once you get the hang of prototypes, they're actually quite nice.

    In addition to prototype-based OOP, another interesting feature of JS are actually its hints of functional programming. Good JS makes extensive use of both... the language is actually quite far from being plain procedural.
    LambdaGrok. | #ubuntu-programming on FreeNode

  4. #4
    Join Date
    Feb 2009
    Beans
    789
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: OOP in JavaScript

    Flash is on the way out though. Million dollar companies are already rewriting their Flash websites to HTML to make content accessible on mobile devices.
    "The eagle never lost so much time as when he submitted to learn from the crow."

  5. #5
    Join Date
    Apr 2010
    Location
    Brighton, England
    Beans
    52
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: OOP in JavaScript

    Agreed. Flash is a dying technology. I got out of ActionScript two years ago - a good career decision, I think.

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
  •