wroc_love.rb 2018

Lightning Talks Day 2

wroc_love.rb 2018

00:00:24.000 I like boring stuff, but I'm getting calls. I'm 23 at the moment, so I think it's time to do something crazy. You know, there's this buzzword called 'Serverless'. I wanted to know more about it, of course, and connect it with Ruby.
00:00:36.750 I'd like to talk about how our service providers evolved from the old infrastructure model. Initially, we had infrastructure as a service, which was something like EC2, where we just cared about the operating system and scaling. Then we got containers as a service like ECS, allowing us to scale our containers. Next, we had Platform as a Service like Heroku, which runs on the application level. Now, we have something called Function as a Service, which scales at the function level.
00:01:02.490 With Function as a Service, we have a single application with many functions that we can scale when needed. The best part is that we don't care about the servers—everything is handled by the provider. This offers great capabilities because you don't need to set up servers or require DevOps expertise. You just upload code to the platform and it runs, allowing you to scale as needed.
00:01:19.440 This encourages good coding practices because if your code is better and faster, you'll pay less. Additionally, it's challenging to write tightly coupled code, which often results in better architecture. For my demo, we have done a live deployment where we created two functions for an app that tracks bills I bought during the event.
00:01:41.790 The first functionality is creating a new bill, and it worked successfully. I received a response with a newly created object and the bill list operates correctly. Now, let’s take a look at some code. We’re working with a single function, which is essentially one file of Ruby—it's very concise. However, there's a catch: many providers don't support Ruby. This is a limitation we need to address.
00:02:17.180 I created a petition for Function as a Service support for Ruby, and there are already seven developers who signed on. If you're interested, please check out servicesforruby.org and add your GitHub account to the petition. Thank you.
00:03:00.760 Okay, moving on. My name is Sergey Ivanov. Normally, I develop backends using Ruby and other languages, but during the days in the dark cabines, I picked up microcontrollers and started writing, let's say, less than elegant C code. Today, I want to share a few words about how to run Ruby on a Cup of Coffee.
00:03:41.160 A Cup of Coffee is a very small microcontroller, specifically the ESP32 chip from a Chinese manufacturer. This model features several megabytes of storage and works efficiently with Ruby-like code. Also, it has built-in connectivity options like Wi-Fi and Bluetooth, which is sufficient for many projects. The cost of this microcontroller is just $4, but for development, it's better to use development boards.
00:04:07.420 To get started, you need to install ESP-IDF, which is the official toolkit based on FreeRTOS, a real-time operating system. This company has great documentation, making it easier to work with their tools. A few days ago, I came across a project called M Ruby for ESP32. M Ruby is a Ruby interpreter designed for embedded systems, allowing us to compile and run Ruby on such small devices.
00:04:58.150 For example, you can connect this microcontroller to temperature and humidity sensors and read the measurements in a loop. After each measurement, it can sleep for 10 seconds. The ESP32 has built-in Wi-Fi, which allows it to connect to the internet, and even with Wi-Fi connected, it has about 150 kilobytes of free RAM left over.
00:05:40.860 I used Thingspeak, a public service to store data, for logging the measurements collected by the microcontroller. However, since we don't have standard HTTP libraries in this environment, we need to write the request manually. It's completely feasible to send data using just head requests.
00:06:06.760 Now I will restart my microcontroller and connect it to Wi-Fi. Let's observe how it works. Current temperature is around 26 degrees, and it seems our hearts are quite toasty as well. I want to emphasize, though, that while it’s possible to implement TLS on such microcontrollers, let's not dive into that topic right now.
00:06:44.970 Thank you! Next, I would like to invite Adam to the stage. Hello everyone, my name is Adam, and I’d like to share a quick case study about how the Ruby community impacts developers and companies in general. I hadn't intended to give a lightning talk today, but after speaking with Andre, I figured it would be a good idea to share this story.
00:08:24.580 A couple of years ago, I attended the RailsConf conference, where I was amazed by various concepts and patterns, such as DDD (Domain-Driven Design), CQRS (Command Query Responsibility Segregation), and Saga patterns. I was so inspired that after the conference, I decided to dig deeper into these topics and apply them in my work.
00:09:01.840 Recently, I started a new project after reading several blog posts and watching presentations from the conference. I decided to implement DDD right away. From a retrospective perspective, it was somewhat risky because no one on the team had prior experience with it, but thanks to various resources, we managed to succeed.
00:09:35.110 We gained a lot of valuable tools out of the box, such as an activity audit trail log from the event store. This experience taught me the importance of having courage to try new approaches. I’m grateful for the inspiration I received at Ruby conferences, and I look forward to the next one.
00:10:12.430 Thank you!
00:10:25.880 Now, let’s discuss refinements. I was inspired by recent discussions and debates regarding the use of refinements in Ruby.
00:10:38.169 While it may not have been the first time, I want to explore the pros and cons of using refinements and share some interesting facts and use cases. During my experience, I've used refinements in many gems and found them beneficial, so I want to help you decide if it's worth using or not.
00:11:06.459 To start, refinements were introduced in Ruby 2.0 as an experimental feature. Many developers avoided using them because they didn't want to rely on experimental features. However, as of Ruby 2.1, refinements became a part of the language, which may reduce some of those concerns.
00:11:39.400 One interesting fact I learned is that the original author of refinements did not intend for them to be limited to Ruby in certain environments, but compatibility issues cropped up in JRuby that forced cuts in functionality. I also noticed that some developers, including core team members, still find refinements challenging and not perfect.
00:12:08.700 That said, there are still many use cases for refinements, such as dependency reduction. I was working on a gem that initially relied on ActiveSupport. Instead of rewriting everything for compatibility, I implemented a refinement to solve the dependency issue.
00:12:49.520 Another use case is modernizing code without restricting the Ruby version. My gem can leverage new Ruby features while gradually phasing out outdated dependencies. You may use refinements to write cleaner code during this transition.
00:13:14.820 Thanks for your attention!
00:13:34.310 Next up, my name is Arturo Stroki. Why do we love Ruby? First of all, it’s nice! Unlike Python developers, we tend to be more creative and enjoy discussing how to approach problems.
00:14:12.480 In the good old days, we simply wrote Ruby code using traditional concepts, but as new paradigms emerged, such as functional programming with pipes, we began to see a shift in our approach. Ruby's usage subsequently declined somewhat as many developers gravitated towards newer languages.
00:14:53.480 With the introduction of Ruby 2.5, the language has tried to catch up with features that enhance developer experience. One key addition is method referencing, which simplifies the calling of methods in Ruby.
00:15:30.120 I also explored various enhancements, including using method references and pre-applying parameters to methods for increased flexibility. This allows you to reference private methods and carry blocks more effectively in your code.
00:16:05.260 Additionally, you can reference public methods from other objects. But remember, direct references to private methods from different objects can lead to unexpected behaviors—so we need to be cautious.
00:16:46.500 In conclusion, please find my Ruby gem on GitHub, which implements these ideas. You can install it via 'gem install methods'. Thank you!
00:17:25.800 Let’s wrap things up.
00:17:40.099 My name is Maciek, and I want to share my thoughts on two key questions: What does it mean to be a developer? And, will computers replace us?
00:18:01.040 First, show of hands: who here is a programmer? Great! And who identifies as a developer? Now, what is the difference? To me, a programmer is someone who works primarily with code, while a developer solves problems and develops solutions using coding as a tool.
00:18:42.440 A developer’s role involves speaking the 'language' of codes, such as Ruby, while also understanding the business language related to customer problems. This dual fluency is essential because it allows developers to create better mental models of the problems they are tackling.
00:19:18.640 Often, we overlook the fact that building these models is crucial. For example, programmers must be able to bridge the gap between code and business context, using the language of the client to inform their coding decisions.
00:19:57.120 However, computers excel at low-level tasks and can replace us in those areas. As we move on from punch cards to higher-level programming languages like Ruby and more abstraction, it poses a risk to programming at the lowest levels.
00:20:33.160 That said, I believe it is unlikely that computers will fully replace us when it comes to client interactions, empathy, and the high-level understanding of needs. The creative and emotional aspects of understanding client requirements will always be in demand.
00:21:15.500 In conclusion, while automation may continue to advance, I foresee continuing opportunities for developers who can navigate the duality of business needs and technical solutions effectively.
00:21:48.020 Thank you all very much for your attention!