开发者

Are there any good design practices or standards for JavaScript development? [closed]

开发者 https://www.devze.com 2023-02-10 22:09 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 6 years ago.

Improve this question

When developing with object-oriented languages like Java or C#, it's not uncommon for developers to use design tools like UML to make class diagrams, create interfaces, define major components and interactions, outline an API, etc., before beginning the implementation.

I know for most small JavaScript applications, these software engineering principles may 开发者_运维知识库be overkill, but if you're developing a library (jQuery, YUI) or creating a large application (Gmail, Google Docs), it's a good idea to create a design and plan ahead before you start writing any code.

Are there any similar practices used in JavaScript development or web development in general?

Edit:

Just to clarify, I'm not interested in creating classes/interfaces or making UML for JavaScript. JavaScript is a different paradigm from the likes of Java/C# and therefore needs different design tools. I'm interested in knowing what those JavaScript design tools/practices are, if any.

Maybe this question better asks what I'd like to know: If a company like Google created a large web application and had several dozen team members create it, what processes, documents, and practices would such a team use to successfully create, collaborate, and solidify a design? What tools (e.g., UML, flow charts, scribbled notes on a piece of paper) would they use to work on and share the design of the application (without writing a single line of code)?


I'm a fan of the Google Javascript Style Guide:

https://google.github.io/styleguide/javascriptguide.xml


I think the answer depends largely on which libraries, if any, you are using client side.

Jquery code looks very different from Sencha or Sproutcore code, for example. In Sencha and Sproutcore, the framework provides you with a 'class' system for developing components, so these frameworks lend themselves to the canonical forms of design patterns.

Also note that javascript is very different then Java or C#. You can impose an interface type system on your code, but many would argue that you are killing the javascript dynamic-language awesomeness if you do.

That said, its always good to have a plan. If you can stay DRY by extending JS objects, then I think you should. And it always makes sense to put some high level design in place.

0

精彩评论

暂无评论...
验证码 换一张
取 消