This post originated from an RSS feed registered with PHP Buzz
by Alan Knowles.
Original Post: 19 VersionControl_SVN review 15
Feed Title: Smoking toooo much PHP
Feed URL: http://www.akbkhome.com/blog.php/RSS.xml
Feed Description: More than just a blog :)
a87
I've been having a little attempt revamping my subversion viewer, seeing if I can
Integrate it into the new site
Use VersionControl_SVN, rather than the quick hack I wrote, Subversion_Stream.
I have to admit, though, the API for VersionControl is not exacly clean and user friendly. This is a general overview of the gripes.
Uses PEAR_ErrorStack, which hides errors, even worse than PEAR_Error used to.. DataObjects uses a ErrorStack style system, you can print_r the dataobject, and it shows you the last error as a propery of the object... (simple).
Error stack seems to insist on you loading it, then only using it's methods to check stuff. - the actually error is hidden away in the stack object..
Trouble is, that a number of the functions in DataObjects needed to return true/false (fetch, for example), so returning an PEAR_Error, was problematic then (in hindsight, alot of the other methods should have returned PEAR_Error, but that broke BC - and in the future it should throw exceptions). So, DataObjects had some logical justification for messing with the standard a little, VersionControl_SVN hasnt really, and it just adds a dependancy on a eventually redundant package.
Trying to make things easy ending up with a messier API,
while this is cute, it adds an horrific amount of complexity to the API, and only saves you a little bit of typing, at the expense of clarity and readibility.
Counterintuative program flow.
class VC_SVN { .... function run() { ....... $this->prepare(); ....... exec in here.. ....... $this->parseOutput(); }
VC_SVN_List extends VC_SVN { ..... function prepare() {
So you call run on the base class, and the body of what happens is in the extended class. - so if you look at the 'action' classes, it is impossible to follow the flow of the application, without having a perfect memory of the base class..
it would have been far better to have a run method in each action class, and call some generic methods from the base class.