{"action":"opened","issue":{"url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/88","labels_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/88/comments","events_url":"https://api.github.com/repos/android10/Android-CleanArchitecture/issues/88/events","html_url":"https://github.com/android10/Android-CleanArchitecture/issues/88","id":120419491,"number":88,"title":"Where is the best place to validate the data?","user":{"login":"risayew","id":2446408,"avatar_url":"https://avatars.githubusercontent.com/u/2446408?v=3","gravatar_id":"","url":"https://api.github.com/users/risayew","html_url":"https://github.com/risayew","followers_url":"https://api.github.com/users/risayew/followers","following_url":"https://api.github.com/users/risayew/following{/other_user}","gists_url":"https://api.github.com/users/risayew/gists{/gist_id}","starred_url":"https://api.github.com/users/risayew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/risayew/subscriptions","organizations_url":"https://api.github.com/users/risayew/orgs","repos_url":"https://api.github.com/users/risayew/repos","events_url":"https://api.github.com/users/risayew/events{/privacy}","received_events_url":"https://api.github.com/users/risayew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-04T15:07:30Z","updated_at":"2015-12-04T15:07:30Z","closed_at":null,"body":"In order to load the model in a view i have to check the data for some preconditions. For example, for some string color value(\"#ffffff\"), which is coming from backend, we have to check it if its not null, then parse it with Color.parseColor(). Where is the best place to put such code like this?\r\nIs it a good idea, if i define the presentation layer model's backgroundColor propery as Color and perform checks/transformation from String (domain layer object) to Color (presentation layer) in the  model data mapper in the presentation layer?\r\n\r\n-----------------------\r\nDOMAIN LAYER\r\nObject {\r\nprivate String mBackgroundColor;\r\n}\r\n\r\n-------------------tranformation ---\r\n\r\nPRESENTATION LAYER\r\nModel {\r\nprivate Color mBackgroundColor; \r\n}\r\n\r\nOr maybe validation code have to be a part of the buisiness logic but for transformation in the presnetation layer from String to Color i just call \"trusted\" Color.parseColor().\r\n\r\n"}}