Lightning Talk: What About Ruby on Rails? ... From A PHP Guy

Summarized using AI

Lightning Talk: What About Ruby on Rails? ... From A PHP Guy

Michael Cheng • October 13, 2017 • Selangor, Malaysia • Lightning Talk

In this lightning talk presented by Michael Cheng at RubyConf MY 2017, the speaker, a software engineer from Singapore, discusses his journey transitioning from PHP to Ruby on Rails. He shares insights into the similarities and differences between PHP and Ruby, particularly highlighting their dynamic typing, object-oriented capabilities, and the evolution of PHP towards a more coherent language. Cheng points out several key aspects that differentiate Ruby on Rails from PHP frameworks:

  • Ease of Use: Ruby is touted as more expressive, allowing developers to write cleaner code without needing semicolons, compared to PHP's syntax requirements.
  • Development Environment: Rails allows for an integrated web server for development, unlike PHP's reliance on external servers.
  • Community Support: The Ruby community is portrayed as active and resourceful, providing numerous gems for various functionalities, enhancing development efficiency.
  • Tooling and Testing: Cheng discusses how Ruby on Rails makes testing and debugging more integral parts of the development process, contrasting the previous lack of emphasis in PHP.

Cheng shares specific projects to illustrate his points, including his work on a website for Engineers SG, which facilitates tech meetups in Singapore and is built entirely with Ruby on Rails. He also mentions a current project involving a student management system for a vocational school catering to students with disabilities, emphasizing the functionality and simplicity of building such applications with Rails.

He acknowledges some downsides of Ruby on Rails, such as the complexity of serving static content and the potential resource intensity of some operations, suggesting developers may need to adapt their infrastructure accordingly.

In conclusion, Cheng reflects on the fruitful decision to learn Ruby and Rails, claiming that having knowledge of multiple programming languages and tools empowers developers to select the best solutions for their projects. He emphasizes that besides practical programming skills, understanding design patterns can significantly enhance code maintainability and reduce issues in software development. He encourages fellow developers to explore Ruby through various recommended resources and community meetups.

Lightning Talk: What About Ruby on Rails? ... From A PHP Guy
Michael Cheng • October 13, 2017 • Selangor, Malaysia • Lightning Talk

Speaker: Michael Cheng (@coderkungfu)

Website: http://rubyconf.my

Produced by Engineers.SG

RubyConf MY 2017

00:00:06.370 wait hi hi everybody my name is Michael
00:00:11.360 and as yesterday I come from Singapore
00:00:15.260 you can find me on twitter my twitter
00:00:17.840 handle is kota kung fu and i also
00:00:20.300 tweeted engineers for the win I am
00:00:24.079 currently a software engineer at the
00:00:25.910 sigma power this basically the digital
00:00:29.090 technologies team there were building
00:00:30.829 some digital products for the for the
00:00:32.660 company so my topic today is about what
00:00:36.320 about Ruby on Rails from a PHP guy I
00:00:38.960 guess from the topic you can guess I am
00:00:41.600 the PHP guy a bit more about me
00:00:46.480 basically I started coding in PHP back
00:00:49.010 in 20 2001 and I started a single PHP
00:00:52.370 user group back in 2007 the user group
00:00:55.460 right now is celebrating its 10th
00:00:56.929 anniversary and that's me with creator
00:01:01.579 of PHP Rasmus laid off when he was in
00:01:04.339 Singapore in 2015 for the pitch becomes
00:01:07.010 Asia which is also a conference that I
00:01:10.010 ran that's us in 2015 but in 2014 I
00:01:16.250 joined a consultancy called new
00:01:18.020 innovation and that's where I started
00:01:20.060 coding Ruby and Ruby on Rails and since
00:01:23.960 then I've been an active member of the
00:01:25.460 Ruby community in Singapore that's us
00:01:28.370 the current batch of the tech ladies
00:01:30.590 bootcamp we're working on a project for
00:01:33.470 the appoint NGO called Mountbatten
00:01:35.510 vocational school yeah and that's me
00:01:39.890 Matz when he was in Singapore for the
00:01:42.050 riddle Ruby conf last year sorry the
00:01:44.990 photos be blurry cuz I had a bit too
00:01:46.850 much drink and
00:01:48.310 you know yeah I think she do this with
00:01:50.350 celebrities but you know yeah so for me
00:01:55.060 as a PHP guy switching from PHP to Ruby
00:01:57.430 and to be real rose to be honest wasn't
00:02:00.759 really that hot in a sense I started my
00:02:03.430 developer life as a web web designer
00:02:05.189 back when formatting web pages with
00:02:07.899 tables was cool you know this no he's
00:02:11.860 coming back really no anyway so I've
00:02:17.590 been building web applications in
00:02:19.120 cakephp and colon cancer for about ten
00:02:22.330 years
00:02:23.110 cakephp itself was inspired by the MVC
00:02:26.019 pattern pioneer by the by Ruby on Rails
00:02:28.890 so what about the languages that is both
00:02:32.200 and we see frameworks were built upon
00:02:33.700 right so having been coding in PHP for
00:02:36.730 more than ten years searching ruby was
00:02:38.950 really quite an interesting experience
00:02:41.489 let me just talk a little bit about the
00:02:43.810 similarities that I find in both
00:02:45.910 languages Ruby and PHP bona fide to
00:02:48.940 present languages they're dynamically
00:02:51.160 typed the easy to understand one reason
00:02:54.310 I think one reads the English and the
00:02:56.320 other one okay not so much both
00:03:01.170 object-oriented and yeah this is tester
00:03:06.609 yeah objected last I remember yes this
00:03:09.790 too is the differences father difference
00:03:12.519 is related to PHP IDs
00:03:15.700 how many PHP developers here I mean were
00:03:17.709 PHP developers or osteo PHP developers
00:03:20.139 quite a few yeah represent anyway um no
00:03:23.380 PHP promise very beginning so as a web
00:03:25.600 centric kind of language whose main for
00:03:28.180 building websites it works very well
00:03:29.500 with Apache web server it's not quite a
00:03:32.200 language in the sense it's more like
00:03:34.180 collection of functions but in PHP seven
00:03:36.910 they we have been some concerted effort
00:03:38.620 to kind of put it together and get act
00:03:40.299 together and make it more like a
00:03:41.560 language which is good
00:03:45.620 and right Wes Ruby is a general-purpose
00:03:51.230 language it's more and it's the more
00:03:54.650 effort there's a bit more the making
00:03:56.569 making web web enabled and it's very
00:03:59.540 expressive language as I've stated
00:04:00.800 earlier so some of the syntax
00:04:03.260 differences we do to like on the left
00:04:05.030 you have how you declare string in PHP
00:04:07.540 number and the different numbers and
00:04:10.040 sorts of off and variables you always
00:04:12.230 start with dollar sign an object a
00:04:14.930 variable we have a dash greater than and
00:04:18.109 so and so forth
00:04:19.959 Ruby is pretty much close to the same
00:04:23.870 like local variables you don't need to
00:04:25.880 put a dollar sign anywhere a global
00:04:27.530 variable Depot dollar sign and you don't
00:04:30.500 need use a dash greater than to refer to
00:04:32.990 variable set and methods and arrays they
00:04:39.650 have arrays in PHP and raised in Ruby
00:04:43.550 and hashes Ruby and if-else statements
00:04:52.130 in PHP a ruby and this is how you
00:04:56.270 declare a class in PHP like class class
00:05:00.260 T extends beverages same thing on the
00:05:03.560 right as so that's how a ruby yeah and I
00:05:08.419 like the fact that with Ruby class all
00:05:12.470 you do is yeah do private hear the rest
00:05:16.070 of it of stuff below our private methods
00:05:17.930 which is kind of nice where Ruby where
00:05:22.310 Ruby wins I think is in areas where you
00:05:26.900 don't need a semicolon at the end of a
00:05:28.520 statement you know I've been bitten so
00:05:30.889 many times but sometimes I write some
00:05:32.720 Ruby and I kind of like the maintain
00:05:34.820 some PHP code and then why is this cold
00:05:37.010 feeling alright I left our semicolon
00:05:39.070 right happens to us all dot is not used
00:05:44.389 for concatenation like future you could
00:05:46.280 put dot the Concannon concatenate two
00:05:48.080 lines two strings rather
00:05:51.039 in Ruby you don't need to Kali methods
00:05:54.279 you think you come at this with one less
00:05:56.379 character you know like you know you
00:05:58.629 yeah yeah you Ruby just dot something
00:06:01.899 and in PHP gotta dash greater than you
00:06:05.740 know one less character that's that's
00:06:07.749 right less typing on the keyboard you
00:06:09.789 know can you bracelets are not always
00:06:14.319 necessary you know and what opening text
00:06:18.509 you do the opening text in oh yeah oh we
00:06:22.300 don't need that in Ruby right that's
00:06:24.219 great what I think other things that
00:06:27.550 like Ruby tooling tooling supports great
00:06:30.490 testing profiling debugging this is not
00:06:33.309 like afterthoughts in Ruby a few in PHP
00:06:36.159 is well like oh wait we need to do some
00:06:37.719 testing yeah how do you do that
00:06:40.889 dependency management is pretty easy you
00:06:43.089 know bundler of course in PHP we now
00:06:45.430 have composer which also just the same
00:06:47.349 thing but you all know that compose the
00:06:49.360 Kyle copied from where bundle came from
00:06:51.909 right so yeah easy switch between Ruby
00:06:54.909 the versions which is great
00:06:56.199 Robby lrvm we can move between different
00:06:59.020 versions in PHP is a bit harder I think
00:07:02.050 and do that we're in our some Apache
00:07:04.509 config or something composure 24 ini
00:07:06.729 files but it's not as straightforward
00:07:09.870 and open source community is pretty
00:07:11.889 awesome right so problems are we are
00:07:14.169 lost smart people the Ruby community and
00:07:15.759 it has solve a lot of problems that we
00:07:17.289 face ourselves
00:07:20.389 and yeah so that's Ruby hobo Ruby on
00:07:23.539 Rails why what do I like about it so
00:07:27.219 there's no need to depend on a separate
00:07:29.389 web server for development so let's
00:07:30.830 build a web server in where do rails new
00:07:33.020 and has poop I'll install you know that
00:07:34.849 it's pretty great what we receive is web
00:07:36.500 brick a PHP leak out that quite recently
00:07:39.800 I think 5.40 introduced a testing server
00:07:41.900 billion but it's not as good as what we
00:07:44.750 have in the rails community
00:07:47.479 come on interfaces out pretty awesome
00:07:49.520 although you can say darrell has
00:07:52.099 something similar but it's not as easy
00:07:53.990 to read easy to use tracking DB's
00:07:58.069 changes is pretty straightforward
00:07:59.810 relatively easy usually there's a gem
00:08:04.039 for that when you have a problem there's
00:08:05.900 usually a gem which is great right
00:08:08.919 awesome
00:08:12.430 rails is a little very and be friendly
00:08:14.750 so it's come you can use log commonly
00:08:17.000 use stuff
00:08:18.050 all right probably use things you do you
00:08:20.270 can probably find a gem you know this
00:08:21.889 gem for that and for ideas to product
00:08:24.050 you can get it out in a very short time
00:08:25.669 and that's great it's relatively secure
00:08:28.190 and out of the box
00:08:32.029 they also many development about
00:08:33.680 deployment options like Heroku or Azure
00:08:36.199 I went to a self-hosted VPS it's pretty
00:08:38.570 straightforward
00:08:41.409 that's my repo one of my repo strata and
00:08:45.560 you can see most small ivory projects in
00:08:48.350 there right now 10 PHP projects so some
00:08:54.050 of the projects I've actually worked on
00:08:55.250 on my own my own with using Ruby on
00:08:58.010 Rails this is engineer so SG which is AI
00:09:00.769 I created to basically I create a group
00:09:03.949 to go around different tech meetups in
00:09:05.990 Singapore to come over I call it the
00:09:07.250 meetups because I feel that there's a
00:09:10.640 lot of talks happening in Singapore
00:09:12.769 different user groups and I felt it was
00:09:14.630 good there was no way to kind of like
00:09:16.370 like no one is actually keeping track of
00:09:18.079 them or recalling those two videos so I
00:09:20.839 thought I was always contribute back
00:09:22.339 because I have some knowledge a video
00:09:24.529 editing and videography and all that
00:09:26.510 stuff so I thought it'd be great for me
00:09:28.160 to try this so I've been doing this for
00:09:30.589 the last three years
00:09:31.360 recording meetups at first and
00:09:34.220 more recently conferences so the last
00:09:36.530 two radar we conference was actually
00:09:38.210 recovered by me and quite a few other
00:09:40.940 things that iOS called what cam and
00:09:44.860 DevOps days and few others so the whole
00:09:48.500 site was actually built in Ruby on Rails
00:09:49.990 I think that foot I did the first cut of
00:09:53.810 the website over a weekend it was a
00:09:56.330 weekend hack put together a small site
00:09:58.670 initially it was a reader I think just
00:10:01.010 to the YouTube channel and a car like
00:10:02.840 hey we need to come up with a nice page
00:10:04.790 for this yeah the front end is rails I
00:10:07.370 used active admin that for the back end
00:10:08.780 to make changes to things that's pretty
00:10:11.630 easy as after a while because I was also
00:10:15.050 uploading love videos and a lot of the
00:10:17.090 tasks that I do for uploading files to
00:10:18.980 YouTube was was tedious so I came up
00:10:22.100 with this modular website too for my
00:10:23.660 volunteers who also upload the videos
00:10:25.250 themselves so I built a little engine
00:10:27.380 SSG upload site it was unreal she was on
00:10:31.190 a VPS running and generics passenger and
00:10:33.770 because he was I was handling some large
00:10:35.540 files it was like four five sometimes
00:10:37.100 uploading to three gigs of four gigs of
00:10:39.110 files I need to use an engine X power
00:10:41.630 block modules account handles who flash
00:10:43.580 files of course the processing and
00:10:46.370 building and over there setting him out
00:10:48.140 to YouTube and processing the file was
00:10:49.820 all done using sidekick pretty pretty
00:10:52.370 easy so I cut bill this over a couple of
00:10:55.670 weekends but again it was very easy to
00:10:58.520 get up and running up MVP and currently
00:11:02.420 the project I'm working on for the
00:11:04.810 techies boot camp was also built on Ruby
00:11:07.400 on Rails
00:11:08.570 this is back she actually a website for
00:11:10.220 mountain bathroom vocational school
00:11:12.380 so basically be a student management
00:11:14.600 system for the for the school so that
00:11:15.980 they can take cube shahu the students
00:11:18.650 that goes through the school these are
00:11:20.630 students the students are pesky children
00:11:25.790 with disabilities like autism or
00:11:29.080 visually handicapped and we basically
00:11:31.280 the school basically brings them train
00:11:33.230 them for hospitality jobs like food
00:11:36.560 preparation FMB and housekeeping so
00:11:39.620 basically the school prepares them for
00:11:40.940 that and for the longest time they have
00:11:42.950 been doing a lot of these things in on
00:11:44.300 paper so as part of project for tech
00:11:46.250 need is really building a
00:11:48.260 student management system for them some
00:11:53.120 of the downsides of although I talked
00:11:55.190 about a lot of good things about Ruby on
00:11:56.390 Rails but there's some downsides to it
00:11:59.500 was serving web static or static content
00:12:02.420 you have probably have to bring your own
00:12:03.740 web server to do that it's quite rare
00:12:07.190 intensive but probably you just usually
00:12:10.070 solve about twenty more machines at a
00:12:11.480 problem
00:12:11.930 so lots of money troll just spin up the
00:12:14.510 Dinos and all that stuff that usually
00:12:16.370 solves problem write some reflections so
00:12:22.610 what I mean for me it was a deliberate
00:12:24.860 decision moving into the picking up Ruby
00:12:27.290 and Ruby on Rails for me if I only knew
00:12:30.560 PHP if all this PHP is audio a tall
00:12:34.010 order
00:12:34.370 only if P Spears only language I know
00:12:37.570 it's kinda like a hammer and everything
00:12:40.580 I see is a nail right knowing more tools
00:12:42.650 just give me my options and ability to
00:12:44.570 determine what is the best tool for the
00:12:46.280 job so basically everything we whatever
00:12:53.450 language we use these are based merely
00:12:55.160 tools for building great websites and
00:12:57.430 great web apps knowing more tools give
00:13:00.560 us the ability to decide on which are
00:13:03.560 the better tools to use for the job on
00:13:07.460 top that knowing not knowing different
00:13:09.800 languages all different frameworks is
00:13:11.660 one thing is far better know to have
00:13:14.390 better deeper knowledge in design
00:13:15.650 patterns in understand so that we can
00:13:17.900 understand how well do how we should
00:13:19.520 better build web apps we can also you
00:13:24.320 can actually write seven thousand lines
00:13:25.910 of spaghetti code in Ruby as well so so
00:13:29.270 knowing design patterns help you design
00:13:31.400 your code better such days more
00:13:33.350 maintainable and easier to make changes
00:13:36.510 so if you're if you own any of you I
00:13:39.000 don't know where any of you here seen
00:13:40.440 you do this if you are this some
00:13:43.019 resources I'd I personally try and went
00:13:45.779 through and was very helpful to me
00:13:47.699 try Ruby the real sky real skills guide
00:13:51.110 will be a real tutorial Rio's cast has
00:13:54.209 been all data but the videos are pretty
00:13:56.220 kind of a soup really good of course if
00:13:59.220 you are interested go for the one for
00:14:01.079 the Ruby Meetup you can meet like-minded
00:14:02.820 people as well yeah so that's me
00:14:07.620 Kotaku and then Gina's for the win thank
00:14:10.709 you thank you so much Michael so glad
00:14:17.490 you've seen the lights of rails
Explore all talks recorded at RubyConf MY 2017
+16