Page 1 of 1
1.5 | functions with just return; ??
Posted: Sun Feb 03, 2008 2:39 am
by Koeus
I'm trying to learn the Joomla API, kinda new to doing this and the lack of reliable documentation is not helping so I said screw it and i'll check out the api myself.
Maybe it's due to a lack of programming knowledge or something but when I come across multiple functions that look like this:
Code: Select all
/**
* Load the first row returned by the query
*
* @abstract
* @access public
* @return The first row of the query.
*/
function loadRow()
{
return;
}
I have to scratch my head and wonder where the heck is the code?
This example was taken from the JDatabase class.
Re: 1.5 | functions with just return; ??
Posted: Sun Feb 03, 2008 2:58 am
by CirTap
Koeus wrote:I have to scratch my head and wonder where the heck is the code?
it's in the class that extends this
abstract method:
class JDatabaseMySQL extends JDatabase
It might look strange in
PHP4 but would make sense if the code *was* written in PHP5 where classes can be defined as "abstract" to force the developer toimplement a certain interface to make sure nothing's missing. The above method in PHP5 would read:
abstract public function loadRow();
and no code inside.
That's OOP :-)
As a little rule of thumb: if there's a file in a folder named
foobar.php and there's a complementing
subfolder /foobar, then foobar.php is very likely an abstract class that's extended by the ones you find in /foobar/*.php
You'll see the same for table.php + /table/*.*, /session/storage.php + /session/storage/*.php and some others.
Oh, and at
http://api.joomla.org/li_Joomla-Framework.html you can indeed see the relationship of all the many classes; I woudn't call this "lack of reliable documentation" ;-) However, we're in the progress to improve this much further.
In any case: "
in dubio pro source code".
Have fun,
CirTap
Re: 1.5 | functions with just return; ??
Posted: Sun Feb 03, 2008 3:16 am
by Koeus
Thanks for the info!
I have a basic grasp of OOP and the 'abstract' notion is not somethin I think intuitively...yet.
p.s. the lack of reliable documention was geared towards the "tutorials" that was listed as 1.5 but written before stable and get various parts either wrong, or in a different way then could be done now, which leads to confusion when newcomers want to jump on the developer band wagon and are led to that unreliable documentation.
...still waiting for the fruits of the doc camp. Forgive me sternness in desiring quality over quantity
Open source = good. Open source without organization = confusion.
Re: 1.5 | functions with just return; ??
Posted: Sun Feb 03, 2008 2:07 pm
by CirTap
Koeus wrote:p.s. the lack of reliable documention was geared towards the "tutorials" ...
well, I think you're right about that and like the people who wrote them in their spare time, you're free to provide corrections.
Should someone find another free moment or the muse to fix it, I'm sure it's going to be fixed.
Koeus wrote:...still waiting for the fruits of the doc camp.
Doc Camp (and GHOP) resulted in several hundred new documents and fragments that now need to be reviewed and organized as well.
Koeus wrote:Forgive me sternness in desiring quality over quantity
Please read the first line of my signature: it applies to documentation, too
Have fun,
CirTap