SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
运用Rails开发企业应用程序
Enterprise App Dev in Rails
- the .NET perspective

Eric Guo 过纯中
twitter.com/ecguo OR weibo.com/ecguo
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
Enterprise vs Internet application – Same facts

Community

Trends

Development Speed

Operation

Inter-operation
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
Why Rails   fits the Enterprise needs
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!
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
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)
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;
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
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
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.
Mac OSX pitfall and ruby issue in weibo
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
Rails in
           Install, Toolchain, Gems
Windows
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
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
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
Enterprise App   PaperLess form semi-generate

- pl-form        template application
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
User define forms instead of developer

A easy text format DSL
(Domain-Specific
Language)

  • Header-Detail forms
    supported

  • Pre-defined Items and
    Specs supported
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
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
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)
Rails Scaffold
                 How to custom to enable forms
                 define DSL
What happen after cmd: rails generator
C:Ruby193librubygems1.9.1gemsrailties-3.2.9binrails;
What happen after cmd: rails generator, cont.
Real generate command source code
Scaffold generate source code
Resource generate source code
Model generate source code
Where is ‘hook_for’ lives?




     http://rubydoc.info/gems/railties/Rails/Generators/Base.hook_for
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
Or just Google it…
Or Bing?
Change template and command line
Then make all code to together and clean
Or just fork the code in Github
   +----------------------+-------+-------+---------+---------+-----+-------+
   | Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
   +----------------------+-------+-------+---------+---------+-----+-------+
   | Controllers          |    74 |    65 |       3 |       8 |   2 |     6 |
   | Helpers              |    39 |    35 |       0 |       4 |   0 |     6 |
   | Models               |    61 |    50 |       4 |       3 |   0 |    14 |
   | Libraries            |   104 |    77 |       0 |       7 |   0 |     9 |
   | Integration tests    |     0 |     0 |       0 |       0 |   0 |     0 |
   | Functional tests     |     8 |     7 |       1 |       0 |   0 |     0 |
   | Unit tests           |    11 |     6 |       2 |       0 |   0 |     0 |
   +----------------------+-------+-------+---------+---------+-----+-------+
   | Total                |   297 |   240 |      10 |      22 |   2 |     8 |
   +----------------------+-------+-------+---------+---------+-----+-------+
     Code LOC: 227     Test LOC: 13     Code to Test Ratio: 1:0.1




        https://github.com/Eric-Guo/pl-form
Final after generated forms LOC
   +----------------------+-------+-------+---------+---------+-----+-------+
   | Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
   +----------------------+-------+-------+---------+---------+-----+-------+
   | Controllers          | 18459 | 13622 |     181 |    1254 |   6 |     8 |
   | Helpers              |    39 |    35 |       0 |       4 |   0 |     6 |
   | Models               | 1649 | 1458 |       205 |     137 |   0 |     8 |
   | Libraries            |   104 |    77 |       0 |       7 |   0 |     9 |
   | Integration tests    |     0 |     0 |       0 |       0 |   0 |     0 |
   | Functional tests     |     8 |     7 |       1 |       0 |   0 |     0 |
   | Unit tests           |    11 |     6 |       2 |       0 |   0 |     0 |
   +----------------------+-------+-------+---------+---------+-----+-------+
   | Total                | 20270 | 15205 |     389 |    1402 |   3 |     8 |
   +----------------------+-------+-------+---------+---------+-----+-------+
     Code LOC: 15192     Test LOC: 13     Code to Test Ratio: 1:0.0




        https://github.com/Eric-Guo/pl-form
Reporting   Export as Excel
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
Some time, 20 lines takes 3 hours to write.
Some time, 20 lines only takes 20 seconds
Interoperation
                 Live with .NET and Oracle tech
                 stack based on RabbitMQ
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
Ubuntu
         Dominate linux distrobution now
         appears
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/
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

Weitere ähnliche Inhalte

Empfohlen

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Empfohlen (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Enterprise App Dev in Rails - the .NET perspective

  • 1. 运用Rails开发企业应用程序 Enterprise App Dev in Rails - the .NET perspective Eric Guo 过纯中 twitter.com/ecguo OR weibo.com/ecguo
  • 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
  • 5. Why Rails fits the Enterprise needs
  • 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.
  • 13. Mac OSX pitfall and ruby issue in weibo
  • 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
  • 15. Rails in Install, Toolchain, Gems Windows
  • 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)
  • 25. Rails Scaffold How to custom to enable forms define DSL
  • 26. What happen after cmd: rails generator C:Ruby193librubygems1.9.1gemsrailties-3.2.9binrails;
  • 27. What happen after cmd: rails generator, cont.
  • 28. Real generate command source code
  • 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
  • 34. Or just Google it…
  • 36. Change template and command line
  • 37. Then make all code to together and clean
  • 38. Or just fork the code in Github +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 74 | 65 | 3 | 8 | 2 | 6 | | Helpers | 39 | 35 | 0 | 4 | 0 | 6 | | Models | 61 | 50 | 4 | 3 | 0 | 14 | | Libraries | 104 | 77 | 0 | 7 | 0 | 9 | | Integration tests | 0 | 0 | 0 | 0 | 0 | 0 | | Functional tests | 8 | 7 | 1 | 0 | 0 | 0 | | Unit tests | 11 | 6 | 2 | 0 | 0 | 0 | +----------------------+-------+-------+---------+---------+-----+-------+ | Total | 297 | 240 | 10 | 22 | 2 | 8 | +----------------------+-------+-------+---------+---------+-----+-------+ Code LOC: 227 Test LOC: 13 Code to Test Ratio: 1:0.1 https://github.com/Eric-Guo/pl-form
  • 39. Final after generated forms LOC +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 18459 | 13622 | 181 | 1254 | 6 | 8 | | Helpers | 39 | 35 | 0 | 4 | 0 | 6 | | Models | 1649 | 1458 | 205 | 137 | 0 | 8 | | Libraries | 104 | 77 | 0 | 7 | 0 | 9 | | Integration tests | 0 | 0 | 0 | 0 | 0 | 0 | | Functional tests | 8 | 7 | 1 | 0 | 0 | 0 | | Unit tests | 11 | 6 | 2 | 0 | 0 | 0 | +----------------------+-------+-------+---------+---------+-----+-------+ | Total | 20270 | 15205 | 389 | 1402 | 3 | 8 | +----------------------+-------+-------+---------+---------+-----+-------+ Code LOC: 15192 Test LOC: 13 Code to Test Ratio: 1:0.0 https://github.com/Eric-Guo/pl-form
  • 40. Reporting Export as Excel
  • 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
  • 42. Some time, 20 lines takes 3 hours to write.
  • 43. Some time, 20 lines only takes 20 seconds
  • 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

Hinweis der Redaktion

  1. 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.