wroclove.rb 2023
Lightning Talks Day 2
See all speakers
See all 8 speakers

Summarized using AI

Lightning Talks Day 2

Paweł Strzałkowski, Andrei Kaleshka, Michał Krzyżanowski, Andrzej Krzywda, Alexander Jahraus, Michał Matyas, Seb Wilgosz, and Paweł Świątkowski • September 19, 2023 • Wrocław, Poland

The video 'Lightning Talks Day 2' from the wroc_love.rb 2023 event features a series of short talks by several speakers, including Paweł Strzałkowski, Andrzej Krzywda, and others, focusing on technical topics relevant to Ruby and software development. Each speaker discusses various themes, providing insights into their projects and experiences.

Main Topics and Key Points:

  • Game Development in Ruby on Rails (Paweł Strzałkowski):

    • Explores the possibilities of developing a game using Ruby on Rails, showcasing how to handle game logic and backend management through a game loop and server framework.
    • Introduced 'respawn', 'permanent job', and 'server engine' to enhance server robustness.
  • Branch Switching in Ruby on Rails (Andrzej Krzywda):

    • Addresses challenges of data migrations when switching branches in Ruby on Rails, emphasizing how inconsistencies arise with schema changes.
    • Proposes a gem to track running migrations, reducing phantom migrations caused by branch changes, ensuring a smoother development process.
  • Improving Ruby Console Output (Paweł Świątkowski):

    • Demonstrates a gem created to enhance the output of the Ruby console, making data inspection cleaner and more user-friendly.
  • Advantages of Playing Chess for Developers (Michał Matyas):

    • Encourages developers to engage with chess, citing it as a means to develop strategic thinking and problem-solving skills.
    • Highlights the importance of online resources for chess learning and the history of AI advancements in the game.
  • Procrastination and Productivity in Development (Andrei Kaleshka):

    • Shares humorous insights about procrastination, introducing shell aliases to streamline Git command usage, improving overall efficiency.
  • Creating Internal Command Line Tools (Michał Krzyżanowski):

    • Discusses the development of an in-house tool to simplify command execution in complex setups, demonstrating the value of such tools in improving developer experience.
  • Excelling in Ruby Development (Alexander Jahraus):

    • Shares actionable advice on personal development in programming, stressing the importance of continuous learning, mentorship, and networking.

Conclusion and Takeaways:

  • The series of talks emphasizes creativity and problem-solving within the Ruby ecosystem, encouraging attendees to explore new tools and methodologies.
  • The community-oriented approach, as seen through networking and sharing tools/gems, fosters collaboration and innovation. The overall message advocates for a proactive mindset in both personal and professional growth.

Lightning Talks Day 2
Paweł Strzałkowski, Andrei Kaleshka, Michał Krzyżanowski, Andrzej Krzywda, Alexander Jahraus, Michał Matyas, Seb Wilgosz, and Paweł Świątkowski • September 19, 2023 • Wrocław, Poland

wroclove.rb 2023

00:00:07.259 Hi guys, I'm Paweł. I have just five minutes, so I won't tell you much about myself. The last topic was about games, and it was awesome! Have you ever wanted to write a game? If you’re just like me, a failed game developer, you're in good company. I've attempted to create games in every technology I've ever used, from IRC bots to Java with Unity and C#. However, I've never written a game in Ruby on Rails. Have you ever tried that? Let's imagine how it could look. Picture this: a knight has to avoid dragons and find the beloved Ruby. It sounds simple, but let's make it a bit more complex.
00:01:05.280 In this version of the world, we still have this dragon, but the world evolves just like in real life. And just for your information, it’s not JavaScript; it’s all generated on the backend, and I will show you how. So, how does it work? Of course, there are endpoints for movements, which we all know about. But on top of that, there's a game loop that maintains the game's status and manages progress. The game loop is a continuous process that calculates the state based on the moves and the world modeled in the game. To run such a process, I'm using the 'respawn' gem and 'permanent job', although I should clarify that the idea is not mine; it's a wrapper for a framework called 'server engine', which was designed for implementing robust multi-process servers. This framework was presented back in 2014 at RubyKaigi by Masahiro Nakagawa, and I give all credit to him. You can check out his presentations; it's amazing software.
00:02:32.879 So, what makes these servers robust? The definition requires you to define workers, which can be processes, fibers, or threads. You can add a server that communicates with the workers. This allows for features like soft restarts, server reconfiguration, and a supervisor mechanism that automatically restarts any worker that fails due to memory or network issues. It’s a great piece of logic, and I encourage you to watch the presentation if you get a chance. Speaking of implementation, the 'raise permanent job' gem allows you to create a class with a call method. Thanks to Nick Sutter from Teracy for the inspiration. With this gem, you can create a rake task that handles jobs and run it, specifying how many workers you want. What you receive here is supervision—something that standard rake doesn't offer. By using 'respawn', 'permanent job', and the 'server engine', you get that supervision feature included. You can even set it to multi-threaded mode.
00:04:13.140 So how does this work? We have a game loop that iterates over the tasks, loading the board, progressing the state, and saving, so it can display it on your screen. The game starts by resetting all the boards, putting it into 'raise permanent job', and sleeping for 0.3 seconds between iterations. And here we go! Before I finish, if you have your phone, scan this QR code and join me in this game! You can click on the white port to move yourself up, down, left, or right. Thank you very much! That’s all from me.
00:04:51.300 Thank you, everyone! I’d also like to thank the organizers for this incredible conference. It’s great to be here for the second time. Today, I want to discuss a specific problem you might encounter while developing a Ruby on Rails application: switching branches that have data migrations, especially when there are schema changes. This can lead to inconsistencies between branches. For example, you may switch to another branch where a column is added as 'not null', but when you switch back and run your tests, you encounter strange exceptions. This can be incredibly frustrating, especially for junior developers who may not fully understand what’s happening. To solve this issue, we need to eliminate the phantom migrations introduced by the branch change. The solution I propose is to create an automatic process that manages this for us. While it's possible to resolve these issues manually—by dropping the database and renaming it with a data dump—my solution focuses on tracking the running migrations in a temp folder. By keeping a history of all migrations, we can easily roll them back whenever needed.
00:06:22.640 I’ve created a gem to address this issue. The installation and configuration are straightforward and require no additional setup. The gem works by tracking the running migrations inside the temp folder. Each time you switch branches, you run 'rails db:migrate', and you’ll have an updated database. However, note that this implementation assumes all migrations are reversible—a limitation since not every migration can be rolled back easily. But generally, this approach should work well, provided you keep your migrations reversible. If you have questions or if anyone has used the gem, I would appreciate your feedback. We can discuss this more during the break or at the party! Thank you!
00:07:55.020 Hey everyone! Today, I’m going to share something you probably haven’t seen before, which might blow your mind! If you have a Rails application, did you know you can use 'rails console' to inspect all the data in your database? I know, a lot of you already know that! However, the default output of IRB and Active Record has its drawbacks, and I wasn't thrilled about it. That’s why I created a gem to improve the output of the 'debugger' to make it more user-friendly. It supports different layouts and switches to a horizontal layout if you have wide tables. Every item displays on a new line, separated by stylish green bars, making it easier to read. There's even a QR code linking to the repository if you'd like to check it out! Feel free to use it and don't forget to star the repository!
00:10:08.460 Alright everyone, do you recognize this? Yes, it’s the Queen’s Gambit! A certain company made chess popular worldwide through a fictional character. The real world champion is Magnus Carlsen from Norway, and I played against him last year. He beat me—albeit online—but it was a thrill! Chess has become increasingly popular—even more than before. I’ve been involved in the chess world for 30 years, and suddenly everyone plays chess, which is amazing! As programmers, I want to share tips on why it's worth starting to play chess. Chess is a scientific and meritocracy-driven game: you can objectively measure your progress. My FIDE rating shows clear milestones over the years, with improvements and setbacks. Online tools have significantly enhanced the learning process, providing insights into mistakes after every game. Multiple platforms exist—like Chess.com and Lichess, both offering excellent mobile and web experiences.
00:14:54.600 Chess has always been the battlefield for AI developments. We've seen remarkable improvements both in chess engines like Stockfish and Lela, which are open source. Last weekend, I had a game with Grandmaster Krzysztof Kobusiak, and the digital chessboard allows fantastic analysis post-game. After returning home, I can run an engine on my game moves and it offers superb recommendations—even calculating 51 moves ahead! Some tips for beginners: Start with E4, develop your Knight and Bishop quickly, and control the center squares. Don't place Knights on the edges; focus on putting your pieces closer to the center as they have more power there.
00:15:45.120 In chess, we recognize patterns. Experienced players acknowledge setups like the Fianchetto or the London system. Instead of focusing on small movements, a chess player sees the game in chunks or patterns, making it easier to strategize. Even sourcing in chess follows a similar pattern as we document moves in notation during games. The true joy of chess lies in experiencing matches live, and there are local clubs where you can engage with other players. You can also play with me on Chess.com if you wish!
00:16:50.820 Hi everybody! Today’s talk isn’t about procrastination, even though I have procrastinated while preparing this talk. It’s ironic that during the first few minutes, I’m discussing my procrastination tendencies. I joke that I might need therapy since I’m openly sharing this in front of dozens of people! Let me tell you, I can put the 'pro' in procrastination. I excel at it! Procrastinators often engage in activities that they justify as being semi-productive to avoid doing their actual work. One common activity is creating shell aliases to make repetitive tasks more manageable and faster. For example, I set up a shell alias for creating new Git branches—it's called 'NB'. Instead of typing 'git checkout -b', I now just type 'NB' and it creates a new branch. While this is quite convenient, I still have another issue: I hate typing 'git' over and over because of its length.
00:20:44.000 This is where my shell abbreviations come in. In my favorite shell, Fish, I can create abbreviations to shorten commands even further. Instead of typing 'git commit', I can simply type 'GC', and it expands into the full command once I hit space. The downside to this is that with many aliases, I can quickly forget their purpose. To address this, I created a script during my shell setup that converts Git aliases into shell aliases. So now, whether I type 'git WC' for 'what changed' or abbreviate it to 'gwc', it works seamlessly! Fish shell offers great pair programming functionality, allowing me to explain long commands using abbreviated forms. This is particularly helpful when coding with junior developers or non-technical folks because they can see exactly what command I’m executing without my explaining every detail! Fish is a fantastic tool, and I highly recommend it for its user-friendly nature.
00:25:00.540 Now I’d like to dive into building your own command line tools, particularly using my workspace as an example. My name is Michał, and I work at Helpling, which has two full-stack developers and multiple front and back-end teams. We run separate applications for each country where we operate, leading to complex development setup. Initially, we used Vagrant for VM support, but we switched to Docker and Docker Compose as it became more complicated to set up due to syncing issues between environments. This led to cumbersome documentation filled with long commands that developers needed to manually copy from a place like Confluence—and we all know that’s a poor developer experience. To alleviate this, we introduced our own internal tool called Helpling Tool Bolt. We upgraded versions from Thaw to Dry CLI, which provided better command readability. Using TTY toolkit features, we managed to simplify the command process significantly, saving developers time and effort.
00:27:50.520 The evolution of our tool saw it grow from simple command-copying into a multifunctional setup that could automatically resolve common issues. Things that previously slowed down front-end and back-end developers are now easy fixes. Moreover, the built-in documentation enables developers to understand how to use each command effectively. We’ve also integrated our command line tools with CI tests, running end-to-end tests successfully in the development process, reusing the logic implemented for local development. In summary, whenever you face challenges, consider creating internal command line tools to improve your team’s efficiency. Your time and resources will be saved immensely. Thank you!
00:30:27.900 I’m a highly competitive person, and if you are too, this talk is for you. There are moments when I find myself striving to be the best at everything I do. I want to share some insights on how to excel in any field you choose, using the example of achieving wealth in Poland. For instance, only 44% of Polish citizens save any money. If you have just a dollar saved, you’re already in the top 60% of richest people in the country. So, by saving, you can easily climb into the top tiers of wealth.
00:30:56.220 If we apply this mindset towards becoming a better Ruby developer, we can make substantial progress by taking simple steps. First, read technical books; most Poles read fewer than one book per year. If you read one technical book annually, you’re already ahead of most. Next, staying at a job for a few years can significantly boost your experience compared to many junior developers. By teaching others, you deepen your understanding of your craft and expose yourself to critique, pushing your limits. Lastly, networking with smarter individuals—perhaps through a blog, podcast, or YouTube channel—can open doors to conversations with experts in the field.
00:32:11.760 Finding a mentor can be crucial as well. Attending conferences is a golden opportunity to meet peers and mentors who can guide you on your journey to excellence. Thank you for listening to my talk, and I hope you find success in your path. Remember, it’s about continuous learning and seeking opportunities to integrate knowledge and growth within your field.
00:35:00.000 Also, I'd like to wrap up with a response to a previous lightning talk about game development in Rails. If you've ever wanted to create a game but hesitated, you can use JRuby to combine the power of Ruby with Java. I discovered a framework for writing roguelikes compatible with Kotlin. While it’s not the fastest execution, it opens avenues for creative development. I’ll show how the game works; when you walk around the cave searching for gems, you’ll interact with objects and experience a simple gameplay loop. This setup highlights the creativity within Ruby while exploring the possibility of integrating Java through JRuby. If you're interested, there's a QR code linking to the project's repository and documentation too. Thank you for your attention!
Explore all talks recorded at wroclove.rb 2023
+14