Hi guys! I've been digging into ideas of Domain-Driven Design for a while and decided to share one cool pattern that I found in book: "Domain-Driven Design: Tackling Complexity in the Heart of Software" by Eric Evans (The Blue Book). If you haven't read this book yet - do that. Twice. Because it's so hard to get all concepts first time :) In this book Eric Evans describes Specification pattern which can make application more flexible. Today we're going to learn how to implement it.

Let's take a break from long reads and discuss something that Ruby-developers use every day. We're going to discuss exceptions. At first sight exceptions in Ruby look as relatively simple concept. But there are couple caveats.

Hi. Today we're going to learn about UnboundMethod in Ruby and create Sinatra-like DSL. Ruby is so powerful that allows us to unbound method from class or module and bind it to existing object. I know that might sound a bit complicated, but it allows to create incredibly powerful features.

If you use Rails you could see and use class macros many times. For example we use it for defining associations in ActiveRecord models:

class User
  has_many :posts
end

has_many it's a class macro.

Hi! Today we have really interesting topic: Scope Gates and Flat Scope in Ruby. You will not use examples from this article in every day work, but it's really useful to know what Ruby allows to do with Scope.

Last week we discussed encapsulation and inheritance. Today we will discuss last part of basics of Object-Oriented Programming: Polymorphism.

Ruby - it's an object-oriented language. If we want to understand ideas that Matz put into Ruby - we should understand basics of object-oriented programming (OOP). In this post I'll cover encapsulation and inheritance. I'll devote separate post for polymorphism.

Recently I described how to use inject to solve relatively complex tasks in one-two lines of code.

Today I want to describe another useful method from Enumerable module - each_with_object.

Hey! In previous article we discussed blocks and today I'm going to describe lambdas and Procs. We will understand similarities and difference between them.

Today we're going to discuss simple but interesting topic. We will learn blocks by examples. We will understand what's block and how we can use it to create flexible apps.