start = Time.now heavy_operation() time_taken = Time.now - start
Have you ever written a code like that? I most certainly did. Turns out it’s all wrong. Why and how to make it better? Read and explanation by Luca Guidi, author of Hanami framework.
- Integer overflow is sooooo C, right? What if I told you it could affect Ruby and was fixed only recently? Read the whole story here.
- Rack::Reducer is a new gem to help you write queries with filters from query params applied. Designed for ActiveRecord, it can also be user with Sequel, Hanami, ROM etc. Here’s an introductory blog post about it.
- If you need to maintain communication between couple of microservices, chances are you’d use HTTP. And probably it’s not the best choice. There are many tools better fit for the job. One of them is gRPC from Google, based on Protocol Buffers. Here’s a tutorial on how to use it with Ruby.
- Wanna use value objects? (They told us that it’s a very first step towards DDD.) You may want to read a crowdsourced list of best practices when doing so.
- Bradley Schaefer talks about an antipatter we didn’t even know exists. But it’s there: The Local Variable Aversion Antipattern.