开发者

Modern javascript design approaches to manage complexity? [closed]

开发者 https://www.devze.com 2023-04-01 12:48 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical a开发者_StackOverflowndcannot be reasonably answered in its current
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical a开发者_StackOverflownd cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have a web app with a javascript code base that's growing enough in size to where I've had to start re-evaluating how to best design this to manage the complexity. This has led me to a few questions on JavaScript design patterns:

  • Are HTML5 data- or otherwise custom attributes a good idea? Might they create a problem by coupling controller/viewmodel logic to the presentation layer? Does this create potential conflicts with a test-driven development methodology?
  • Do data- attributes serve the same purpose as expando properties?
  • From experience, anecdotal evidence, or otherwise - how useful has the MVVM pattern proven to be in practice? Do you see any limitations with it? One I have found is that there isn't always a straightforward data binding from a javascript object to a UI control. For example, binding a collection to a jQuery plugin/widget. As with WPF/Silverlight, if the control author didn't design the control to support the MVVM pattern, then you may be forced to create workarounds.

  • How much of a problem is it to do polling in javascript (e.g. window.setInterval)? How bad is the performance penalty if I want to poll 10, 100, or 10,000 javascript objects (no network requests) in typical app. or how would you measure this? Sometimes I've found it useful to poll some condition to trigger a change in the UI, like CanExecute.

0

精彩评论

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

关注公众号