Saturday, December 11, 2010

Re: [android-developers] Re: Adapter fetches and parses RSS feed to get its data - best practice?

Interesting OOD question posed by the OP. If I understand the question correctly, I would say it depends
 
In Android, the Adapter interface is a contract with a class that extends AdapterView. This is noticably different that the Adapter Pattern, which generally mediates between two incompatible interfaces. However, It's not too unusual to have a class that is otherwise unrelated to a AdapterView go ahead and implement Adapter or ListAdapter instead of having to add an additional adapter class to mediate. A possible objection may be that if other clients wish to access the model-ness of the class in question, they would have to access it via the Adapter interface. This is, however, not necessarily a problem as the class can easily expose other model-ness interfaces or be itself a model.
 
As to "single responsibility", I think a more important aspect of OOD with respect to the design of a class is cohesiveness. It's a question of degree. A class that does two things that are unrelated or unconnected would be highly suspect.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment