From: James R. <sj...@jd...> - 2005-11-30 22:43:45
|
Hi Richard, > > Yeah, the name sucks. I think the class should not represent a single > profile, but a method of getting author profiles. It's clear what the > implementation classes would be, things like PasswdFile, > MavenProjectFile, SourceforgeWebsiteScraper. Now find a good common > name for these. > > AuthorProfileSource? > AuthorProfileFactory? This sounds like the classic situation for a factory pattern. You could have the Factory as an abstract class with pretty much the single method public abstract AuthorProfile getProfile( Author a ); and then just subclass it and provide the correct concrete implementation depending on the command line options. Alternatively, you could it as a Factory which calls other factories. For example, AuthorProfileFactory may call all its "sub-factories" (PasswdAuthorProfileFactory) until it finds a factory which can give back a profile for the given author. This would allow StatCVS to source its author profiles from many different sources at the same time... Whether that's useful or not is another question... :) > > Imagine that profiles may provide other things except real names. > Email address, web link etc. There's no need to duplicate all these > methods on both the Author and Profiles class. Agreed. It was a silly suggestion on my part. > Also, I see no need why the Author class should know about the > existence of the profiles. I want the Author class to remain as close > as possible to the concept of a CVS login. We're discussing a > presentation issue, and changing stuff on the presentation layer > shouldn't affect the core CVS classes. Actually, the AuthorProfile shouldn't have anything to do with the presentation. How you choose to represent the author's profile is totally up to the presentation layer. AuthorProfiles should be concerned only with those things which make up an author's profile (like you said, an e-mail address, URL, etc). Presentation layer classes would merely need to call Author.getProfile() and then render that profile any way they like. > (Actually, the Author class should probably be called CVSLogin. My > suggestions may make more sense if seen from that point of view.) Ok, maybe I am thinking differently about the role of the Author class. > Richard > Regards, James PS. I'm now using StatCVS at my work, and the bossman likes it a lot ;) -- James Ring |