Results 1 to 2 of 2

Thread: Programming JavaScript with a classical object-oriented approach.

  1. #1
    Join Date
    Jan 2014

    Programming JavaScript with a classical object-oriented approach.

    Lately I've started to think that it might be a good thing to program JavaScript with a classical object-oriented approach because then it is possible to take advantage of things like design patterns. JavaScript does not have things like abstract classes, interfaces, implementing interfaces so I found a JavaScript framework that offers this functionality, easejs.

    Question #1: Do you think that it's a good idea to program JavaScript with a classical object-oriented approach?
    Question #2: If yes, how would you organize the files? For example, in Java they have a class in it's own file.

  2. #2
    Much as I don't think MVC works properly in PHP because it's not how the language works, trying to use 'classical object' methods in JS is a bad idea because JavaScript's object model is a JOKE. It's like it was tossed on the language as an afterthought and really few of the programming paradigms that work in a real OOP language (Smalltalk, Modula, Object Pascal) translate well -- if at all -- to it.

    There's also the simple fact that if you are using enough JS for something like true OOP design patterns to pay benefits, you're probably doing something wrong that likely has no business being done in JS in the first place.

    But then, not counting social media plugins I get squirrelly if I have more than 32k of scripting on a website. You need more than that it's likely you're just doing something wrong. Hence why I have in the back of my mind at all times the "Unwritten rule of JavaScript"

    If you can't make a fully functional page without JavaScript FIRST, you likely have no business adding scripting to it!

    Which of course is why 90%+ of websites take a minute first-load thanks to the MEGABYTES of JS for nothing; and why all these idiotic halfwit frameworks are pissing all over the functionality of websites with their "Gee ain't it neat" but ultimately useless BS.

    JS for nothing and your scripts for free. That ain't workin', that's not how you do it. Lemme tell ya, these guys ARE dumb.

    I want my.... I want my... I want my P H P...
    Last edited by deathshadow; 06-27-2014 at 12:52 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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