holidays / holidays

A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`use_case` namespace is vague

ppeble opened this issue · comments

When I originally started refactoring this gem I found that there were various 'use cases' that I couldn't fit into any other cubbyhole. In order to keep myself moving with the refactor I simply named the namespace UseCase and moved on. I still think this was the right decision at the time but now I am thinking about splitting up the various use cases and trying to find a better home for them.

The general idea I have for various namespaces is that each one has things like a 'context', 'repository', 'entity', 'validator', etc. If I follow that logic then I need a specific namespace for a use case like 'between', which might have its own entities and validators.

As I typed this out I think I kind of settled on that idea. Each 'use case' would have its own namespace. I'm not sure how it will play out but I think it makes sense. Let me get a PR together for discussion. In the meantime, if anyone has any suggestions for how to break apart the use_case directory please let me know! We can discuss it here.

PR that performs the initial refactor is here: #205

I believe I will close this out after that is merged and then submit a separate PR to totally kill the 'use case' directory. I will move the 'Between', 'YearHoliday', 'NextHolidays', etc use cases into their own namespaces and split out any logic (like validation) into sub-namespaces. Then we will no longer have the junk drawer approach to use cases. 😄

@ptrimble I agree with your thoughts. 👍

Closing this out since I merged the initial refactor. I will do the other work in a similar vein.