Ruby agile development_of_game_operation_platform
-
Upload
topgeek -
Category
Technology
-
view
3.195 -
download
2
description
Transcript of Ruby agile development_of_game_operation_platform
![Page 1: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/1.jpg)
上海 TopGeek 沙龙
Ruby敏捷开发实践
– 网游运营平台开发心得
![Page 2: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/2.jpg)
自我介绍
6年的 Java程序员, 3年的 Ruby程序员
目前在 bihannet.com负责网游运营平台的开发
![Page 3: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/3.jpg)
Ruby的发展
90后 松本行弘 "Matz" (Matsumoto Yukihiro)
2000 Programming Ruby
2005 Ruby on Rails
2010 敏捷,高效,享受编程的快乐
![Page 4: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/4.jpg)
Ruby的优势
Matz:
Ruby is designed for
programmer
productivity and
fun
![Page 5: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/5.jpg)
例子 1
3的绝对值是什么?public class MathExample { public static void main(String[] args) { System.out.println(Math.abs(-3)); }}
javac MatchExample.javajava MatchExample
![Page 6: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/6.jpg)
例子 1
脚本语言面向对象简洁
ruby -e "p -3.abs"
![Page 7: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/7.jpg)
例子 2
"The quick brown fox jumps over the lazy dog".downcase.split("").uniq.sort.join.strip
=> "abcdefghijklmnopqrstuvwxyz"
内建功能丰富函数式编程风格
![Page 8: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/8.jpg)
例子 3
User.find_all_by_dob_month(Time.now.month).each do |user| user.increment!(:score, 100)end
给本月过生日的所有用户每人加 100积分
贴近自然语言,非常直观
![Page 9: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/9.jpg)
Ruby的劣势?
Ruby很慢
Ruby程序员很少
Ruby第三方的库太少
![Page 10: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/10.jpg)
Ruby很慢 ?
http://shootout.alioth.debian.org/
和 c 比 慢 4~800倍
和 java 比 慢 0~400倍
和 python 比 慢 0~9倍
Ruby是很慢
可是大部分的应用不是单纯数值计算和文字处理
![Page 11: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/11.jpg)
Ruby 程序员很少 ?
51job搜搜看
50 Ruby v.s 1,000,000 Java
小团队 v.s 大团队
JavaEye: 1.5 Ruby developer
Bihannet: 3 Ruby developer
从 Python / Java程序员转行培养
![Page 12: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/12.jpg)
Ruby第三方的库太少?
rubygems.org从文字处理到消息中间件,从小插件到 Allinon框架
github.com给力的,有趣的,开源代码集中地
贡献开源
![Page 13: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/13.jpg)
网游运营平台介绍
常见的网游运营平台功能包括 : – 官网 CMS
账号,充值 安全和高可靠性 论坛,社区 可扩展性
![Page 14: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/14.jpg)
CMS
http://radiantcms.org/ 适合小团队用,或者中小型企业展示站点
http://webiva.org/功能丰富,日常维护比较方便
为什么一定要选择基于 Ruby的 CMS?我们陷入了一个误区
![Page 15: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/15.jpg)
CMS
Ruby很慢?有Memcached,很快还嫌不够快?我们可以静态化
Page.find_all_by_status("published").each do |p| `wget -O "#{dir}#{page.node_path}/#{page.permalink}.html" "#{domain.name}#{page.node_path}/#{page.permalink}"`
end
![Page 16: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/16.jpg)
账号,认证,权限
丰富而且成熟的插件restful_authenticationdeviseauthlogicopen_id_authenticationomniauth......
3小时搞定
![Page 17: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/17.jpg)
充值
“充值这样 Mission Critical”的事情用 Ruby可靠么?
Ruby Message Queue?
基于 Java的 ActiveMQ
基于 ErLang的 RabbitMQruby amqp client
![Page 18: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/18.jpg)
充值
支付网关接口插件activemerchant
国内大部分的支付网关都没有 Ruby库,贡献开源:
http://github.com/flyerhzm/activemerchant_patch_for_china
大部分都是实现一个参数签名 (md5)
![Page 19: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/19.jpg)
论坛
为什么要自己用 Ruby on Rails开发论坛?有丰富的插件支持方便以后的集成和定制搭积木, 2天搭好一个论坛
![Page 20: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/20.jpg)
ROR提供了最佳实践
image_tag(“index.jpg”)=> <img src=”/images/index.jpg?1271919288”/>
config.action_controller.asset_host = "cdn.com"=> src=”http://cdn.com/images/index.jpg?1271919288”
自动添加 timestamp,利用 http cache
修改一下配置, CDN自动生效
![Page 21: Ruby agile development_of_game_operation_platform](https://reader034.fdocuments.net/reader034/viewer/2022051611/54b79ea04a795997768b45af/html5/thumbnails/21.jpg)
Ruby开发游戏
Flash做前端
Ruby做后端
AMF协议做通讯rubyamfrocketamf