{"action":"created","issue":{"url":"https://api.github.com/repos/moneyphp/money/issues/256","repository_url":"https://api.github.com/repos/moneyphp/money","labels_url":"https://api.github.com/repos/moneyphp/money/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/moneyphp/money/issues/256/comments","events_url":"https://api.github.com/repos/moneyphp/money/issues/256/events","html_url":"https://github.com/moneyphp/money/pull/256","id":168615172,"number":256,"title":"different solution to subunit problem","user":{"login":"frederikbosch","id":1552577,"avatar_url":"https://avatars.githubusercontent.com/u/1552577?v=3","gravatar_id":"","url":"https://api.github.com/users/frederikbosch","html_url":"https://github.com/frederikbosch","followers_url":"https://api.github.com/users/frederikbosch/followers","following_url":"https://api.github.com/users/frederikbosch/following{/other_user}","gists_url":"https://api.github.com/users/frederikbosch/gists{/gist_id}","starred_url":"https://api.github.com/users/frederikbosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frederikbosch/subscriptions","organizations_url":"https://api.github.com/users/frederikbosch/orgs","repos_url":"https://api.github.com/users/frederikbosch/repos","events_url":"https://api.github.com/users/frederikbosch/events{/privacy}","received_events_url":"https://api.github.com/users/frederikbosch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-01T10:30:17Z","updated_at":"2016-08-01T13:29:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/moneyphp/money/pulls/256","html_url":"https://github.com/moneyphp/money/pull/256","diff_url":"https://github.com/moneyphp/money/pull/256.diff","patch_url":"https://github.com/moneyphp/money/pull/256.patch"},"body":"Instead of creating new objects like `CurrenciesSpecification` or `CurrenciesWithSubunit`, this solution adds functionality to `Currencies` and `Currency`. First of all: why this PR? I am not necessarily happy with PR #248. I still feel we are not there yet. Therefore I am trying different solutions. This should not be seen as how it must be, rather another shot at the problem. Maybe it contains something to continue on. Maybe it is crap.\r\n\r\nBut, here is why I think that this PR does contain some valid points.\r\n\r\n1. Our `Currency` is coming short in our domain. A subunit is a property of the currency and should be modelled as such. There should not be another object for it. So no `CurrencySpecification`.\r\n\r\n2. `Currencies` should - according to its description - 'provide a list of currencies'. But it is not. It only tells whether a currency is available within the context of the object. It is not *providing* a list. That is a problem. In my current applications every time I construct a `Money` object, I also construct a new `Currency`. Why? There is only one Euro or one US dollar currency. Hence my application should have one currency object per currency, not multiple. This implies that Currencies - because its responsibility is to *provide* currencies - should actually start doing that. This is what is achieved with the `find` method on the object. It returns a currency object and always the same object per currency code.\r\n\r\n3. But now `Currencies` has more than one method on its interface: that is multiple responsibility! I disagree here. Single responsibility does not imply that an interface should have one method. Of course, functional interface (those with one method) should be preferred over those with many methods. But in this case, the domain requires there to be more than one method. I compare it with [container-interop](https://github.com/container-interop/container-interop/blob/master/src/Interop/Container/ContainerInterface.php#L14). That is not a bad interface, is it? `contains` <-> `has` and `find` <-> `get`.\r\n\r\nMaybe you can shoot at the points I am making. Because I think we need some more iterations before we will find the solution we are looking for.\r\n\r\n/cc @sagikazarmark @pamil @Sharom "},"comment":{"url":"https://api.github.com/repos/moneyphp/money/issues/comments/236580399","html_url":"https://github.com/moneyphp/money/pull/256#issuecomment-236580399","issue_url":"https://api.github.com/repos/moneyphp/money/issues/256","id":236580399,"user":{"login":"frederikbosch","id":1552577,"avatar_url":"https://avatars.githubusercontent.com/u/1552577?v=3","gravatar_id":"","url":"https://api.github.com/users/frederikbosch","html_url":"https://github.com/frederikbosch","followers_url":"https://api.github.com/users/frederikbosch/followers","following_url":"https://api.github.com/users/frederikbosch/following{/other_user}","gists_url":"https://api.github.com/users/frederikbosch/gists{/gist_id}","starred_url":"https://api.github.com/users/frederikbosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frederikbosch/subscriptions","organizations_url":"https://api.github.com/users/frederikbosch/orgs","repos_url":"https://api.github.com/users/frederikbosch/repos","events_url":"https://api.github.com/users/frederikbosch/events{/privacy}","received_events_url":"https://api.github.com/users/frederikbosch/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T13:29:44Z","updated_at":"2016-08-01T13:29:44Z","body":"Updated the PR a little more. No more entity property on the currency. There is no real use-case for it other than meta data. The currency name however does have a use-case. I can image people wanting to render a currency list, so one should be able to [iterate over `ISOCurrencies`](https://github.com/moneyphp/money/blob/currency-extension/src/Currencies/ISOCurrencies.php#L71) and display the name of currency.\r\n\r\nBy the way @sagikazarmark, with this setup, there is [a default subunit of zero](https://github.com/moneyphp/money/blob/currency-extension/src/Currency.php#L23)."}}
{"actor":{"display_login":"frederikbosch"}}