`
butter
  • 浏览: 125734 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Comparing Mobile Web (HTML5) Frameworks: Sencha Touch, jQuery Mobile, jQTouch, T

阅读更多

It’s been an exciting year for the mobile Web. Adoption of HTML5 and CSS3, improved performance in mobile browsers, and an explosion of mobile app frameworks mean it’s more feasible than ever to create rich, interactive Web experiences for mobile devices. Using a wrapper like PhoneGap, you can distribute them via the native app stores for iPhone, iPad, and Android —targeting multiple platforms with a single codebase.

Or can you?

I needed a platform for Pints — a mobile app that answers answer the question, “Which beer should I order?” As someone who works in Web technologies on a daily basis I saw HTML5 & friends as an alluring option.

Pints isn’t complicated: a home screen, a few lists screens, a few forms. Its greatest complexity lies at the data level: as an iPhone app destined for San Francisco bars it can’t possibly rely on an Internet connection, so it has to keep a local copy of the beer database and sync it with the server when that’s available. HTML5 has the necessary building blocks in the form of several offline storage options; it’s just a question of writing the synchronization code.

Mobile Web developers have a plethora of frameworks to do the heavy lifting for them: animated transitions, toolbars, buttons, list views, even offline storage. Most of these are new and the landscape is shifting rapidly. I started Pints in jQTouch, then migrated to jQuery Mobile, and finally rewrote the whole app (now in private beta) in Sencha Touch. Along the way I also investigated Appcelerator’s Titanium Mobile. Here’s what I found:

JQTOUCH

jQTouch is easy to use and relatively well-documented. It’s featured in the excellentBuilding iPhone Apps with HTML, CSS, and JavaScript. jQTouch takes a progressive-enhancement approach, building an iPhone-like experience on top of your appropriately-constructed HTML. It’s simple, providing a basic set of widgets and animations and just enough programmatic control to permit more dynamic behavior.

But even in my simple test app there were performance issues. Page transitions can be jumpy or missing, and there are periodic delays in responding to tap events. And while the project is technically active, the original author has moved on and development seems to have slowed.

jQTouch is available under the permissive MIT License, one of my favorite open source licenses.

JQUERY MOBILE

jQuery Mobile is the new kid on the block. Announced in August 2010, it’s quickly progressed to a very functional Alpha 2. It takes a similar – but more standards-compliant – approach to jQTouch and feels very much like that framework’s successor, with a broader array of UI controls and styles.

jQuery Mobile’s performance is variable (though better than that of jQTouch), particularly in responding to tap events rendering animations. It also lacks a small number of key programmatic hooks that would permit easy creation of more dynamic apps. For instance, there’s an event that triggers when a page is about to load (i.e. slide into view) but no way to tell the associated handler code what UI element resulted in the page switch, or to pass additional information to that handler. I was able to create workarounds but hope that future versions will take a cue from jQTouch and build out this functionality a little more.

jQuery Mobile’s documentation is a little scattered but improving; I’m hopeful that it will become as robust as that of the core jQuery library. (Note that jQuery Mobile is really a mobile counterpart for jQuery UInot for jQuery itself, on which it builds.)

jQuery Mobile is available under either the MIT or the GPL2 license.

SENCHA TOUCH

Sencha Touch is the mobile counterpart to the Ext JS framework. Its approach differs significantly from jQTouch and jQuery Mobile: instead of enhancing preexisting HTML, it generates its own DOM based on objects created in JavaScript. As such, working with Sencha feels a little less “webby” and a little more like building apps in other technologies like Java or Flex. (It’s also a bit more like YUI than like jQuery.) I personally prefer the progressive enhancement approach, but it really is a matter of preference.

Sencha is far more extensive than its competitors, with a vast array of UI components, explicit iPad support, storage and data binding facilities using JSON and HTML5 offline storage, and more. (It’s very cool to manipulate app data in one of Sencha’s data structures and watch the corresponding list update in real time.) It’s also the only Web framework I’ve seen with built-in support for objects that stay put (like a toolbar) while others scroll (like a list).

For all that apparent extra weight, Sencha performed noticeably better and more reliably than either jQTouch or jQuery Mobile in my tests, with the exception of initial load time.

When working with a library or framework, it’s usually counterproductive to “fight the framework” and do things your own way. Given how extensive Sencha Touch is, that means your app will probably end up doing just about everything the Sencha way. I’d originally used WebKit’s built-in SQLite database for offline storage but ultimately eliminated both complexity and bugs by moving that functionality into Sencha’s data stores.

The documentation, while extensive, has odd holes. Between those and the sheer size of the framework, I spent a lot of time fighting bugs that were difficult to trace and to understand. Responses to my questions in the developer forums were more frequent and helpful than with the other frameworks, but still ultimately insufficient. Sencha provides paid support starting at $300/year; I strongly considered purchasing it but oddly, their response to my sales support inquiries was incredibly underwhelming given my interest in sending them money.

Sencha Touch is available under the GPL3; under a somewhat confusing set of exceptions to the GPL that seem similar to the LGPL; or under a free commercial license.

TITANIUM MOBILE

Much like Sencha Touch, Appcelerator’s Titanium Mobile allows you to write apps using a JavaScript API. But unlike Sencha, it compiles most of your code into a native iPhone or Android app. That means it isn’t really a Web framework, but a compatibility layer or compiler. (Note that its cousin Titanium Desktop is Web-based, allowing you to write HTML/JS applications that run inside a native wrapper on the desktop.)

So Titanium allows Web developers to produce high-performance, easily skinnable native apps using JavaScript and a little XML, i.e. without learning Objective-C or Cocoa Touch. My simple test app blew away the true Web frameworks in terms of performance, and wasn’t much harder to put together.

But that advantage is also its greatest disadvantage: you can only target the platforms Titanium supports, and you’re tied to their developer tools. As if to prove this point, my test app quickly got into a state where it wouldn’t launch on the iPhone. Titanium doesn’t include much of a debugger; Titanium projects can’t be run and debugged in XCode; and it ran fine in the simulator, leaving me with no real way to attack the problem.

ANALYSIS

Rebuilding my app on three of these four frameworks was tedious but educational. I like jQTouch but have trouble believing it will evolve much from here. I’m rooting for jQuery Mobile for its simplicity and its very Web-centric approach to development…but it lacks a few key features and doesn’t perform as well as Sencha Touch.

It’s unfair to compare an Alpha 2 product with a 1.0 one, except in one respect: I need something now. Which brings me to Sencha Touch. I was initially impressed with its performance and breadth, but put off by its development style. As I’ve dug in, the holes in its documentation have been frustrating but the breadth has continued to impress me, and I’ve gotten more used to the coding style. The option for paid support is tempting, and I’d probably buy it if they’d answer my emails. But for now, Pints is a Sencha-based app.

CONCLUSION

I haven’t answered the big question: can a Web-based app really hold its own alongside native apps? And if so, are the challenges of getting it there worth the benefit of a single codebase?

Two weeks ago I was leaning toward no. Pints was in performance and bug hell, hanging for 10-15 seconds at a time; scrolling was choppy; and other animations were inconsistent.

But I’m hopeful again. In my next post I’ll discuss why, what I’ve learned, and my perspective on mobile Web apps today. I’ll also cover PhoneGap and other methods of distributing a Web app in a native wrapper. Stay tuned.

分享到:
评论

相关推荐

    Comparing Java Web Frameworks.pdf

    ### Java Web框架对比分析 #### 引言 随着互联网技术的发展与成熟,Java Web开发框架在软件工程领域扮演着越来越重要的角色。不同的框架各有特点,适用于不同类型的项目需求。本文档将详细介绍并对比六种主流Java ...

    Comparing the Struts 1 and Struts 2 Web Application Frameworks

    文章“Comparing the Struts 1 and Struts 2 Web Application Frameworks”可能详细分析了这两个框架的各个方面,包括但不限于配置方式、开发效率、错误处理、性能测试等。通过阅读文档,开发者可以获取更多实用的...

    HTML5 GAMES Creating Fun with HTML5 CSS3 and WebGL 英文PDF

    ##### Chapter 5: Delegating Tasks to Web Workers This chapter introduces the concept of using Web Workers to offload computational tasks and improve the game’s performance. Key topics include: - **...

    Comparing Web Frameworks; Struts, Spring MVC, WebWork, Tapestry & JSF.pdf

    此软件介绍webwork and struts and jsf的区别

    Introduction to 3G Mobile Communications

    I n t r o d u c t i o n t o 3 G M o b i l e C o m m u n i c a t i o n s vi CONTENTS 5 Spreading Codes 111 5.1 Orthogonal Codes 112 5.2 PN Codes 114 5.3 Synchronization Codes 117 5.4 Autocorrelation ...

    Analyzing and Comparing Montgomery Multiplication Algorithms

    “Analyzing and Comparing Montgomery Multiplication Algorithms”(分析与比较蒙哥马利模乘算法)这篇文章旨在深入探讨并对比不同的蒙哥马利模乘算法实现方法。蒙哥马利模乘算法是一种在计算机科学中广泛应用的...

    Attention Flows:Analyzing and Comparing Attention Mechanisms in Language Models

    本文《Attention Flows:Analyzing and Comparing Attention Mechanisms in Language Models》是一篇研究论文,主要关注于深度学习领域内语言模型的注意力机制。随着自然语言处理(NLP)技术的发展,基于注意力机制...

    comparing-front-end-frameworks

    每节课包含一个或多个 Node.js + Express 服务器,以及一个前端 Web 应用程序,准备运行和试验。 要运行特定课程的代码,首先打开该文件夹并运行bower install && npm install以下载所有前端和后端依赖项。 然后...

    PHP.Arrays.in.PHP.7

    Chapter 5: PHP Functions—Changing, Splitting, Slicing, and Sorting Arrays Chapter 6: PHP Functions—Comparing and Merging Arrays Chapter 7: PHP Functions—Searching, Traversing, and Displaying Arrays

    comparing_geometric_paths:比较几何路径相似度的方法

    "comparing_geometric_paths"这个项目专注于研究如何有效地衡量两条路径之间的相似度,特别是在使用离散Frechet距离这一概念时。离散Frechet距离是评估两个曲线之间最短的连续路径长度,使得一条路径上的点可以沿着...

    Hadoop-comparing-two-text-files:所有关于 Hadoop

    本项目“Hadoop-comparing-two-text-files”聚焦于使用Hadoop MapReduce来比较两个文本文件,这对于数据比对、日志分析、数据一致性验证等场景非常有用。Hadoop基于Java编程语言实现,因此在编写MapReduce程序时,...

    jQuery分页插件(jPages)

    jPages is a client-side pagination plugin but it gives you a lot more features comparing to most of the other plugins for this purpose, such as auto page turn, key and scroll browse, showing items ...

    Mobile Radio Channels Modeling in MATLAB

    This document contains ...comparing an approximated Rayleigh PDF with the cor-responding analytical PDF correlated Rayleigh-distributed fading samples generation in MAT-LAB. Monte Carlo Simulation

    JS文本差分Jsdiff.zip

    安装:npm install diff或者bower install jsdiffAPIJsDiff.diffChars(oldStr, newStr[, options]) - diffs two blocks of text, comparing character by character.Returns a list of change objects (See ...

    Java-Image-Comparing-with-OpenCV:用JAVA编写的基于OpenCV图像比较程序

    5. **图像匹配**:在特征提取之后,使用匹配算法(如BFMatcher或FLANN)将一个图像的特征与另一个图像的特征进行配对。匹配得分可以衡量两幅图像的相似度。 6. **汉明距离与欧氏距离**:在比较图像时,可能会使用到...

    JQuery的启发-教你如何二次处理及优化IBatis和Hibernate的查询结果集

    本文将深入探讨JQuery的启发,以及如何利用这些思想来优化对这两个框架的查询结果集进行二次处理。 首先,让我们了解JQuery的基本理念。JQuery是一个强大的JavaScript库,它提供了简洁的API来操作DOM(文档对象模型...

    comparing java objects_hashcode_Comparing_

    下面将详细阐述哈希码(hashCode)和比较(Comparing)在Java中的作用以及它们在对象比较中的应用。 首先,哈希码是一个整数值,由对象的内部状态计算得出,通常用于快速查找。`hashCode()`方法是每个Java对象的...

Global site tag (gtag.js) - Google Analytics