SlideShare a Scribd company logo
Creating & Maintain Web Applications
Avi Kedar, 8-2013
 New web approach
 Programmers sucks
 ails on b (Dynamic, KISS)
 Development booster
Deploy booster
Rails on
Ruby
Rails
Server
Data Layer
Presentation
Logic
Server
Data Layer
Presentation
Logic
Front End
SPA
MV*
Responsive
OpenId
Routing
Duplex
Front End
Presentation
Logic
Data
Server
Logic +
Data
Server
Logic +
Data
• Queue
• Distributed
Cache
• CDN
• Storage
• Processing
Cloud
Services
JSON
REST
JSON
REST
JSON
REST
Front End
Server
Logic + Data
Cloud
Services
• Stateless
• Data oriented
• Small functioning parts
• Less scale-up
• Easy to integrate
• Fast implementation
(80/20)
Technology helps creating good projects, it doesn’t lead.
Test your code, use patterns, avoid stickiness, use third-parties
• Launched in 2005
• Combination of Perl, Smalltalk and Lisp
• Created byYukihiro Matsumoto
• Open Source
Often people, especially computer engineers, focus on the
machines. They think, "By doing this, the machine will run
faster. By doing this, the machine will run more effectively.
By doing this, the machine will something something
something." They are focusing on machines. But in fact we
need to focus on humans, on how humans care about doing
programming or operating the application of the machines.
We are the masters. They are the slaves.
“
Yukihiro Matsumoto
• Executes on runtime
• “Free hand”, no type restrictions
• Strong reflection abilities
• Metaprogramming
Dynamic
No pre-compile, no build, truly open for extensions
• Executes on runtime
• “Free hand”, no type restrictions
• Strong reflection abilities
• Metaprogramming
Dynamic
a = [1, 'hi', 3.14, 1, 2, [4, 5]]
hash = { water:'wet', fire:'hot' }
l = lambda { "Do or do not" }
class Time
def yesterday
self - 86400
end
end
module Debug
def whoAmI?
return "#{self.type.name} (##{self.id}): #{self.to_s}"
end
end
class Toolbar
include Debug
# ...
end
• Executes on runtime
• “Free hand”, no type restrictions
• Strong reflection abilities
• Metaprogramming
Dynamic
1.methods
[:to_s, :-@, :+, :-, :*, :/, :div, :%, :modulo, ...]
obj.respond_to?(:each)
obj.is_a?(FixNum)
obj.instance_of?(i)
obj.nil?
"hello".class
"hello".variables
• Executes on runtime
• “Free hand”, no type restrictions
• Strong reflection abilities
• Metaprogramming
Dynamic obj.send :say_hello, 'Matz'
define_method :hello do |my_arg|
…
end
obj.instance_variable_set(:@x,10)
• Executes on runtime
• “Free hand”, no type restrictions
• Strong reflection abilities
• Metaprogramming
Dynamic
COLORS =
{ black: "000", green: "0f0", blue: "00f“, white: "fff" }
class String
COLORS.each do |color,code|
define_method "in_#{color}" do
"<span style="color: ##{code}">#{self}</span>"
end
end
end
"Hello, World!".in_blue
=> "<span style="color: #00f">Hello, World!</span>"
• Convention, convention, convention
• Write less
• ?, !, @, @@, ||=
• Read it
KISS
You don’t write code in Ruby
You’re using Ruby style and practices
to write better code
… loops, blocks, dependencies, conditions, etc. …
• Convention, convention, convention
• Write less
• ?, !, @, @@, ||=
• Read it
KISS
forget_about { } ( )
Always returns value
Always receive block
Person.new "Bob", 33
class Time
def yesterday
self - 86400
end
end
if number > 0
"#{number} is positive"
else
"#{number} is negative"
end
def demonstrate_block number
yield number
end
puts demonstrate_block(1) do |number|
number + 1
end
• Convention, convention, convention
• Write less
• ?, !, @, @@, ||=
• Read it
KISS person1.empty?
person1.save!
@first_name = “John”
@@employees_count = 55
DEFAULT_LOCATION = “Israel”
id ||= Guid.new
• Convention, convention, convention
• Write less
• ?, !, @, @@, ||=
• Read it
KISS
(1..10).collect {|x| x*x}
menu.delete_if {|key,value| value=='hot'}
credit_card.pay! unless products.empty?
5.times { send_sms_to "xxx" }
• Launched in 2005
• Created by David Hansson
• Open Source
• Stack framework
Test
MVC
Web Server
Action
Mailer
Rake
RESTfull ActiveRecord
• Convention, convention, convention
• Reuse, collaboration
• Test. Period.
• Generators
Dev Booster • IDE (simply
console)
• magic
• wizards
• config
• attributes
• dll’s
• threads
• IOC
• unused files, code
• MVC
• REST
• data layer
• Easy to integrate
• it looks stupid
NO YES
• Convention, convention, convention
• Reuse, collaboration
• Test. Period.
• Generators
Dev Booster • IDE (simply
console)
• magic
• wizards
• config
• attributes
• dll’s
• threads
• IOC
• unused files, code
• MVC
• REST
• data layer
• it looks stupid
NO YES
index.html.haml
show.js.coffee
• Convention, convention, convention
• Reuse, collaboration
• Test. Period.
• Generators
Dev Booster
Gem file
You need an enormous reason
to code something yourself.
Easy to integrate
Easy to use
Fully documented
Active community
• Convention, convention, convention
• Reuse, collaboration
• Test. Period.
• Generators
Dev Booster
• Rspec for unit tests
• Factory-girl for data
generator
• Capybara for integration test
• Built in mocking system
• Integrated with Rails, generators
and build machines, huge amount of artifacts
When “I sign in” do
within "#login-form" do
fill_in 'Login', with: 'user@example.com'
fill_in 'Password', with: 'password'
end
click_link 'Sign in'
end
Capybara
Rspec
Team-
city
Factory-
girl
Fantom
Browser
RailsMocking&
Generators
JS, CSS, HTML, Ruby…
• Convention, convention, convention
• Reuse, collaboration
• Test. Period.
• Generators
Dev Booster • rails g controller Tweets
• rails g controller Tags report_tag like_tag
• rails g model Presentations title:string slides_count:integer
• rails g rspec:controller Products
• rails g scaffold OnlineGames game:string score:integer
g
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast deploy
Deploy Booster
Rails Application
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast Setup
• Fast deploy
Deploy Booster
• built in relational ORM
• Part of the MVC (Model)
• No SQL syntax, all using ActiveRecord built in functions (Ruby):
ActiveRecord
users = User.all
Manage Databases
• DB create/alter tables, indexes, etc. via ActiveRecord (Ruby):
create_table :products do |t|
t.string :name
t.string :part_number
end
• Database structure and versioning using migrations
20111226120533_create_delayed_jobs.rb
david = User.where(name:'David')
david.age = 36
david.save!
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast Setup
• Fast deploy
Deploy Booster
• Full versions and dependencies management
• Group of gems per environment
• Install and upgrade all using single command
Gems
bundle install
bundle update
gem 'SystemTimer', require: 'system_timer'
gem 'feedback_popup'
gem 'i18n-js'
group :production do
gem 'asset_sync'
gem 'turbo-sprockets-rails3'
gem 'coffee-rails'
gem 'closure-compiler'
gem 'yui-compressor'
end
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast Setup
• Fast deploy
Deploy Booster
• Single place to manage all your css, js, images and third-
parties
• Stack based manager called Assets Pipeline (easy to extend)
(uglifier, unite to a single file, validate)
• Control the order of bootstraping
Assets
Vendors
• Manage all third-parties client side plugins (js and css)
(jquery, angular-js, twitter-bootstrap, etc.)
• Fully integrated with the assets pipeline
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast Setup
• Fast deploy
Deploy Booster
• Support multiple environment separation using yaml config
• Built-in test, development and production environment
• Full separation: DB, dependencies, testing, data-seed
Multi -environment
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast Setup
• Fast deploy
Deploy Booster
• As fast as 3 steps to create a full active machine
Fast Setup
git pull <branch>
bundle
rake db:migrate
• Single Responsibilty:
o DB using SQLite
o Server built in
o UT support built in
• Can illustrate production using multi-env
rails s –e production
• Full responsibility
o DB
o Gems
o Assets
o Vendors
• Multi-environment
• Fast Setup
• Fast deploy
Deploy Booster
• Using git as source control and deploy tool
• Using artifacts for measure and investigate your code (UT, code
coverage, memory lakes, etc.)
• Fully integrated with Saas hosting platforms:
o deploy in one click
o Deploy software not infrastructure
Add-ons: db-backups, logs, ssl, etc.
• Scale-out in not a forbidden word:
o Build for the cloud, so easy to integrate:
Queue, CDN, storage, etc.
o Scale your project in a single click
Fast Deploy
Build. Deploy. Scale.
git push production 2.4
 Client side manage the flow and contains all presentation logic and view
 Web servers should be data-oriented focusing on easy of scaling out and delivery speed
 Ruby designed for programmers not machine: helps creating beautiful code, self-explained
and dynamic
 Rails enable to quickly create web servers:
 Convention
 Reuse
 Single responsibility
 Quick setup and deploy
 Built-in scale out
Avi Kedar, 8-2013

More Related Content

What's hot (20)

Riding rails for 10 years
Riding rails for 10 years
jduff
 
A web app in pure Clojure
A web app in pure Clojure
Dane Schneider
 
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Fwdays
 
Put Your Thinking CAP On
Put Your Thinking CAP On
Tomer Gabel
 
Be faster then rabbits
Be faster then rabbits
Vladislav Bauer
 
How NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscape
Radosław Scheibinger
 
Scaling with swagger
Scaling with swagger
Tony Tam
 
Freelancing and side-projects on Rails
Freelancing and side-projects on Rails
John McCaffrey
 
Frameworks and webcomponents
Frameworks and webcomponents
Filip Bruun Bech-Larsen
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
Filip Bruun Bech-Larsen
 
Clojurescript slides
Clojurescript slides
elliando dias
 
Write Once, Run Everywhere - Ember.js Munich
Write Once, Run Everywhere - Ember.js Munich
Mike North
 
Rainbows, Unicorns, and other Fairy Tales in the Land of Serverless Dreams
Rainbows, Unicorns, and other Fairy Tales in the Land of Serverless Dreams
Josh Carlisle
 
Javascript Libraries
Javascript Libraries
elliando dias
 
Reactive All the Way Down the Stack
Reactive All the Way Down the Stack
Steve Pember
 
A tale of 3 databases
A tale of 3 databases
Chris Skardon
 
Building your own slack bot on the AWS stack
Building your own slack bot on the AWS stack
TorontoNodeJS
 
Managing Distributed Systems with Chef
Managing Distributed Systems with Chef
Mandi Walls
 
Developing in the Cloud
Developing in the Cloud
Ryan Cuprak
 
4 JVM Web Frameworks
4 JVM Web Frameworks
Joe Kutner
 
Riding rails for 10 years
Riding rails for 10 years
jduff
 
A web app in pure Clojure
A web app in pure Clojure
Dane Schneider
 
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Michael North "Ember.js 2 - Future-friendly ambitious apps, that scale!"
Fwdays
 
Put Your Thinking CAP On
Put Your Thinking CAP On
Tomer Gabel
 
How NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscape
Radosław Scheibinger
 
Scaling with swagger
Scaling with swagger
Tony Tam
 
Freelancing and side-projects on Rails
Freelancing and side-projects on Rails
John McCaffrey
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
Filip Bruun Bech-Larsen
 
Clojurescript slides
Clojurescript slides
elliando dias
 
Write Once, Run Everywhere - Ember.js Munich
Write Once, Run Everywhere - Ember.js Munich
Mike North
 
Rainbows, Unicorns, and other Fairy Tales in the Land of Serverless Dreams
Rainbows, Unicorns, and other Fairy Tales in the Land of Serverless Dreams
Josh Carlisle
 
Javascript Libraries
Javascript Libraries
elliando dias
 
Reactive All the Way Down the Stack
Reactive All the Way Down the Stack
Steve Pember
 
A tale of 3 databases
A tale of 3 databases
Chris Skardon
 
Building your own slack bot on the AWS stack
Building your own slack bot on the AWS stack
TorontoNodeJS
 
Managing Distributed Systems with Chef
Managing Distributed Systems with Chef
Mandi Walls
 
Developing in the Cloud
Developing in the Cloud
Ryan Cuprak
 
4 JVM Web Frameworks
4 JVM Web Frameworks
Joe Kutner
 

Viewers also liked (11)

Implementing quality in Java projects
Implementing quality in Java projects
Vincent Massol
 
Wed Development on Rails
Wed Development on Rails
James Gray
 
Simple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on Rails
jhenry
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
Simobo
 
Rapid development with Rails
Rapid development with Rails
Yi-Ting Cheng
 
Be project ppt asp.net
Be project ppt asp.net
Sanket Jagare
 
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
 
Web Design Project Report
Web Design Project Report
MJ Ferdous
 
47533870 final-project-report
47533870 final-project-report
Mohammed Meraj
 
Atm System
Atm System
Nila Kamal Nayak
 
SlideShare 101
SlideShare 101
Amit Ranjan
 
Implementing quality in Java projects
Implementing quality in Java projects
Vincent Massol
 
Wed Development on Rails
Wed Development on Rails
James Gray
 
Simple Social Networking with Ruby on Rails
Simple Social Networking with Ruby on Rails
jhenry
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
Simobo
 
Rapid development with Rails
Rapid development with Rails
Yi-Ting Cheng
 
Be project ppt asp.net
Be project ppt asp.net
Sanket Jagare
 
Web Design Project Report
Web Design Project Report
MJ Ferdous
 
47533870 final-project-report
47533870 final-project-report
Mohammed Meraj
 
Ad

Similar to Web Development using Ruby on Rails (20)

Rails - getting started
Rails - getting started
True North
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Nilesh Panchal
 
Ruby On Rails
Ruby On Rails
Eric Berry
 
Is Ruby on Rails Object Oriented? A Comprehensive Exploration
Is Ruby on Rails Object Oriented? A Comprehensive Exploration
rorbitssoftware
 
Aspose pdf
Aspose pdf
Jim Jones
 
Ruby on Rails : First Mile
Ruby on Rails : First Mile
Gourab Mitra
 
Ruby and Rails for womens
Ruby and Rails for womens
s4nx
 
FGCU Camp Talk
FGCU Camp Talk
Mark Brooks
 
When To Use Ruby On Rails
When To Use Ruby On Rails
dosire
 
Why Ruby?
Why Ruby?
IT Weekend
 
Ruby On Rails Presentation
Ruby On Rails Presentation
Paul Pajo
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
Ruby On Rails
Ruby On Rails
Gautam Rege
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
Intro to Ruby on Rails
Intro to Ruby on Rails
rschmukler
 
Ruby On Rails Introduction
Ruby On Rails Introduction
Gustavo Andres Brey
 
Ruby on rails for beginers
Ruby on rails for beginers
shanmukhareddy dasi
 
Introduction To Rails
Introduction To Rails
Eric Gruber
 
Ruby On Rails
Ruby On Rails
iradarji
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
arif44
 
Rails - getting started
Rails - getting started
True North
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Nilesh Panchal
 
Is Ruby on Rails Object Oriented? A Comprehensive Exploration
Is Ruby on Rails Object Oriented? A Comprehensive Exploration
rorbitssoftware
 
Ruby on Rails : First Mile
Ruby on Rails : First Mile
Gourab Mitra
 
Ruby and Rails for womens
Ruby and Rails for womens
s4nx
 
When To Use Ruby On Rails
When To Use Ruby On Rails
dosire
 
Ruby On Rails Presentation
Ruby On Rails Presentation
Paul Pajo
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
Mark Menard
 
Intro to Ruby on Rails
Intro to Ruby on Rails
rschmukler
 
Introduction To Rails
Introduction To Rails
Eric Gruber
 
Ruby On Rails
Ruby On Rails
iradarji
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
arif44
 
Ad

Recently uploaded (20)

Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 

Web Development using Ruby on Rails

  • 1. Creating & Maintain Web Applications Avi Kedar, 8-2013
  • 2.  New web approach  Programmers sucks  ails on b (Dynamic, KISS)  Development booster Deploy booster Rails on Ruby Rails
  • 6. Front End Presentation Logic Data Server Logic + Data Server Logic + Data • Queue • Distributed Cache • CDN • Storage • Processing Cloud Services JSON REST JSON REST JSON REST
  • 7. Front End Server Logic + Data Cloud Services • Stateless • Data oriented • Small functioning parts • Less scale-up • Easy to integrate • Fast implementation (80/20)
  • 8. Technology helps creating good projects, it doesn’t lead. Test your code, use patterns, avoid stickiness, use third-parties
  • 9. • Launched in 2005 • Combination of Perl, Smalltalk and Lisp • Created byYukihiro Matsumoto • Open Source Often people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something." They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves. “ Yukihiro Matsumoto
  • 10. • Executes on runtime • “Free hand”, no type restrictions • Strong reflection abilities • Metaprogramming Dynamic No pre-compile, no build, truly open for extensions
  • 11. • Executes on runtime • “Free hand”, no type restrictions • Strong reflection abilities • Metaprogramming Dynamic a = [1, 'hi', 3.14, 1, 2, [4, 5]] hash = { water:'wet', fire:'hot' } l = lambda { "Do or do not" } class Time def yesterday self - 86400 end end module Debug def whoAmI? return "#{self.type.name} (##{self.id}): #{self.to_s}" end end class Toolbar include Debug # ... end
  • 12. • Executes on runtime • “Free hand”, no type restrictions • Strong reflection abilities • Metaprogramming Dynamic 1.methods [:to_s, :-@, :+, :-, :*, :/, :div, :%, :modulo, ...] obj.respond_to?(:each) obj.is_a?(FixNum) obj.instance_of?(i) obj.nil? "hello".class "hello".variables
  • 13. • Executes on runtime • “Free hand”, no type restrictions • Strong reflection abilities • Metaprogramming Dynamic obj.send :say_hello, 'Matz' define_method :hello do |my_arg| … end obj.instance_variable_set(:@x,10)
  • 14. • Executes on runtime • “Free hand”, no type restrictions • Strong reflection abilities • Metaprogramming Dynamic COLORS = { black: "000", green: "0f0", blue: "00f“, white: "fff" } class String COLORS.each do |color,code| define_method "in_#{color}" do "<span style="color: ##{code}">#{self}</span>" end end end "Hello, World!".in_blue => "<span style="color: #00f">Hello, World!</span>"
  • 15. • Convention, convention, convention • Write less • ?, !, @, @@, ||= • Read it KISS You don’t write code in Ruby You’re using Ruby style and practices to write better code … loops, blocks, dependencies, conditions, etc. …
  • 16. • Convention, convention, convention • Write less • ?, !, @, @@, ||= • Read it KISS forget_about { } ( ) Always returns value Always receive block Person.new "Bob", 33 class Time def yesterday self - 86400 end end if number > 0 "#{number} is positive" else "#{number} is negative" end def demonstrate_block number yield number end puts demonstrate_block(1) do |number| number + 1 end
  • 17. • Convention, convention, convention • Write less • ?, !, @, @@, ||= • Read it KISS person1.empty? person1.save! @first_name = “John” @@employees_count = 55 DEFAULT_LOCATION = “Israel” id ||= Guid.new
  • 18. • Convention, convention, convention • Write less • ?, !, @, @@, ||= • Read it KISS (1..10).collect {|x| x*x} menu.delete_if {|key,value| value=='hot'} credit_card.pay! unless products.empty? 5.times { send_sms_to "xxx" }
  • 19. • Launched in 2005 • Created by David Hansson • Open Source • Stack framework Test MVC Web Server Action Mailer Rake RESTfull ActiveRecord
  • 20. • Convention, convention, convention • Reuse, collaboration • Test. Period. • Generators Dev Booster • IDE (simply console) • magic • wizards • config • attributes • dll’s • threads • IOC • unused files, code • MVC • REST • data layer • Easy to integrate • it looks stupid NO YES
  • 21. • Convention, convention, convention • Reuse, collaboration • Test. Period. • Generators Dev Booster • IDE (simply console) • magic • wizards • config • attributes • dll’s • threads • IOC • unused files, code • MVC • REST • data layer • it looks stupid NO YES index.html.haml show.js.coffee
  • 22. • Convention, convention, convention • Reuse, collaboration • Test. Period. • Generators Dev Booster Gem file You need an enormous reason to code something yourself. Easy to integrate Easy to use Fully documented Active community
  • 23. • Convention, convention, convention • Reuse, collaboration • Test. Period. • Generators Dev Booster • Rspec for unit tests • Factory-girl for data generator • Capybara for integration test • Built in mocking system • Integrated with Rails, generators and build machines, huge amount of artifacts When “I sign in” do within "#login-form" do fill_in 'Login', with: '[email protected]' fill_in 'Password', with: 'password' end click_link 'Sign in' end Capybara Rspec Team- city Factory- girl Fantom Browser RailsMocking& Generators JS, CSS, HTML, Ruby…
  • 24. • Convention, convention, convention • Reuse, collaboration • Test. Period. • Generators Dev Booster • rails g controller Tweets • rails g controller Tags report_tag like_tag • rails g model Presentations title:string slides_count:integer • rails g rspec:controller Products • rails g scaffold OnlineGames game:string score:integer g
  • 25. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast deploy Deploy Booster Rails Application
  • 26. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast Setup • Fast deploy Deploy Booster • built in relational ORM • Part of the MVC (Model) • No SQL syntax, all using ActiveRecord built in functions (Ruby): ActiveRecord users = User.all Manage Databases • DB create/alter tables, indexes, etc. via ActiveRecord (Ruby): create_table :products do |t| t.string :name t.string :part_number end • Database structure and versioning using migrations 20111226120533_create_delayed_jobs.rb david = User.where(name:'David') david.age = 36 david.save!
  • 27. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast Setup • Fast deploy Deploy Booster • Full versions and dependencies management • Group of gems per environment • Install and upgrade all using single command Gems bundle install bundle update gem 'SystemTimer', require: 'system_timer' gem 'feedback_popup' gem 'i18n-js' group :production do gem 'asset_sync' gem 'turbo-sprockets-rails3' gem 'coffee-rails' gem 'closure-compiler' gem 'yui-compressor' end
  • 28. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast Setup • Fast deploy Deploy Booster • Single place to manage all your css, js, images and third- parties • Stack based manager called Assets Pipeline (easy to extend) (uglifier, unite to a single file, validate) • Control the order of bootstraping Assets Vendors • Manage all third-parties client side plugins (js and css) (jquery, angular-js, twitter-bootstrap, etc.) • Fully integrated with the assets pipeline
  • 29. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast Setup • Fast deploy Deploy Booster • Support multiple environment separation using yaml config • Built-in test, development and production environment • Full separation: DB, dependencies, testing, data-seed Multi -environment
  • 30. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast Setup • Fast deploy Deploy Booster • As fast as 3 steps to create a full active machine Fast Setup git pull <branch> bundle rake db:migrate • Single Responsibilty: o DB using SQLite o Server built in o UT support built in • Can illustrate production using multi-env rails s –e production
  • 31. • Full responsibility o DB o Gems o Assets o Vendors • Multi-environment • Fast Setup • Fast deploy Deploy Booster • Using git as source control and deploy tool • Using artifacts for measure and investigate your code (UT, code coverage, memory lakes, etc.) • Fully integrated with Saas hosting platforms: o deploy in one click o Deploy software not infrastructure Add-ons: db-backups, logs, ssl, etc. • Scale-out in not a forbidden word: o Build for the cloud, so easy to integrate: Queue, CDN, storage, etc. o Scale your project in a single click Fast Deploy Build. Deploy. Scale. git push production 2.4
  • 32.  Client side manage the flow and contains all presentation logic and view  Web servers should be data-oriented focusing on easy of scaling out and delivery speed  Ruby designed for programmers not machine: helps creating beautiful code, self-explained and dynamic  Rails enable to quickly create web servers:  Convention  Reuse  Single responsibility  Quick setup and deploy  Built-in scale out