Pattern Matching
Lighting Talks Day 3
See all speakers
See all 5 speakers

Summarized using AI

Lighting Talks Day 3

Adam Hodowany, Tomáš Dundáček, Adam Skołuda, Adam Piotrowski, and Nicolas Dermine • March 22, 2019 • Wrocław, Poland

The video titled "Lighting Talks Day 3" features multiple speakers sharing insights mainly on the Ruby and Elixir programming languages at the wroc_love.rb 2019 conference. The following key points were discussed:

  • Introduction to Elixir: Adam begins his talk by presenting features of Elixir, including conditionals such as if-else statements and switch cases, explaining that Elixir lacks traditional else-if statements which can be less necessary for effective coding. He emphasizes the importance of quick failure in Elixir.

  • Pattern Matching: The speaker discusses the match operator in Elixir, describing how it differs from Ruby's assignment operator. He explains concepts like pattern matching with lists and maps, showcasing how Elixir can utilize pattern matching beyond mere variable assignment.

  • Pipelines in Elixir: Adam highlights the pipe operator, which allows for streamlined chaining of operations, making code more readable by passing the output of one function directly as input to the next.

  • Rails Applications for Organizations: Tomas shares his experiences working with various organizations, especially smaller ones that often go unnoticed yet require web applications to streamline their processes. He emphasizes the effectiveness of Ruby on Rails for developing tailored applications for these needs despite initial considerations of using PHP and WordPress.

  • Interoperability of Ruby and Elixir: Adam discusses how Ruby and Elixir can effectively work together. He mentions using a port from an Erlang library to call Ruby code from Elixir, mentioning specific libraries that help facilitate this process while pointing out some challenges, particularly around data structure compatibility.

  • Community Engagement and Organization: The final segments cover the importance of community involvement, sharing anecdotes about his personal experiences in organizing events and making connections through Ruby and Elixir communities. He encourages participants to assist in organizing future conferences and highlights the value of friendships formed within this collaborative environment.

These discussions aim to inspire developers to explore Ruby and Elixir's functionalities, foster community, and encourage contributions to local tech ecosystems. The main takeaway is the recognition of vibrant developer communities and the collaborative spirit that helps drive innovation and engagement in tech.

Lighting Talks Day 3
Adam Hodowany, Tomáš Dundáček, Adam Skołuda, Adam Piotrowski, and Nicolas Dermine • March 22, 2019 • Wrocław, Poland

wroclove.rb 2019

00:00:15.410 Okay, so I'm Adam, and I want to remind everyone that five minutes of lightning talks are sacred, so you may hate me for the next year. I'm a Ruby developer, and I've been working mostly with Elixir for two years.
00:00:28.040 I wanted to tell you something about it. Never mind. In Elixir, we have if-else statements, which are cool. We also have something like ternary operators, so we can write inline if statements. However, we do not have else-if statements, but this is okay. Some things that Millennials want we're not sure we really need. Why do we even need else-if if we can write something like this? We also have switch cases with a default condition set to true. If you don't have a default condition, it will fail. In Elixir, you want to fail very quickly. The equal sign is not really an assignment operator. Even if it quacks like a duck, it's really a match operator.
00:02:06.700 You can see that it can match 2, 4, 4, 2, 3 in this case, but it will fail if you try to match it with anything else. In Elixir, we have maps, which in Ruby we call hashes. You can access an attribute from this map, but you can also pattern match it. You have lists, but you might not really think of them as arrays. The structure you are familiar with, like 1, 2, 3, is really just syntactic sugar in Elixir for representation, where a list contains a first element and the rest of the list, hence we have a head and a tail.
00:02:46.820 You can pattern match an empty list, and you can use pattern matching for something more interesting than just assigning a variable. You can create conditions using pattern matching where you render some block based on what was matched. If something is not matched, it will result in an error, which is quite relevant. You can also use pattern matching with functions, not only in conditionals, but you can define multiple functions with the same name. The function that matches the pattern will be evaluated. You also have guards, and the poster child of Elixir is the pipe operator, which allows you to pipe the result of one operation as the first argument to the next function.
00:03:31.400 Instead of writing something complex, you can use pipelines, which, as a Ruby developer, might not seem interesting. For example, instead of writing `hunky-dory.reverse.split.upcase`, you might use pipelines to simplify operation chains. However, it may not work well in certain situations and could break on projections, so you can write something like this, which uses pattern matching with cases. This is not necessarily the prettiest solution, but it can be useful.
00:04:11.560 Thanks, everyone! Good evening. I'm Tomas, and I'm a Rails developer as well as a pro to Rails developer. I need to clarify that I'm not a day-to-day developer, which means that in my everyday work, I stand on the product side.
00:04:32.020 First, I have some disclaimers. Please note that this is not a technical talk, and it's also not truly a business talk. I'm fully aware that this is a dev conference; I haven't lost my way. I know where I am. Today, I want to talk about the number of organizations. Most people think of organizations like Amnesty International or Transparency International, but there are also smaller organizations that often go unnoticed. Many jobs within these organizations are invisible.
00:05:38.120 They face challenges implementing solutions, often spending hours trying to set systems up. If someone were to assist them with tailor-made applications, it would save them hours of frustration. I could tell you vague statements like 'behave like a change,' but that's not particularly helpful. As I worked with these organizations over the past few years, I wrote a couple of Rails applications for them. It's a bit daunting, but mostly, they need simple web applications for various scaffolds, and Rails is good enough for them.
00:06:55.430 The original thought was that PHP and WordPress would be easier, but I've found that helping them with Ruby is much better. My advice is similar to what is said in an unnamed commercial airline: sit back, relax, and reach out to local communities, as helping out can lead to fantastic experiences. You might not enjoy this talk, but I hope it offers some value.
00:08:44.550 Now, I want to quickly cover interoperability between Ruby and Elixir. My name is Adam, and I work for a recruiting company in Poznan. I'm a Ruby/Elixir developer. You may be wondering why Elixir and Ruby should work together. Imagine building an app in Elixir and needing to call an external web service. Since Elixir doesn't have many libraries wrapping these APIs yet, it’s highly probable that in the Ruby world, you will find a suitable gem for that.
00:09:25.840 I needed to connect to the JIRA API, and I didn't want to build it from scratch in Elixir. Fortunately, there are lots of gems in Ruby for JIRA. The good news is that Elixir and Ruby can work together effectively. I'll show you how it works: there is a port, which is an Erlang library used to run different programming languages in the Erlang virtual machine. Currently, it supports Ruby and Python.
00:10:57.361 As an Elixir developer, I want to avoid writing Erlang code, which can be less developer-friendly than Elixir. Luckily, I found a wrapper for Elixir to the Erlang port, allowing me to run Ruby code in Elixir easily. You can start a regular process with this library by indicating where your Ruby code lives in your project. This function returns a process identifier that you can use to call the Ruby code. This can be a simple function that takes a string argument.
00:12:50.966 This approach works well, but there are challenges, especially with data structure mapping. Elixir’s data structures like maps differ from Ruby's hashes, which can cause issues. For example, returning a tuple in Ruby is quite simple, and although there are libraries to manage these discrepancies, you'll still encounter challenges when transferring object-oriented structures.
00:14:18.340 When creating a Ruby object to connect to an ER client, if I close the Ruby process, the connection gets lost. Therefore, to avoid authenticating with the same credentials each time I call an external API, I serialize those objects, which allows me to receive them in the Elixir environment as JWT tokens.
00:15:33.610 That’s how it works, and I highly recommend trying it out. Moving on to some lighter topics, I wanted to see how many different ideas I can fit into five minutes. I have five topics to cover. One will be about people hiding, which can save you 60 euros a year. Second, why Ruby is not dead. The third will be 'thank you,' and the fifth will be a surprise.
00:16:37.530 People hiding, indeed! Six years ago, I went to a camp with three friends, and we met Andrey, who said we should go to the Rostrum. I didn’t think I could buy tickets quickly enough. He suggested I help organize the conference instead, but I was unsure. After some talks about board games, I realized organizing a conference could be as simple as sending a few emails or making phone calls.
00:18:06.660 So I started managing after-party celebrations. Now, I'm known for organizing t-shirts and parties, never having to buy a ticket again—saving me 60 euros a year! Now, regarding the question of whether Ruby is dead: it's not about the language itself. When clients ask about Ruby, they are often concerned about the community surrounding the language.
00:19:09.390 It's about how effectively we can convince developers to use Ruby. I feel enthusiastic about our community's potential. I also want to express gratitude to everyone involved in this community—not just the speakers and organizers but also those who share experiences during parties or discussions after talks. It’s heartening to see all the faces dedicated to this community.
00:19:52.630 I have great appreciation for the organizations and sponsors mentioned on our website. I aim to thank those who consistently contribute to making our community vibrant. We’re lucky to have people like Nico who advocate passionately for our community. Let's continue to encourage and support each other in making our events great.
00:20:34.470 As we move forward, we need assistance to organize the next Elixir conference. It can be a lot of fun and is a great way to save money. I hope this encourages you to reach out and help out, and you can even make new friendships. For instance, I met my good friend Michał at a camp, and sometimes the most unexpected scenarios lead to lasting friendships.
00:22:02.100 Now, I want to share a story about my strange experience making friends at a drug camp. We arrived late at the camp, but some folks were waiting for us even at 2 am. Our driver had to make unexpected stops during the trip due to work requirements, but we finally made it. At the camp, we were told where we were supposed to sleep.
00:24:50.580 Only two of us had beds while the rest of us, including me, had to adjust. Nevertheless, it was fun getting to know everyone, even in the chaos. This camp taught me how communal experiences and late-night adventures often shape friendships.
00:25:42.920 I hope this inspires you to forge connections at conferences and camps. This community thrives on collaboration, support, and friendship. Thank you, everyone! Let's keep the momentum going.
Explore all talks recorded at wroclove.rb 2019
+13