Hi, all and cheers to the community!
I have a question about class design. In many-many sources I saw
something like this:
Nothing special, but the one thing. If we introspect #initialize method
itself, we will see it’s private:
Ship.private_methods.include?(:initialize) # => true
Thus, Ship#initialize is already private even if we don’t use private
keyword at all.
So, my next idea - put #initialize method under the private keyword:
Why do this? Because (IMO) we get more clear class definition:
I use this definition about a few months. At the start it was a little
weird, but now I find it very helpful, cause when I looking into the
class, I immediately see API and only API. Constructor method
#initialize goes right after private keyword and I know where to find it
So, what do you think about this approach?
Thanks for answers.