Java-esque OOP in JavaScript and a jQuery fail

前端 未结 6 1643
走了就别回头了
走了就别回头了 2021-02-08 06:31

I\'m working on a project and I\'m really trying to write object-oriented JavaScript code. I have just started reading Douglas Crockford\'s JavaScript: The Good Parts and I\'m q

6条回答
  •  礼貌的吻别
    2021-02-08 07:03

    It looks like you're writing all your code as jQuery plug-ins? I wouldn't do that. Create your own namespace.

    What's the goal in putting everything in different files? Unless they are scripts that will be used for specific pages, that just makes it harder to manage things. These all look like general library functions. Unless you think you'll want to load some on one page, but not all, then put them all in one file.

    Object oriented programming doesn't mean fragmenting stuff across files. That's just organization, you should break things into different files when you don't need all of the contents on some page.

提交回复
热议问题