2. Agenda
• Why Rails fits the Enterprise needs • 为何Rails是企业的良好选择
• Rails Toolchain and Gems in Windows • Windows下的Rails工具箱和Gems
• Typical Enterprise App – pl-form • 典型企业应用 – 电子表单
• Scaffold custom • 脚手架的定制
• Reporting in Excel • 导出Excel报告
• Interoperation • 与现有系统的互操作性
• Deploy in Ubuntu and migrate to Linux • 部署到Ubuntu,逐步转移到Linux
3. Enterprise vs Internet application – Same facts
Community
Trends
Development Speed
Operation
Inter-operation
4. Enterprise vs Internet application - Difference
• No special performance req • Scalability
• Complex biz model rule • Relative easy rule
• Focus on IE or Firefox only • Cross-browser
• Open half function for current • Close-loop function with full
function automation
6. Before Rails, I already learned…
ASP.NET
Silverlight
Hibernate 3
Entity Framework
Telerik OpenAccess
WCF – Windows Communication
Foundation
PowerShell I’m still a good citizen in Microsoft empire,
but Web is future!
7. Three thing drive me switch to Rails
•ASP.NET MVC 3 vs Rails
•Cloud Foundry China Open
Tour 2012, Mark Lucovsky
•The Hackathon in May 2012,
Shanghai, 60% developer
choose Rails
8. Rails adv and disadvantage in Enterprise View
• High density function/code ratio • Not as popular as Java and .NET
• Full Stack Web Framework • Inter-operation
• ORM, DB Migrate, Ajax, MVC model, template, Testing
• Learning Gap
framework, Caching, i18n.
• Essential in HTML/CSS/JavaScript vs ASP.NET
• Function organized very well, Totally integrated.
• Command line vs Click GUI
• Good design pattern from .NET, Java, PHP, Perl
• Toolchain problem in Windows
community, but no compatibility issue/debt in design
• Dynamic type vs Static type
• Open source • GFW (in china only)
9. Why Rails code have high density
Rails Code
self.part_request.part_request_details.each do |d|
status = 'Partial' if d.status != self.status
End self.part_request.save
SQL Code (C# ADO.NET code not include yet…)
• SELECT p.status INTO &PartRequestStatus FROM part_requests p
WHERE p.id=&PartRequestID;
• SELECT d.status FROM part_request_details d
WHERE d.part_request_id = &PartRequestID;
• UPDATE part_request_details d SET d.status='Partial'
WHERE d.part_request_id = &PartRequestID;
AND d.status <> &PartRequestStatus;
• COMMIT;
10. After ADO.NET code mixed with SQL…
It’s just one SQL statement, to get qty like previous SQL:
SELECT p.status INTO &PartRequestStatus FROM
part_requests p
11. Some NOT correct fact about Rails
Windows is not friendly for Rails
Windows is the easiest setup rails development platform if no issue happen.
No source for ruby-1.9.3-p327 provided with debugger-ruby_core_source gem
Rails is magic and complex web framework
Complex at beginning but flat learning curve after.
VIM, Git, Python, Linux, is pre-request
Focus the REAL value thing, “Getting Real”
Mac is best environment for Rails
Double cost hardware, no IE, Mountain Lion, Java story
12. Java and Apple
Java, Built In Java Deprecation
• “Write once, run anywhere” is true only if Java is • As of the release of Java for OS X v10.6 Update 3,
everywhere. With OS X, you know the Java Runtime the Java runtime ported by Apple and that ships with
is there for your applications, because it is built into OS X is deprecated. Developers should not rely on
the operating system. This means that when the Apple-supplied Java runtime being present in
developing Java applications for deployment on OS
X, you know that Java is already installed and future versions of OS X.
configured to work with your customer’s Mac. • Apple deprecated Java and announced that
applications using deprecated technologies such as
• Java is the only high-level framework on OS X Java won't be allowed in its official Mac Apps Store.
besides Cocoa that provides a graphical toolkit for • Apple never promised the world to do no evil, but ...
building applications. Oh well. It's clearly no angel.
• http://www.theregister.co.uk/2010/10/21/apple_threa
https://developer.apple.com/library/mac/#documentatio tens_to_kill_java_on_the_mac/
n/Java/Conceptual/Java14Development/01-
JavaOverview/JavaOverview.html
Mac OS X 10.6 Snow Leopard
RubyMotion won’t success on iOS development.
Web is the only correct way to development app.
14. Issue will also happen in Ubuntu with RVM
Stranger will not be friendly,
same thing if out of
recognition/knowledge in Ruby
on Rails
Try below if you using 1.9.3-
p327:
•gem install pry-debugger
•pry
16. Rails in Windows - Installation
• http://rubyinstaller.org/ • Install Rubymine and Click Debug to install relative debug
• DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe gems
• https://github.com/oneclick/rubyinstaller/wiki/Development- • gem upgrade –system
Kit • gem upgrade
• C:git>cd devkit • gem install pry-debugger
• C:DevKit>ruby dk.rb init • gem install bundle
• C:DevKit>ruby dk.rb install --force • gem install ruby-oci8
• ansicon - Process ANSI escape sequences for Windows • cd pl-form
console programs. • bundle install
17. Rails in Windows - Toolchain
• ActivePython 2.7 Req by Gems like pygments in Octopress
• Node.JS 0.8 or higher Req by Gems like ExecJS
• Sublime Text Many plugin available for Rails
• Git Git Extensions works great in Windows
• Firefox Extension: SQLite, RESTClient with low memory
• SSD The typical bottleneck for rails eliminated
18. Rails in Windows - Gems
Some gems can NOT run in
windows: therubyracer (replace
with execjs)
gem install eventmachine –pre
gem install thin
more on:
http://ruby-china.org/wiki/win32-
gem
19. Enterprise App PaperLess form semi-generate
- pl-form template application
20. The PaperLess-Forms Application
Eliminate all existing paper
based forms in Enterprise
• Not only save paper and cost,
but by human power
• Search quickly in form directly.
• HTML5 for anydevice and
RESTful API for integration
21. User define forms instead of developer
A easy text format DSL
(Domain-Specific
Language)
• Header-Detail forms
supported
• Pre-defined Items and
Specs supported
22. User define forms in Text
Apply in Enterprise only
• Training better than
dummy design
• Text is better than GUI
• Code is better than
Configuration
• There is no advanced
user, only developer
23. PL-Forms features for Developer
• PL-Forms will generate forms web page • Filled form data is in database table,
and underline support program based on header, detail has two different table,
user define forms form field mapping to table column,
• Restful API available for every forms make writing SQL query easy
after form generate • All source code and change history
available
24. PL-Forms more detail feature
• Typeahead auto complete • input/update/delete action will be
• Item and Spec as detail field record now, not only including last
description one, all in history
• Recent form quick list
• Define status code per each forms
(optional)
32. Where is ‘hook_for’ lives?
http://rubydoc.info/gems/railties/Rails/Generators/Base.hook_for
33. Where are we, do we lost?
Read the Rails Guide! Author: Eric Guo
<eric.guo@sandisk.com>#mailto:eric.guo@sandisk.com
Author date: 5 months ago (Tue May 29 23:40:35 2012)
And Stack Overflow… Commit date: 5 months ago (Thu May 31 16:01:54 2012)
Commit hash:
864bc83859acbf07493b7cd39a134927c2925e2e
And Rails Casts……
Introduce generate style programming for model and forms
Review and change scaffold template
Contained in branches: master, rc8
Contained in tags: oracle_production_run_here, oracle_run_here
41. Excel can open many format
UTF8 CSV
UTF16 CSV Rails can generate all of them
2003 XLS
2007 XLSX But correct only: CSV UTF8 with BOM
CSV with BOM or no BOM
44. Interoperation
Live with .NET and Oracle tech
stack based on RabbitMQ
45. WebService, RestfulAPI, RabbitMQ, DB, FTP
Web Service RestfulAPI RabbitMQ Database FTP/SFTP
.NET Excellent Fair Good Fair Fair
Rails Poor Excellent Good On MVC only Fair
46. Ubuntu
Dominate linux distrobution now
appears
47. Time to thinking about migrate to Linux
Windows market share in Server OS Windows market share in Mobile OS
From http://news.netcraft.com/archives/2012/
48. 3 Steps to Linux
•Development and edit on Windows.
• Prefer as long as it works
•Development on Linux and edit in windows.
• Sublime Text with FTPSync
•Development and edit file in Linux only
• From OS on USB Disk to SSD
Notas del editor
ASP.NET MVC 3 is the framework that MS answer to Rails, but after learning, I found Rails is more clear and consistent design.I attend the Cloud Foundry China Open Tour 2012, known Mark Lucovsky using Rails and Linux nowMark is famous because Steve Ballmer, on being informed that Lucovsky was about to leave Microsoft for Google, picked up a chair and threw it across the room, hitting a table in his office. Mark is Windows NT guru starting at DEC stage, defining the Windows API for software developers working on the Windows NT platform.I attend the Hackathon in May 2012, Shanghai, found 60% developer choose Rails as web framwork.