in reply to Re^3: I dislike object-oriented programming in general
in thread I dislike object-oriented programming in general

++tilly for proving a surprising (to me, at least) example of where JS's object modeling goes wrong.

Personally, I think javascript's object model is cleaner than ruby's, but its prototype model seems quite alien when you're coming from a language that distinguishes classes and objects and for some reason javascript tries so very hard to hide that fact by stuffing so much niceness behind so many ugly constructs (for instance, when you've understood the JS model of inheritance, the new constructor() special operator and all it entails no longer makes any sense at all)

Replies are listed 'Best First'.
Re^5: I dislike object-oriented programming in general
by tilly (Archbishop) on Oct 21, 2007 at 21:14 UTC
    Cleaner is in the eye of the beholder.

    Personally I think that it makes a lot of sense to have a clear distinction between class methods and object methods. For instance it is obvious that a class called File should do things like open files and return the associated object. But it makes no sense to me to ask a file object to open other files. But that means that a file object should not inherit from File. In which case the natural implementation is to have a prototypical file which has no real file associated with it. Which "feels" wrong to me.

    But different strokes for different folks. In the end either object model works.