{"action":"opened","issue":{"url":"https://api.github.com/repos/octokit/octokit.net/issues/678","labels_url":"https://api.github.com/repos/octokit/octokit.net/issues/678/labels{/name}","comments_url":"https://api.github.com/repos/octokit/octokit.net/issues/678/comments","events_url":"https://api.github.com/repos/octokit/octokit.net/issues/678/events","html_url":"https://github.com/octokit/octokit.net/issues/678","id":54705984,"number":678,"title":"Immutable over ReadOnly.","user":{"login":"Zoltu","id":886059,"avatar_url":"https://avatars.githubusercontent.com/u/886059?v=3","gravatar_id":"","url":"https://api.github.com/users/Zoltu","html_url":"https://github.com/Zoltu","followers_url":"https://api.github.com/users/Zoltu/followers","following_url":"https://api.github.com/users/Zoltu/following{/other_user}","gists_url":"https://api.github.com/users/Zoltu/gists{/gist_id}","starred_url":"https://api.github.com/users/Zoltu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zoltu/subscriptions","organizations_url":"https://api.github.com/users/Zoltu/orgs","repos_url":"https://api.github.com/users/Zoltu/repos","events_url":"https://api.github.com/users/Zoltu/events{/privacy}","received_events_url":"https://api.github.com/users/Zoltu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-18T18:57:02Z","updated_at":"2015-01-18T18:57:02Z","closed_at":null,"body":"A recent commit changed many of the models to be ReadOnly.  I am a huge fan of immutability and this is a good step in the right direction.  I would encourage, however, immutability over ReadOnly because it asserts more about the contract between the library and the library user.\r\n\r\n```c#\r\npublic class Person\r\n{\r\n    public readonly String FirstName;\r\n    public readonly Int32 Age;\r\n}\r\n```\r\n```c#\r\npublic class Person\r\n{\r\n    public String FirstName { get; private set; }\r\n    public Int32 Age { get; private set; }\r\n}\r\n```\r\n\r\nIn the first case, the library is asserting to the user that the attributes of Person will not change.  In the second case, the library is only denying the user the ability to change the object, it is not guaranteeing that the library won't change the object out from under the user at some point.\r\n\r\nIn the case of Octokit as it stands now, the user can likely reason safely that the library isn't changing the object out from under the user.  However, as Octokit grows and further abstractions are created it becomes more and more difficult for a user to make such an assertion, which makes it difficult for the user to reason about their own code."}}