Please view my design - Need Input

Mostly I just post tonight to get some feedback from some of you more experienced architects. I'm just starting to use interfaces more ... already seasoned and know the abstract classes that I used in some pretty good projects.

Anyway, I created hack UML here: uml.pdf

A few things about the chart:

All property that does not have (), which, of course, is a method

Everything is open, unless specified private

Fields or methods in blue highlight additional fields for a particular class in addition to interface members

I called MainPhotoUpload a factory because, as I see it, it works now ... at least, in my opinion, it is a factory, because it captures a specific instance of the service on APIType

→ The two gray classes just show you that there will be other Wrappers that I create later for other APIs such as Flickr and Picasa that will work in the same way ... implementing these core interfaces and using this template, I show here an example of Facebook .

→ The properties that you see in the service, for example, in FacebookFhotoService ... its FacebookAlbumPhoto property is an instance of FacebookAlbumPhoto, so I can start working with it. In other words, it creates an instance for me and exposes it as a property in FacebookPhotoService .... so I can use FacebookPhotoService. FacebookAlbumPhoto property to get an instance of FacebookAlbumPhoto and start calling methods or other members of FacebookAlbumPhoto. Thus, the service is only like a bridge, allowing you to use the base classes of the shell and start using them.

Ultimately the goal:

1) API, (Facebook, Flickr ..), Photo , .

2). API, , , , , Photo API. IPhoto, , Photo API,

3) -, APIn Facebook, (, FacebookAlbumPhoto ..), , , Facebook, , facebook . factory, . , - (, FacebookAlbumPhoto ..).

, , . 2 , , -.

, .

, uml:

1) , , - ? , , . , ... - (.. , )

2) ( 5 , ... , , , factory .., )

3), , : " ". , -- , , . / , , Photo API, , , , MainPhotoService.APIService, IAPIService, , , APIType MainPhotoService.

4) "factory"? , ?

, , , a) b), , , , ( ). .

- , . , ( , ).

+3
2

, , IApiService.

: factory ( ) IApiService, , IApiService , .

, , IApiService . , , IApiService (Facebook), FacebookAlbumPhoto FacebookProfilePhoto. FacebookPhotoService IApiService, .

, . , IApiService, . , IEnumerable<IPhoto> GetAllPhotos(), ( Facebook)... ( IPhoto, , re FacebookAlbumPhoto s, , ...)

, , , IPhoto GetProfilePhoto(), , , null ( - ). , IEnumerable<string> GetTags() IEnumerable<IPhoto> GetPhotosByTag(string Tag), , .

, , .

( , , 100%. Facebook-only 12 , , Facebook, , , . , , , , !)

0

Jaroslav - , IApiService.

(, # - ++ IPhoto, set/getProfilePhoto IApiService).

, Facebook, , (IPhoto, IApiSession ..).

, , , .

+1

Source: https://habr.com/ru/post/1758219/


All Articles