Ruby agile development_of_game_operation_platform

22
 上海 TopGeek 沙龙 Ruby 敏捷开发实践 网游运营平台开发心得

description

随着Ruby on Rails的流行,Ruby正在Web开发领域体现出它独特的魅力,和其他语言相比选择Ruby有什么优势?Ruby的运行效率高吗?Ruby能用来做网游充值这样“Mission Critical”的事情吗?Ruby能用来开发游戏吗?Ruby程序员难找吗?本主题将会和大家分享在网游运营平台开发的一些心得。

Transcript of Ruby agile development_of_game_operation_platform

Page 1: Ruby agile development_of_game_operation_platform

   

上海 TopGeek 沙龙

Ruby敏捷开发实践

– 网游运营平台开发心得

Page 2: Ruby agile development_of_game_operation_platform

   

自我介绍

6年的 Java程序员, 3年的 Ruby程序员

目前在 bihannet.com负责网游运营平台的开发

Page 3: Ruby agile development_of_game_operation_platform

   

Ruby的发展

90后 ­ 松本行弘 "Matz" (Matsumoto Yukihiro) 

2000 ­ Programming Ruby 

2005 ­ Ruby on Rails

2010 ­敏捷,高效,享受编程的快乐

Page 4: Ruby agile development_of_game_operation_platform

   

Ruby的优势

Matz:

Ruby is designed for 

programmer 

productivity and 

fun

Page 5: Ruby agile development_of_game_operation_platform

   

例子 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

   

例子 1

脚本语言面向对象简洁

ruby -e "p -3.abs"

Page 7: Ruby agile development_of_game_operation_platform

   

例子 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

   

例子 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

   

Ruby的劣势?

Ruby很慢

Ruby程序员很少

Ruby第三方的库太少

Page 10: Ruby agile development_of_game_operation_platform

   

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

   

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

   

Ruby第三方的库太少?

rubygems.org从文字处理到消息中间件,从小插件到 All­in­on框架

github.com给力的,有趣的,开源代码集中地

贡献开源

Page 13: Ruby agile development_of_game_operation_platform

   

网游运营平台介绍

常见的网游运营平台功能包括 :  – 官网 CMS

账号,充值 ­ 安全和高可靠性 论坛,社区 ­ 可扩展性

Page 14: Ruby agile development_of_game_operation_platform

   

CMS

http://radiantcms.org/ 适合小团队用,或者中小型企业展示站点

http://webiva.org/功能丰富,日常维护比较方便

为什么一定要选择基于 Ruby的 CMS?我们陷入了一个误区

Page 15: Ruby agile development_of_game_operation_platform

   

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

   

账号,认证,权限

丰富而且成熟的插件restful_authenticationdeviseauthlogicopen_id_authenticationomniauth......

3小时搞定

Page 17: Ruby agile development_of_game_operation_platform

   

充值

“充值这样 Mission Critical”的事情用 Ruby可靠么?

  Ruby Message Queue?

基于 Java的 ActiveMQ

基于 ErLang的 RabbitMQruby amqp client

Page 18: Ruby agile development_of_game_operation_platform

   

充值

支付网关接口插件activemerchant

国内大部分的支付网关都没有 Ruby库,贡献开源:

http://github.com/flyerhzm/activemerchant_patch_for_china

大部分都是实现一个参数签名 (md5)

Page 19: Ruby agile development_of_game_operation_platform

   

论坛

为什么要自己用 Ruby on Rails开发论坛?有丰富的插件支持方便以后的集成和定制搭积木, 2天搭好一个论坛

Page 20: Ruby agile development_of_game_operation_platform

   

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

   

Ruby开发游戏

Flash做前端

Ruby做后端

AMF协议做通讯rubyamfrocketamf

Page 22: Ruby agile development_of_game_operation_platform

   

Thank You

Twitter: quakewang

Blog: http://quake.javaeye.com

Email: [email protected]