The implementation with metaprogramming just does not apply in here anymore, but we still are checking wheter the @user is nil or not.

The challenge in here is to remove the if statements that are checking is the @user variable is not nil.

This is a very common problem which can be solved really nice and smooth. But I'll let you think about it for just a sec.

Solution

In order to solve this problem and keep sanity on our code, I found out a pattern which turns out to be really helpful, the Null Object Pattern, which is few words is an object that provides some default behavior.

We need to remove the if statements from the JobTitle class and make it look something like: