macx / google-plus-photo-album

PHP Class to fetch and cache a specific Google+ Photo Album.
MIT License
5 stars 2 forks source link

Consider factory pattern #2

Open 0x-r4bbit opened 10 years ago

0x-r4bbit commented 10 years ago

Hey there! :)

Just overlooked your code and was wondering, if would be cooler, to have a factory, that returns a photo album for a specific provider. So the syntax could look like this:

$album = AlbumFactory::getAlbum(array(
  "id" => ID,
  "user_id" => ID
));

Then you could have a much more appropriate API:

$album->getImage(id);
$album->getImages();
$album->getTitle();
...
..

What do you think? :)

macx commented 10 years ago

Thanks @PascalPrecht! This is indeed much smarter.

Before I will refactor the code I want to make it run: Implement caching and update the Readme with a easy to understand How To.

If you'd like to help, I would appreciate it.

0x-r4bbit commented 10 years ago

So how do you plan to implement caching? What kind of caching?

macx commented 10 years ago

In a first version file based, later I could image other caches like APC or DB. But that depends on people are using this Class.

0x-r4bbit commented 10 years ago

I opened an issue for that topic to not pollute this one.