惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
量子位
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - Franky
美团技术团队
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
罗磊的独立博客
Jina AI
Jina AI
小众软件
小众软件
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网
博客园 - 聂微东
博客园_首页
The Cloudflare Blog
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队

Secret Weblog

Becoming More Xee: A Modern XPath and XSLT Engine in Rust Looking for new challenges! Repeat Yourself, A Bit The Curious Case of Quentell The Humble For Loop in Rust The Humble For Loop in JavaScript Don Question Best Practices I Was a 1980s Teenage Programmer Part 5: Achieving Assembly I Was a 1980s Teenage Programmer Part 4: The Call of Assembly The Tooling Shift I Was a 1980s Teenage Programmer Part 3: MSX-2 JavaScript: when you need two ways to do it! Empowering Programming Languages Bloat and Retrofuturism Refreshing my Blog Again Random Rust Impressions Apilar: An Alife System I Was a 1980s Teenage Programmer Part 2: Olivetti M24 I Was a 1980s Teenage Programmer: the Alphatronic SolidJS fits my brain Is premature optimization the root of all evil? Framework Patterns: JavaScript edition Roll Your Own Frameworks Framework Patterns Secret Weblog Highlights Refactoring to Multiple Exit Points mstform: a form library for mobx-state-tree Seven Years: A Very Personal History of the Web
Obviel Compared
Martijn Faassen · 2013-01-29 · via Secret Weblog

I'm asked sometimes how Obviel compares to other client side web frameworks. This evaluation of JavaScript MVC frameworks provides a few useful points to consider and gives a good opportunity for me to highlight some features of Obviel.

I think Obviel comes out pretty nicely in this particular set of criteria, but of course many other criteria exist.

UI Bindings ✓

A declarative approach where the UI is updated when the underlying model changes.

Obviel provides this because views can listen to events on models. When a model is updated, an event can be sent to the model. If a view is currently representing the model in the UI, that view will be notified. A typical response by the view can be to rerender itself, but more detailed updates exist as well.

Obviel Forms uses a more direct form of data binding -- when you modify a field in a web form, an underlying JavaScript object is updated automatically with the JavaScript representation of that field. If you change the underlying JavaScript object, the form is automatically updated as well. I am hoping we can eventually expand Obviel Template with some features to do in-line updates directly, though re-rendering a view (these are typically small already) can take you a long way in the mean time.

Then there's Obviel Sync. Obviel Sync is a library that lets you declaratively bind models to some backend, typically a server. Using Obviel Sync you can automate the sending of events to models. Unfortunately Obviel Sync is as yet undocumented (the only part of Obviel not to have docs) and needs a bit more polishing. If you're interested in helping out, let me know!

While there is still a lot of potential in further expanding this approach, I think Obviel already has a pass mark on this feature.

Composed Views ✓

Compose views (preferably at the template layer). This should entail the potential for a rich view component hierarchy.

Obviel is built around the concept of composing views, and the template layer supports this. A central trick in Obviel is that the view to use for a model is determined by looking at that model - if you swap in a different model, a different view will be rendered. The code that renders the view doesn't need to know or care what specific view is used.

This can be driven from the template layer, by using the data-view directive.

You can create rich view components with Obviel; more about this in the next section.

A definite pass for Obviel on this feature.

Web Presentation Layer ✓

No native-style widgets, but instead let people use HTML and CSS.

What the right approach here is a debatable topic. Some client-side web frameworks provide a whole widget abstraction and you build the user interfact by composing those widgets together. Others are explicitly centered around HTML and templating. Both approaches have their advantages and disadvantages.

The author of the article leans heavily towards the approach where people use their own HTML and CSS. Luckily to gain the pass on this feature, Obviel fits in with this approach: Obviel is centered around HTML templates and JavaScript and lets you do everything on that level. It does not provide its own widget set but lets you use the UI elements you want to use, directly in HTML.

That said, it is possible to create widgets on top of Obviel, using Obviel Views. The Obviel Forms library is an example of such an approach. Another very interesting up and coming library created by Rob Gietema, Obviel Bootstrap, creates a set of Obviel views for Bootstrap UI elements. Note that you don't have to use Obviel Bootstrap to use Bootstrap with Obviel; instead you can directly use the bootstrap css classes in the HTML of the templates.

So, a pass for Obviel; Obviel's designed this way.

Plays Nicely With Others ✓

jQuery is pretty amazing. I want a framework which recommends using jQuery itself instead of providing its own sub-par jQuery clone.

Obviel is built on jQuery, so that's an easy pass for Obviel. jQuery extends jQuery in a small but powerful way by letting you do $(el).render(obj) to render a view on an element for an object.

Obviel passes on this one by design again.