I'm basically just posting tonight to get some feedback from some of you more experienced architects out there. I'm just starting to get into more use of Interfaces...already seasoned and know Abstract Classes which I've used in some pretty slick designs of my own.
Anyway, I created a hack UML here: uml.pdf
A few things about the diagram first:
>> Everything is a property that does not have () which of course is a method
>> Everything is public unless specified private
>> The fields or methods in blue are highlighting the additional class specific fields in addition to the interface members
>> I named the MainPhotoUpload a factory because that's how I see this right now working...at least in my mind it's a factory because it's grabbing a certain service instance based on the APIType
>> The two grey classes is just showing you that there's going to be other Wrappers I create later for other APIs such as Flickr and Picasa which will work in this same way...implementing these core Interfaces and using this pattern I'm showing with the Facebook example here
>> The properties you see in a service such as for example the FacebookPhotoService ... its FacebookAlbumPhoto property represents an instance of the FacebookAlbumPhoto so I can start working with it. In other words it does the instantiation for me and exposes it as a property in the FacebookPhotoService....so I can use the FacebookPhotoService . FacebookAlbumPhoto property to get an instance of a FacebookAlbumPhoto and start calling methods or other members of FacebookAlbumPhoto. So the service is like just a bridge to allow you to utilize the underlying core wrapper classes and start using them.
Ultimately the goal is:
1) Create as much reuse as possible for all the API wrappers we create going forward (Facebook, Flickr, etc.) pertaining to Photo specific functionality which is the scope of this model
2) Enforce a pattern across any API we implement so that they'll all be somewhat consistent at least on the core members that you're going to see in any Photo API out there. e.g. IPhoto, and the rest of the interfaces denote common properties and methods that you'll see in any Photo API like these
3) A way to ultimately call the wrapper methods as well as to obtain the current session for that APIn or to get other Facebook objects by calling methods on those objects (e.g. FacebookAlbumPhoto, etc.). So for example with Facebook, I want to be able to call the facebook methods for a certain class or access properties of a certain class indirectly by using a service. The Main service acts as a Factory that goes out and gets the right service. Then you use that service to ultimately start calling methods and utilizing the underlying wrapper classes (such as FacebookAlbumPhoto, etc.)
So this is what I've come up with. You'll see on page 2, some examples of how I envision these will be used in code later on for our business logic.
This is not done of course.
I want to know specific to that uml I created:
1) Is my approach at least seeming somewhat logical, respectable, usable and makes some sort of sense here? to me it is but I want to see what some other architects think out there. I mean I'm not looking for perfection here...just something that's fairly flexible and for now works and allows me to get at various services and that the way I'm using these services makes sense (i.e. having properties in those services that expose instances of sub classes)
2) Any advice on improving or changing this without getting overly crazy (I don't need to know about 5 design patterns in how I can improve this...just give me some basic advice on interfaces, service classes like mine, or factory etc. that pertain to the scope of this)
3) Anything I'm just doing totally wrong that is just clearly "Never do that". For instance my fellow architect friend says I'm creating interfaces here but not really providing any value. However for me it's providing some value to enforce some consistency/pattern and ultimately reuse for base commonalities between any Photo API wrappers we create later as well as I am actually using those Interface types in other classes later on such as the MainPhotoService.APIService property which I have as type IAPIService because I don't know which service I'll return until I check the incoming APIType enum in that constructor of the MainPhotoService.
4) Is that really a "factory" pattern? Is my approach logical and clean and extensible?
Looking at this with respect to understanding that I am now just starting to get really into hard core architecture, if you were to use this code, would you a) like the pattern..or at least tolerable for now or b) have some issues with the way I'm retrieving or using a service or the way I'm getting instances of those underlying classes, or the way I'm using (my intent in using) Interfaces here.
if anything is not clear or missing here, please ask. I really don't have anyone else to bounce this off of (no dev teammates, and friends are too busy).