/    Sign up×
Community /Pin to ProfileBookmark

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.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@deathshadowJun 27.2014 — 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"

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

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.

[i]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...[/i]
×

Success!

Help @vbelenky spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...