So what is the polling? Webhooks When an event triggered, a function or api will be involved. Let’s say we have service A and we develop a function so every time A…
Inheritance vs Composition
What are the reasons for using Inheritance and Composition. Speaking of Inheritance, we refer to class, for Composition we refer to Module. We should know the main idea from this design. Why…
Improving performance using Enumerator::Lazy
One of the performance matter we usually encounter is Enumerator. Today, I introduce you a kind of performance issue we ever faced about enumerator. That’s Enumerator in ruby. The case is when…
Module in Design Pattern
Have you ever considered about using class inheritance or modules while coding? So, when do we decide to use inheritance instead of module? Coding design is just about arranging code in our…
Crucial steps of Object Oriented Design
The topic today is again Object Oriented Design. We just have three words O-O-D though. Naming I’d like to say that OOD is not just about Inheritance. When we put some classes…
Don’t mistake the global variables with attributes of object in OOD
I have to say that we tend to make the attributes of class become messy. Attributes are the characters to distinguish class from the others. These ones make them different. It’s like black…
Four Meta-Design Patterns in ruby
1. Separating out the things that change from those that stay the same. Obviously, we do it to avoid the tight coupled code, get it easy to make changes with less cost….
Solving problems by modeling objects
When we look at the reality or a situation in real world, what do we see? Now I’m sitting at a coffeeshop in Vietnam and look around. I’m seeing people who are…
Setting up test environment and testing Model using Rspec
Ruby on Rails and automated testing are going together, hand in hand. As many language programming, Rails has it’s own testing framework. It support automatically to create boilerplate test files. Yes, many…
Ruby hook methods – meta-programming
Hook methods is actually the convenient way to help us extend the behaviors of existing class at runtime. In rails there are many popular hook methods we often use such as “included,…