Copyright 2009 © IBM Corporation projectzero.org Simplified Web 2.0 application development with Project Zero 朱朱 朱朱朱朱朱 IBM 朱朱朱朱朱朱朱朱朱朱朱朱 Web 2.0
Nov 02, 2014
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Simplified Web 2.0 application development with Project Zero
朱可软件工程师IBM 中国开发实验室新技术中心 Web 2.0
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Outline
• Web 2.0 application requirements?
• Programming language landscape
• Options? Project Zero
• Get started
• Demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Show of Hands
• Are you using Ruby, PHP, Python, Groovy?
• How many are using Struts/Spring/Hibernate?
• What do you want from this session?– Know technical trends– To be a developer– Project zero is a cool name– Credit
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Outline
• Web 2.0 application requirements?• Programming language landscape• Options? Project Zero• Get started• Demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
So Many
Web 2.0
Applications
http://flickr.com/photos/stabilo-boss/101793494/http://flickr.com/photos/stabilo-boss/101793494/
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Take One Pretty Example
电子邮件收件箱电子邮件收件箱
日历日历
相册照片相册照片
Twitter 工具Twitter 工具
天气预报天气预报搜索服务搜索服务http://netvibes.com/shawnzhuhttp://netvibes.com/shawnzhu
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Open Standards
http://www.w3.org/2004/10/RecsFigure.pnghttp://www.w3.org/2004/10/RecsFigure.png
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
The Cake is divided in a mashup way
Your Database
Your Application Your Application
Your Database
Your API
App App App
Your Application
Your Database
Your API
App App App
3rd-party API
3rd-party API
directaccessdirect
access
indirectaccessindirectaccess
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
General Requirements
• More user participation
• Distributed data and service
• Complex application logic
• Highly customization
• Many 3rd-party sources
• Low latency
• Multiple clients
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Trends
中心化中心化
月、周月、周
请求、响应请求、响应
产品产品
发布者进行发布发布者进行发布
““占地盘”占地盘”
统一模式或分类统一模式或分类
竞争竞争
信息发布者信息发布者
Web 1.0 Web 1.0 Web 2.0 Web 2.0 ??价值来源
反馈循环周期
交互模型
核心战略资产
数据生成方式
有效的增长方式
数据结构
资源分配方式
最重要的数据来源
价值来源
反馈循环周期
交互模型
核心战略资产
数据生成方式
有效的增长方式
数据结构
资源分配方式
最重要的数据来源
去中心化
天、分钟
Rich user experience
难以复制的数据
用户可以贡献内容
网络效应
大众分类
用户参与
大规模人群
去中心化去中心化
天、分钟天、分钟
自发、自治自发、自治
数据生态系统数据生态系统
数据本身的语义数据本身的语义
““新陈代谢”新陈代谢”
隐含的元数据隐含的元数据
开放供应链开放供应链
环境环境
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Common Themes In Web2.0
• Massive amounts data
• Rich user experience
• Application is growing
• Time to value
• Flexibility
• Security
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Outline
• Web 2.0 application requirements?
• Programming language landscape• Options? Project Zero• Get started• Demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Popular Web 2.0 Technology
MashupsREST A lightweight web application that
combines data from more than one source into an integrated and new, useful experience
An architectural style that is best exemplified by HTTP
REST embodies the principles of a service-oriented architecture using the web as the SOA platform
Feeds A data format used to exchange
frequently updated web content
XML data streams in formats such as RSS and Atom
Ajax Asynchronous JavaScript and XML -
Ajax, is a group of inter-related web development techniques used for creating interactive web applications
Dynamic Scripting Dynamic languages are flexible and easy
to learn Adoption is growing as developers focus
more on Internet-centric applications
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Browser-side Programming Is Hard
• Fighting for complexity– HTML: structure data– CSS: presentation– JavaScript/Ajax: logic and interaction– Server Integration
• Multiple browser– Internet Explorer– Firefox, Safari, Opera, etc
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
How? Read Books
http://covers.oreilly.com/images/9780596527327/cat.gifhttp://covers.oreilly.com/images/9780596527327/cat.gif http://covers.oreilly.com/images/9780596101992/cat.gifhttp://covers.oreilly.com/images/9780596101992/cat.gif
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Which programming languages works with AJAX?
source: ajaxian.com survey “State of the Web 2008” (January 9th, 2009) http://ajaxian.com/archives/state-of-the-web-2008source: ajaxian.com survey “State of the Web 2008” (January 9th, 2009) http://ajaxian.com/archives/state-of-the-web-2008
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Scripting languages and Frameworks
• Millions of PHP developers• Popular web languages like Python and Ruby ar
e agile and dynamic languages• Developers like the popular frameworks like Rub
y on Rails, Grails, Django– “That’s what I expected exactly!”– Rapid development
• Easy to learn (according to learning Java or C#)
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
New Approaches in Java Technology
Source: Best of Breed vs. Best of Brand: The Battle of the Application Platform Stacks, Yefim Natis, Gartner, APN19_137, 12/07, AE
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Groovy
• Groovy is an agile and dynamic language for the Java Virtual Machine
• Builds upon the strengths of Java but has additional power features inspired by languages like Python and Ruby
• Compiles straight to Java byte code so you can use it anywhere you can use Java
def number=0// list a file with line numbersnew File ('test.groovy').eachLine { line ->
number++println "$number: $line"
}
def number=0// list a file with line numbersnew File ('test.groovy').eachLine { line ->
number++println "$number: $line"
}
http://www.manning.com/koenig/koenig_cover150.jpghttp://www.manning.com/koenig/koenig_cover150.jpg
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Outline
• Web 2.0 application requirements?• Programming language landscape
• Options?
• Get started• Demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
What is Project Zero?
• A development community delivering the best of agile Web 2.0
• Delivered WebSphere sMash – PHP scripting, REST and Dojo in ONE
integrated runtime and tooling package
http://dojofoundation.org/media/img/dojo.logo.pnghttp://dojofoundation.org/media/img/dojo.logo.png
JavaScript toolkit
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
WebSphere sMash Core Values
速度
敏捷
简洁
• Dynamic Scripting Support• Integrated runtime • Pre-built services
• Consistent application approach• End to end web-based tooling• Visual & programmatic editors
• Convention over configuration• Application is server• Rich User Interfaces Support
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Lower Skill Required than Java EE
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
a dynamic scripting platform
• Create Application Logic in one of two scripting languages– Groovy (for people that prefer Java)– PHP (for the 3 Million existing PHP programmers)
• Java is positioned as the “system” language– implement system extensions and application libraries– You can use Java (if desired)
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
PHP Support
• PHP runtime built in Java– To PHP.net as JRuby is to Ruby and Jython is
to Python• Powerful blending of PHP and Java code
– Java and PHP code run in the same process on the same Thread
• No need for Inter-process communication
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Optimized for REST
• Effortless creation of RESTful services and data feeds (RSS, Atom)
script as a resource– http://<host>:<port>/Employee.php
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
RESTfully Expose DataEnable Developers With A Simple Programmatic And HTTP Data API
Access REST resource through AJAX
RDBMS
/app/resources/ employees.groovy
/app/models/ employees.json
ZRM.delegate()
Model application data• Constrained set of APIs encourage a RESTful application
architecture• Data model that maps well into Atom feeds and JSON
formats• Robust framework for persistence, validation, and
serializationAccess resource data with Dojo
WebSphere sMash application
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Platform Overview
• Application-centric runtime– No “container”– Instant on– Clean (short-live process)– Cheap (small footprint)
• A full stack runtime for Web– Built-in everything you need– Modular architecture
• You just need a JVM– Java SE 5 or 6
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Security Offerings
• System-level authentication and authorization• OpenID consumer• Protection against Cross-Site Request Forgery
(CSRF) attacks• User service• Security token • Extensibility
@include "security/basicAuthentication.config" {"conditions": "/request/path =~ /customers(/.*)?"
}
@include "security/basicAuthentication.config" {"conditions": "/request/path =~ /customers(/.*)?"
}
You don’t have to understand how this piece of configuration works, just need to know how simple it enables basic authentication on
specific URI pattern
You don’t have to understand how this piece of configuration works, just need to know how simple it enables basic authentication on
specific URI pattern
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Built-in Development Tooling – App Builder
• Web-based IDE– lets developers build application directly on the Web
• Built as a sMash application• Provides full development lifecycle f
or sMash applications– Create, run, test, debug– Manage dependencies
• Provides visual/source editors– page– forms– scripts– iWidgets– activities
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Social Capacity
• Application life cycle management– Command Line– REST API– Administration tool
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Platform capabilityPro jec t.Zero / W ebSphere.sMash
scope
Pro jec t.ZeroW ebSphere.sMash
core
OpenIDprovider
Dojowidget
Adobe Flex (dem o)
Groovy P HP
Active ContentFiltering
Cross S ite Reques t Forgery protec tion
Google gadget (dem o)
Djinngowidget (dem o)
SOAP
Apache Derby 10.3
IB MDB2
Orac le 10g
M ySQLv5
LDAP
Data to RESTfull
IB M TivoliAccess M anager
Other S ingle S ign-On tools
Java Ruby(demo)
M S SQL Server 2005
Inform ixv10-11
W 3C iW idgetOpenA jaxHub 1.1
OpenIDc lient
A tom& RSS
A ssemble
JM S
SM TP(outbound m ail)
S -FTP(FTP over SSH)
POP3 k icker
Direc tory M onitoring(file k icker)
Trus t Assoc iation Interceptor
POP3 account
File trans fer tool (ex : CFT or FTP)
FTP
Database Connec tor
Connec tionex tens ions
M ic rosoft Excel
E clipse P lug in
W eb D eve lopm ent E nvironment
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
What you can do in projectzero.org
Anonymous Visitors can…
Registered Users can…
Focused on easy access
Focused on feedback
Browse the siteView Wiki contentRead ForumsSearch the Bug DatabaseRead BlogsDownload Binary Drivers*
Post to the ForumSubmit Bug ReportsSubmit Feature RequestsComment on Blog PostsAccess Source Code*
* Requires acceptance of an IBM license agreement
Simple, free registration process
Internet web site Free access to
the platform
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
How dare you say “Simplified”?
• Convention over configuration• Loosely coupled by design
– Enables componentization and extensive code reuse
• Application-centric runtime– No need for a separate application server
• Browser based tooling for both client and server-side programming
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Outline
• Web 2.0 application requirements?• Programming language landscape• Options? Project Zero
• Get started• Demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
先决条件
• 操作系统– Windows®, Linux®, or Mac
• 32-bit Java SE Development Kit (JDK) 5.0 or 6.0
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
下载开发者版本• 包括 WebSphere sMash 1.1 和 AppBuilder
敢于尝鲜的极客们,可以试试下载源代码构建完整产品 参考 : 在Mac机上搭建Projectzero的Build
环境
敢于尝鲜的极客们,可以试试下载源代码构建完整产品 参考 : 在Mac机上搭建Projectzero的Build
环境
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
安装
• 保存下载文件(约 2.2MB )• 解压缩到本地文件系统(如 C:\zero )• 将名为“ zero” 的文件夹加入用户的环境
变量 PATH 中
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
确认安装是否成功
打开命令行窗口,输入 zero version
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
提供多种工具
• Command-line Interface ( 命令行界面 )
• App Builder
• Plug-ins for Eclipse在命令行下输入 appbuilder open 打开 AppBuilder
(首次使用请耐心等待 sMash 从网络获取相关模块)
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Best Practices using Project Zero
• 从演示程序开始– 4 tutorials, 5 samples and 4 demos
• developerWorks 里的 sMash 专区• 在论坛里提问或求助(中英文皆可)• 订阅 Project Zero 社区博客
– 中文博客在这里
• Follow twitter: http://twitter.com/projectzero
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Outline
• Web 2.0 application requirements?• Programming language landscape• Options? Project Zero• Get started
• Demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
• 15 分钟构建数据库驱动的 Web2.0 应用程序– Database backend– REST API– Dojo based rich user experience
简单联系人管理
点击这里查看视频录像
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
Session Summary
• Understand Web 2.0 application via requirement analysis
• Look at programming language landscape to know modern weapons in web developers’ hands
• Know what IBM does for web 2.0 application development
• How to go through projectzero from beginning • A cool demo
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
The End
• Thanks
• Questions?
Copyright 2009 © IBM Corporation
projectzero.orgprojectzero.org
© IBM Corporation 2009. All Rights Reserved.The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided forinformational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. Whileefforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other materials. Nothing contained in this presentation is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates.Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput orperformance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that anindividual user will achieve results similar to those stated here.All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved.Actual environmental costs and performance characteristics may vary by customer.The following are trademarks of the International Business Machines Corporation in the United States and/or other countries:ibm.com/legal/copytrade.shtml AIX, CICS, CICSPlex, DataPower, DB2, DB2 Universal Database, i5/OS, IBM, the IBM logo, IMS/ESA, Power Systems, Lotus, OMEGAMON, OS/390, Parallel Sysplex, pureXML, Rational, Redbooks, Sametime, SMART SOA, System z , Tivoli, WebSphere, and z/OS.A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at ibm.com/legal/copytrade.shtml.Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other countries.IT Infrastructure Library is a registered trademark of the Central Computer and Telecommunications Agency which is now part of the Office of Government CommerceJava and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.ITIL is a registered trademark, and a registered community trademark of the Office of Government Commerce, and is registered in the U.S. Patent and Trademark OfficeIntel and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.UNIX is a registered trademark of The Open Group in the United States and other countries.Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
© IBM Corporation 2009. All Rights Reserved.The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided forinformational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. Whileefforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other materials. Nothing contained in this presentation is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates.Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput orperformance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that anindividual user will achieve results similar to those stated here.All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved.Actual environmental costs and performance characteristics may vary by customer.The following are trademarks of the International Business Machines Corporation in the United States and/or other countries:ibm.com/legal/copytrade.shtml AIX, CICS, CICSPlex, DataPower, DB2, DB2 Universal Database, i5/OS, IBM, the IBM logo, IMS/ESA, Power Systems, Lotus, OMEGAMON, OS/390, Parallel Sysplex, pureXML, Rational, Redbooks, Sametime, SMART SOA, System z , Tivoli, WebSphere, and z/OS.A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at ibm.com/legal/copytrade.shtml.Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other countries.IT Infrastructure Library is a registered trademark of the Central Computer and Telecommunications Agency which is now part of the Office of Government CommerceJava and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.ITIL is a registered trademark, and a registered community trademark of the Office of Government Commerce, and is registered in the U.S. Patent and Trademark OfficeIntel and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.UNIX is a registered trademark of The Open Group in the United States and other countries.Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.