This is a discussion on Re: What is/is not considered to be good OO programming within the PHP Language forums, part of the PHP Programming Forums category; Tony Marston wrote: <snip> > $rows_per_page (to set the page size) > $page_no (to request a particular page ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Tony Marston wrote:
<snip> > $rows_per_page (to set the page size) > $page_no (to request a particular page number) > $lastpage (returns the highest possible page number) > > which he considers to related to formatting rather than the data > itself, and as such is *bad* programming. I'd agree, and say that he's using the output buffer of the canal. I've got something similar, although I have a subclass for paged output, but much the same kind of thing. Apart from nicer presentation, paging the results allows you to reduce communication with the database server; if you insist on returning the entire result set from the query, and *then* choosing a subset of it from the PHP code, you introduce an unnecessary layer, which can be done away with entirely by using "LIMIT x, y" in the query. I think you've done it the right way (but then I would, 'cos I have too!) > 5) It is simple and it works, therefore it cannot be all that bad. > > Do you people out there in PHP-land have any opinions on this matter? > Is this critocism justified or not? Definitely unjustified. Is he a first-year S/W Eng student by any chance??? |
|
|||
|
matty wrote:
> Tony Marston wrote: > > <snip> > >>$rows_per_page (to set the page size) >>$page_no (to request a particular page number) >>$lastpage (returns the highest possible page number) >> >>which he considers to related to formatting rather than the data >>itself, and as such is *bad* programming. > > > I'd agree, and say that he's using the output buffer of the canal. > > I've got something similar, although I have a subclass for paged output, > but much the same kind of thing. > > Apart from nicer presentation, paging the results allows you to reduce > communication with the database server; if you insist on returning the > entire result set from the query, and *then* choosing a subset of it > from the PHP code, you introduce an unnecessary layer, which can be > done away with entirely by using "LIMIT x, y" in the query. AND make it mysql dependent. The LIMIT clause is not widely supported. Besides, mysql will most probably allocate the whole result set and return only part of it, so it doesn't matter all that much. > > I think you've done it the right way (but then I would, 'cos I have too!) > > >>5) It is simple and it works, therefore it cannot be all that bad. >> >>Do you people out there in PHP-land have any opinions on this matter? >>Is this critocism justified or not? > > > Definitely unjustified. Is he a first-year S/W Eng student by any chance??? |