Video Gallery provider classes

2 views
Skip to first unread message

Robert Impey

unread,
Oct 7, 2009, 10:43:49 AM10/7/09
to Haddock CMS
I noticed that classes for individual web video providers are being
written. Is this a good separation of functionality and data? How do
the various web video providers differ? Might it not be simpler to
have one PHP class and get the information for the different web video
providers from a data file?

Rob

Saul

unread,
Oct 8, 2009, 9:33:54 AM10/8/09
to Haddock CMS
While there aren't many different providers, it is perhaps a strange
system to have a class for each one.

The thing is, I need these classes to interface with the different
providers in several different ways ( to embed their videos, to offer
direct download if available, to construct links in their own URL
format etc.)

I don't yet know all of the ways I'm going to interface with them, nor
in which ways they are going to differ, so I've started with assigning
classes. The actual providers are looked up in the database and the
class name for each provider is stored there. As all the classes
inherit, I'm working towards having just one or two provider classes
rather than one for each website by moving code up when it's
refactorable.

So, they're kind of a temporary crutch. But real work is done in some
of them (like constructing link URLS using unique regex and the
video_id) , and until the code has been highly refactored, it would be
very confusing to do this work based on data files.

Does that make sense? Or could you see an easier way to do it? I'm
sure I am, as always, too close to the problem.

Saul

PS.

Do you see any licensing problems? I'm pretty sure there isn't any
licensed code in these classes.... just html and URL structures.

They could go in a project-specific or a CLWD specific plugin if
necessary of course. But as the VidLibrary works now, it makes sense
to include them if we can.

Robert Impey

unread,
Oct 8, 2009, 9:55:49 AM10/8/09
to haddo...@googlegroups.com
2009/10/8 Saul <saulh...@gmail.com>:
>
> While there aren't many different providers, it is perhaps a strange
> system to have a class for each one.
>
> The thing is, I need these classes to interface with the different
> providers in several different ways ( to embed their videos, to offer
> direct download if available, to construct links in their own URL
> format etc.)
>
> I don't yet know all of the ways I'm going to interface with them, nor
> in which ways they are going to differ, so I've started with assigning
> classes. The actual providers are looked up in the database and the
> class name for each provider is stored there. As all the classes
> inherit, I'm working towards having just one or two provider classes
> rather than one for each website by moving code up when it's
> refactorable.
>
> So, they're kind of a temporary crutch. But real work is done in some
> of them (like constructing link URLS using unique regex and the
> video_id) , and until the code has been highly refactored, it would be
> very confusing to do this work based on data files.
>
> Does that make sense? Or could you see an easier way to do it? I'm
> sure I am, as always, too close to the problem.
>

As a general rule, I always think that it is better to do the simplest
thing that will work first. Once you have the system working, you will
have plenty of time to refactor the code into something terse and
efficient. Premature optimization is the root of all evil, and
refactoring is a form of optimization. Trying to write code that will
solve the general case before you have solved a few examples of
specific cases is a mistake.

The classes system that you are using seems like a fine solution.

> Saul
>
> PS.
>
> Do you see any licensing problems? I'm pretty sure there isn't any
> licensed code in these classes.... just html and URL structures.
>

I doubt there are any licensing problems with linking to the site. You
might need to check the various sites' terms and conditions with
regard to embedding video.

Using the site's name in the class name, even if there is a trademark,
might be fair use.

I'm not an expert on these issues.

> They could go in a project-specific or a CLWD specific plugin if
> necessary of course. But as the VidLibrary works now, it makes sense
> to include them if we can.
>

I think that putting them in the plug-in is the best place for now.
They are more likely to be reused there.

I think that it would be overkill to create a plug-in for each
provider. That might be an idea if there are millions of them.

> On Oct 7, 9:43 pm, Robert Impey <robert.im...@gmail.com> wrote:
>> I noticed that classes for individual web video providers are being
>> written. Is this a good separation of functionality and data? How do
>> the various web video providers differ? Might it not be simpler to
>> have one PHP class and get the information for the different web video
>> providers from a data file?
>>
>> Rob
> >
>



--
Rob Impey
Reply all
Reply to author
Forward
0 new messages