Ruby on Rails

Summarized using AI

Lightning Talks - Day 2

TODO • March 12, 2015 • Wrocław, Poland

The video, titled "Lightning Talks - Day 2," features a series of fast-paced presentations from various speakers at the wroc_love.rb 2015 event. Each speaker is given a strict five-minute limit to discuss different technical topics, showcasing innovations and insights in programming and software development. The session emphasizes brevity and engagement with the audience, who are encouraged to interact and react to the talks.

Key Points Discussed:
- Opening: The session begins with an introduction encouraging audience participation in stopping speakers when their time is up.

  • Norbert: Discusses the difference between happiness and joy in programming, specifically in the context of Ruby and Clojure. He explains the importance of building simple, composable systems rather than just easy ones. Key terms like 'decomplect' and 'composable' are introduced, emphasizing the need to refactor systems for better stability.

  • Crystal Language: The second speaker introduces Crystal, a programming language with Ruby-like syntax. Key features include:

    • Compiles to native code using LLVM
    • Optional typing with compile-time evaluation to catch errors
    • Notable performance benefits compared to Ruby, illustrated with a Fibonacci example.
  • Pagination in APIs: Magik explains a solution implemented for pagination issues in APIs, initially using a timestamp approach that became inefficient. He details a new method leveraging timestamps to sync data, achieving consistent results even after deletions occurred in the dataset.

  • Ruby Object Mapper (ROM): Oscar Schreier noteworthy presents ROM, clarifying misconceptions around it. ROM focuses on the data mapping process without adhering strictly to the Data Mapper pattern like Active Record. He explains its components and demonstrates querying capabilities through examples.

  • Crashing Ruby: A speaker shares ways Ruby can exhibit unexpected behaviors, showcasing pitfalls with code that can lead to crashes. This emphasizes the importance of staying updated with Ruby versions.

  • React Hot Loader: This segment discusses React's hot loading feature, allowing developers to update components without losing application state, enhancing the user experience, which is important for applications requiring constant updates.

  • Software Estimation: Discussed are the challenges of estimating software tasks, particularly with legacy code contributing to inaccuracies. The speaker encourages developers to be mindful of the nonlinear nature of learning and decision-making in development processes.

  • Active Admin and Code Quack: The final presentation introduces a new customizable library that facilitates administration in PHP and a new interactive learning platform called Code Quack, aimed at Polish speakers, offering technology courses.

Conclusions and Takeaways:
- Participants are encouraged to reflect on the constructs and technologies they use to ensure they promote simplicity and composability in their systems.
- The necessity of understanding the impacts of programming languages, tools, and constructs on complex systems is highlighted throughout the talks.
- Interaction and active engagement from the audience enrich the learning experience during lightning talks.

Lightning Talks - Day 2
TODO • March 12, 2015 • Wrocław, Poland

wroclove.rb 2015

00:00:12.480 This session is called Lightning Talks because it's supposed to be lightning fast. So, everybody gets five minutes. I have a timer here that I'm going to display.
00:00:19.279 When the timer runs out, I want you all to stomp, clap, and shout so loudly that the speaker has to stop talking, okay? Let's try it out now. Make some noise!
00:00:32.640 No, wait! I insist you boo me off the stage. Let's try that, yes? But keep in mind, if you throw things, throw them at him, not at me. Alright, so everyone, please introduce yourselves in two words. You might also want to mention what your talk is about.
00:01:02.879 I am Norbert, and my talk is about words. Okay, rock and roll!
00:01:10.320 I have a confession to make: I am a Ruby programmer by day, and I write Clojure at night. Participating in both communities, I’ve noticed certain things, for example, this talk is about words; I see in the Clojure community that don't show up in the Ruby community and I think it's time to change that.
00:01:21.520 Everyone talks about how happy they are writing Ruby code. The word 'happy' actually comes from the root 'hap,' which means lucky. The word 'joy' comes from a Latin word that means to take delight in. When I write Ruby code, I am most definitely happy, and when I read it, I feel happy. However, I've learned that Clojure code gives me joy.
00:01:39.840 Happiness can be fleeting, whereas joy tends to be more sustainable. The closure community is very vocal about the difference between simple and easy. By definition, simple means not complex, while easy means something familiar that is easy to understand. Just because something is easy doesn’t mean it is simple.
00:02:05.600 Next time you're discussing a library or a language, think about whether it is simple or just easy. For long-term stability, we need to build simple systems, not just easy systems. The concept of 'complex' is one of my new favorite words. It literally means to braid together.
00:02:37.599 On the other hand, 'compose' means to put next to each other. We often talk a lot about refactoring. In Ruby, we discuss moving code into modules or different classes, creating inheritance trees, or even using service objects or microservices. However, simply moving the code does not improve the system if it does not decomplect. You need to ensure that those components don't know about each other and still function properly.
00:03:41.200 Think about how you can decomplect your system because the only way to build a better system is by ensuring composability. Simplifying your system by creating several composable parts will often lead to more pieces, but each will be simpler and will compose in new ways you might not have realized possible.
00:04:10.000 As developers, we are infatuated with building tools and reinventing the wheel to make our lives easier. However, we must remember that we are not in the business of making ourselves happy; we are in the business of making our customers happy.
00:04:30.000 We spend too much time discussing constructs like programming languages, libraries, and tools. These constructs do not necessarily indicate that the final running system is better. They are useful, but let's not lose sight of the actual systems we run. Simple, in this context, tends to be objective, while easy is subjective, depending on our familiarity with it.
00:05:09.280 What I want you to take away is to think about the actual artifacts and how the technology choices you make affect the complexity of the final system. I’ll be around all week, so if you want to discuss this further, feel free to approach me.
00:05:40.000 Thank you!
00:05:47.440 I have an announcement: everyone who gave a lightning talk yesterday or will give one today or tomorrow can win an ebook from Prague Programmer. Please tweet the title of your lightning talk to @wrotelove.rb, and you might win a book.
00:06:14.400 Test, are you ready? Five minutes, you know? Okay, so I need to be very quick. This talk is about the Crystal programming language.
00:06:33.840 So what is Crystal? It has a Ruby-inspired syntax, is as efficient as Ruby when writing code, and as efficient as C when executing code. Crystal compiles to native code using LLVM, and while you can specify types for your variables or method arguments, it is not mandatory.
00:06:51.360 The code is evaluated during compile time, allowing you to catch some errors early rather than at runtime. The installation process is straightforward; based on your operating system, you simply run a specific command and get a nice binary to execute.
00:07:10.800 You can execute Crystal programs in two ways: on the fly, meaning you point to a Crystal program and execute it without generating additional artifacts, or by separating the process into steps.
00:07:33.919 Current status: Crystal is in a pre-alpha stage. While it is stable, it still requires improvements. Interestingly, the compiler for Crystal is written in Crystal itself, featuring a conservative garbage collector that is going to be replaced in the future.
00:08:05.120 Regarding Crystal versus Ruby, porting code from Ruby to Crystal is quite easy, while the opposite can be more challenging. Code written in Crystal behaves similarly to Ruby, and one of the benefits of compiling to Crystal is that you may uncover bugs during compilation that wouldn’t appear until runtime in Ruby.
00:08:38.800 However, there are limitations in Crystal. Incremental compilation is not possible, meaning if you change a type, you have to recompile everything from scratch. Currently, it's not a dynamic language; variable types are assigned after compilation.
00:09:16.480 Before getting into some code examples, here are some resources for deeper understanding of Crystal and its documentation.
00:09:38.880 Now, let's jump to some code. Here’s a naive Fibonacci implementation that calculates Fibonacci numbers, specifically the 36th number, in Ruby.
00:10:03.120 It takes about two seconds to complete. Let's try it in Crystal.
00:10:29.519 As anticipated, it runs much faster, demonstrating one of the primary benefits of Crystal over Ruby.
00:10:37.040 I can also show you another example, demonstrating attribute assignment in a constructor.
00:10:45.560 Thank you very much! Does this work?
00:12:01.440 Hello everyone! I’m Magik, here to discuss pagination in APIs.
00:12:07.120 In our production application, we initially used a simple approach: the client (in this case, an Android app) sends us a timestamp, and we return everything that's newer. This approach worked well until we encountered a situation where the client promised not to send large amounts of data.
00:12:19.120 As it turns out, the promise was broken; we ended up with over 10 megabytes of data, which posed significant challenges for the Android client due to its garbage collector limitations.
00:12:50.000 We began experiencing memory issues both on our Heroku server and on the Android client itself, which led us to realize we needed a pagination system.
00:13:11.360 While the simplest case involves using Kaminari with a constant page size, we encountered issues when items were deleted from the data.
00:13:30.960 For example, if the server initially returns a first page but an item is deleted, what is considered the second page may not contain data we intended to send.
00:14:10.080 To address this, we decided to leverage a timestamp to remember where we left off and continue pagination from there.
00:14:28.000 This approach allowed us to return a second page with a consistent set of data, even if some elements were deleted. The client sends us the first timestamp and the desired page size. Regardless of the deletions, we return the timestamp to the client to maintain sync.
00:15:09.120 Thank you!
00:15:39.120 Hi everybody, I'm Oscar Schreier from Ragnarzone. Today, I am going to talk about the ROM (Ruby Object Mapper).
00:15:57.040 ROM was created by Patricio Niza, who is not here today but is well-known in the community for his contributions. How many of you have used ROM or TRIOM? Not too many, I see.
00:16:19.520 Let me quickly address the common misconceptions: ROM is not the same as Active Record and it doesn’t implement the full Data Mapper pattern; it is focused on mapping.
00:16:54.720 The main components of a ROM setup include a mapper, relation, adapter, and commands. The adapter acts as a bridge between your application and the database, which could be SQL databases, CSV files, or YAML.
00:17:40.960 Commands are where you create, update, or delete data, and they adhere to the CQRS (Command Query Responsibility Segregation) principle. The mapper is crucial as it shapes your entire data structure rather than focusing on individual tables, while relations encapsulate your database logic.
00:18:03.040 Now, let's look at some examples. Here we have ROM set up with the memory adapter, allowing us to query by name to retrieve user data. It’s lazy-loaded, meaning you need to call it explicitly.
00:18:46.240 Using the relation, we can filter users by name or age and create new users effortlessly.
00:19:02.320 Thank you very much!
00:19:31.840 Hello everyone, I want to share how to crash Ruby.
00:19:44.320 How many of you think Ruby 2.x is production ready?
00:19:57.040 To demonstrate this, I'll show you some examples of issues you can encounter.
00:20:10.960 For instance, we can create a recursion with two variables named 'place' that reference each other. This should raise a stack trace exception.
00:20:23.760 Oops, and this is an issue that was reported five days ago.
00:20:32.960 Another example relates to BigNum; when we multiply it and expect a specific result, we end up with unexpected behavior.
00:20:48.640 In this demonstration, we see that the expected outcome is not met, which reflects an issue that was reported four months ago.
00:21:06.560 Yet another scenario involves using a hash with a default value leading to recursion when it tries to generate a default value.
00:21:31.760 For instance, if a method is invoked with a name parameter and we mistakenly use a string instead of a symbol, we run into errors as well.
00:22:01.760 It's crucial to stay cautious and keep Ruby updated to avoid these pitfalls.
00:22:15.760 Thank you!
00:22:23.760 Now, let's talk about React and react hot loader, which allows you to swap your JavaScript without losing application state.
00:22:43.760 Let's take a look at how it works with a simple React application.
00:22:57.760 When I change a component and hit save, it refreshes without needing to reload the entire application.
00:23:10.800 This feature is particularly useful for applications that need to function without an internet connection for extended periods.
00:23:38.560 For example, if you update your production code on the back end, you usually have to refresh to see the changes. With hot swapping, users don't need to refresh their applications, enhancing the user experience.
00:24:11.440 Thank you!
00:24:19.440 Finally, let's discuss software estimation, a common but often flawed practice in the development community.
00:25:00.160 Estimating tasks can become complicated once legacy code is involved. It’s a minefield where assumptions often lead to inaccurate estimates.
00:25:35.520 Software development is not simply about coding, but also a learning process, and learning cannot easily be estimated.
00:25:58.560 Learning tends to be nonlinear and can’t easily fit into a spreadsheet model.
00:26:25.760 Pressure can inhibit learning, and therefore it’s advisable to approach project timelines with that in mind.
00:26:40.960 Lastly, the development process includes not only coding, but significant amounts of waiting and decision-making, all of which can impact productivity.
00:26:54.080 Can we estimate this waiting or decision making? Often, these aspects are what bring projects to a halt.
00:27:05.920 Thank you for your attention!
00:27:18.880 Now let's shift gears and talk about PHP. If you've ever worked with it, you might know about Active Admin. Recently, a new library emerged that improves the customization process, bridging the gap between Active Admin and standard controller functionality. This library is modular, fully customizable, and easy to get started with, featuring a generator to create a basic controller.
00:37:48.000 Additionally, I'm excited to share another project: Code Quack, a platform for learning various IT technologies. This platform is akin to Codeacademy and Code School, providing interactive lessons directly in your browser.
00:38:14.000 Code Quack, which currently caters to Polish speakers, will officially start offering courses on April 15th, covering programming basics and SQL, among others.
00:38:35.000 If you have any questions, feel free to ask me. Thank you very much!
Explore all talks recorded at wroclove.rb 2015
+6