Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Web application intro + a bit of ruby (revised)

519 views

Published on

A little introduction to web applications and to Ruby, used at the Rails Girls Berlin workshops.

  • Be the first to comment

  • Be the first to like this

Web application intro + a bit of ruby (revised)

  1. 1. Introduction to Web Applications Tobias Pfeiffer @PragTob pragtob.wordpress.com
  2. 2. Today
  3. 3. What is a web application?
  4. 4. Not rocket science
  5. 5. I am Rails(and So Can You!)
  6. 6. Programming is fun!
  7. 7. What you are going to build today
  8. 8. So what is a web application?
  9. 9. Presented in a web browser
  10. 10. Runs on a server...
  11. 11. ...or the cloud
  12. 12. is dynamic
  13. 13. A high level overview
  14. 14. High level overview
  15. 15. High level overview
  16. 16. High level overview Request
  17. 17. High level overview
  18. 18. High level overview Answer
  19. 19. High level overview Answer
  20. 20. High level overview
  21. 21. What parts does a webapplication consist of?
  22. 22. Web Application
  23. 23. Front End Back End
  24. 24. Front End Back End
  25. 25. CSS JavaScriptHTML
  26. 26. CSS JavaScriptHTML
  27. 27. Structure and content
  28. 28. CSS JavaScriptHTML
  29. 29. Styling to transform...
  30. 30. ...this...
  31. 31. ...into this.
  32. 32. CSS JavaScriptHTML
  33. 33. CSS JavaScript Back EndHTML
  34. 34. CSS JavaScript Back EndHTML
  35. 35. LogicInfrastructure
  36. 36. LogicInfrastructure
  37. 37. Logic● Behaviour● Implements the business logic● Ties all the parts together● Generates content
  38. 38. Ruby on Rails
  39. 39. LogicInfrastructure
  40. 40. Web Server
  41. 41. LogicInfrastructure
  42. 42. Storing all your data...
  43. 43. ...in giant tables
  44. 44. Recap
  45. 45. Web Application Landscape CSS St or JavaScript ag Logic e HTML Infrastructure
  46. 46. Web Application Landscape Django Bootstrap Mo Ruby on Rails CSS St oDB ng or JavaScript Logic ag e jQuery PHP Java Ruby Sq lite HTML Python XML DOM WEBrick Infrastructure Apache Thin
  47. 47. But what is Ruby on Rails?
  48. 48. A web applicationframework written in Ruby
  49. 49. ● A general purpose programming language● Principle of least surprise● Invented by Yukihiro Matsumoto
  50. 50. "I hope to see Ruby helpevery programmer in theworld to be productive, and toenjoy programming, and to behappy. That is the primarypurpose of Ruby language."Yukihiro Matsumoto
  51. 51. Ruby on Rails● Framework written in Ruby● set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating HTML (ERB) – Pays attention to security – … and so much more!● Model View Controller● You write in Ruby
  52. 52. Lets get into some Ruby
  53. 53. But before that...
  54. 54. Questions time ?
  55. 55. Open a terminal/console
  56. 56. irb
  57. 57. tobi@speedy:~$ irb1.9.3p194 :001 >
  58. 58. irb – interactive ruby● talking to ruby● You tell ruby something● Ruby responds with what it understood● Coaches are going to help you!
  59. 59. 1.9.3p194 :001 > 5 => 5
  60. 60. 1.9.3p194 :002 > 5 + 3 => 8
  61. 61. 1.9.3p194 :003 > 8 * 7 => 56
  62. 62. 1.9.3p194 :004 > "Tobias Pfeiffer" => "Tobias Pfeiffer"
  63. 63. 1.9.3p194 :005 > name = "Tobi" => "Tobi"
  64. 64. 1.9.3p194 :005 > coach = "Tobi" => "Tobi"
  65. 65. 1.9.3p194 :005 > dhaksdhak = "Tobi" => "Tobi"
  66. 66. 1.9.3p194 :005 > name = "Tobi" => "Tobi"
  67. 67. 1.9.3p194 :006 > name => "Tobi"
  68. 68. 1.9.3p194 :007 > result = 8 * 7 => 56
  69. 69. 1.9.3p194 :007 > result = 8 * 7 => 56 56 res ult
  70. 70. 1.9.3p194 :008 > result * 10 => 560
  71. 71. 1.9.3p194 :009 > name + " likes Sweden" => "Tobi likes Sweden"
  72. 72. 1.9.3p194 :010 > puts "Hello World!"Hello World! => nil
  73. 73. 1.9.3p194 :011 > fruits = ["apple", "keewee","orange"] => ["apple", "keewee", "orange"]
  74. 74. 1.9.3p194 :013 > fruits.each do |fruit| putsfruit endapplekeeweeorange => ["apple", "keewee", "orange"]
  75. 75. 1.9.3p194 :013 > fruits.each do |bob| putsbob endapplekeeweeorange => ["apple", "keewee", "orange"]
  76. 76. 1.9.3p194 :013 > fruits.each do |anything|puts anything endapplekeeweeorange => ["apple", "keewee", "orange"]
  77. 77. 1.9.3p194 :014 > fruits[0] => "apple"
  78. 78. 1.9.3p194 :015 > symbol = :wuh => :wuh1.9.3p194 :016 > symbol => :wuh
  79. 79. 1.9.3p194 :017 > dictionary = {:hi =>"Hej", :good => "bra", :cookie => "kaka"} => {:hi=>"Hej", :good=>"bra",:cookie=>"kaka"}1.9.3p194 :018 > dictionary[:hi] => "Hej"1.9.3p194 :019 > dictionary[:cookie] => "kaka"
  80. 80. 1.9.3p194 :020 > def hello1.9.3p194 :021?> puts "Hello there!"1.9.3p194 :022?> end => nil
  81. 81. 1.9.3p194 :026 > helloHello there! => nil
  82. 82. 1.9.3p194 :023 > def greeter(person)1.9.3p194 :024?> puts "Hello " + person1.9.3p194 :025?> end => nil
  83. 83. 1.9.3p194 :027 > greeter("Fanny")Hello Fanny => nil
  84. 84. 1.9.3p194 :028 > greeterArgumentError: wrong number of arguments (0for 1) from (irb):23:in `greeter from (irb):28 from /home/tobi/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>
  85. 85. 1.9.3p194 :029 > class Person1.9.3p194 :030?> attr_accessor :name, :age1.9.3p194 :031?> end => nil1.9.3p194 :032 > tobi = Person.new => #<Person:0x0000000205f080>
  86. 86. 1.9.3p194 :033 > tobi.name => nil1.9.3p194 :034 > tobi.name = "Tobi" => "Tobi"1.9.3p194 :035 > tobi.age = 23 => 231.9.3p194 :036 > tobi.name => "Tobi"1.9.3p194 :037 > tobi.age => 23
  87. 87. 1.9.3p194 :038 > tobi.age * 365 => 83951.9.3p194 :039 > puts "This was a talk by " +tobi.name + " - thank you!"This was a talk by Tobi - thank you! => nil
  88. 88. Where to go from here?● I gather resources here, such as: – http://tryruby.org – http://ruby.railstutorial.org/ – http://rubymonk.com/ – http://www.codeschool.com/courses/rails-for-zombies – http://rubykoans.com/ – http://railscasts.com/● Rails Girls Berlin project groups
  89. 89. Thank you and enjoy coding! Tobias Pfeiffer @PragTob pragtob.wordpress.comlisten to me talking about learning Ruby (German)
  90. 90. Photo credit● http://www.flickr.com/photos/captainkimo/5918836159/● http://www.flickr.com/photos/weppos/7486411688/● http://www.flickr.com/photos/railsgirlsberlin/7882839698/in/photostream● http://www.flickr.com/photos/nirak/644336486/

×