Looking for some opinions/advice on how hkit should be developed
moving forward.
One of my goals with hkit was always to make the interface (and here I
guess I'm primarily talking about the output from a parse) easy to use
for a php coder of pretty much any level. I can recall countless times
when I've downloaded some library or other only to find that so little
thought has gone into designing the interface that it's easier to
write my own version than to figure out how to use the library. Partly
that comes down to documentation and tutorials, but also it comes down
to design and using the simplest thing possible.
This is why hkit outputs a simple array structure, and not a bunch of
oblique objects. Any novice can print_r() the output and understand
what they're dealing with. The other advantage is that it becomes
trivial to convert that array into json - something that is essential
to maintain.
That said, as we add more features to the parser, it becomes more of a
challenge to keep the interface simple.
I'm trying to figure out the best way to present the @rel values that
accompany a URL. At present, when an A element with the class of URL
is found (primarily hCard) the value is represented as:
[url] =>
http://example.com/
This is obviously very easy to consume. However, if there are
accompanying rel values we have nowhere to show those. Taking the next
leap, we could change the interface to represent URL as an array:
[url] => Array
(
[value] =>
http://example.com/
[rel] => Array
(
[0] => friend
[1] => coworker
[2] => met
)
)
The downside here is that for simple cases where $result['url'] would
have done, $result['url']['value'] must be used.
Am I worrying too much? I think the tradeoff of the extra complexity
for simple cases is worth it for the added utility. As hkit users,
would you agree?
drew.