Closed roback closed 5 years ago
I don't remember if there was the reason to why we have two similar classes though.
Don't think so. Nice find :)
However, I think one could instantiate a BasePublisher
now and it would actually do something? Not sure if that is desirable? Maybe a design based on modules could work out better
However, I think one could instantiate a
BasePublisher
now and it would actually do something? Not sure if that is desirable? Maybe a design based on modules could work out better
I just thought of the BasePublished
as an implementation detail that no one else should use. I'm not quite sure what happens if someone uses it actually. Maby it's possible to use private_constant
, but I don't think it'll work in this case.
Haven't even considered using modules, but it's worth a try.
I just thought of the
BasePublished
as an implementation detail that no one else should use.
Hehe yes, I just came to think about it. In other languages you can mark the class as abstract
to avoid that.
Maby it's possible to use
private_constant
, but I don't think it'll work in this case.
Apparently it does work :)
twingly-amqp mattias$ bundle console
irb(main):001:0> Twingly::AMQP::BasePublisher
NameError (private constant Twingly::AMQP::BasePublisher referenced)
Don't think we have to add it though.
There's not much difference between using a module and a base class. Don't think one is better than the other, so I think we can go either way.
I kind of like it, if module is renamed BasePublisher
-> Publisher
Sure, lets go with a module then
Was trying to fix #71, and noticed we had to do the same thing in two places, so I extracted the methods to a base class instead.
I don't remember if there was the reason to why we have two similar classes though.