For rails applications: does there exist a naming convention for naming your null objects that are mapped to model objects?
Example:
#app/models/blog.rb
class Blog < ActiveRecord::Base
end
#app/models/null_blog.rb
class NullBlog # Null Objects are POROs, correct?
def title
"No title"
end
end
# so to implement it I can do this:
blogs = ids.map{|id| Blog.find_by(id: id) || NullBlog.new}
# which allows me to do this and it works, even if some of those ids did not find a blog
blogs.each{|blog| blog.title}
Is NullBlog
conventional?
Neither this article by Avdi Grimm nor the Nothing is Something presentation by Sandi Metz mentioned any null object naming convention.