Re: What is/is not considered to be good OO programming

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-07-2003
matty
 
Posts: n/a
Default Re: What is/is not considered to be good OO programming

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???
Reply With Quote
  #2 (permalink)  
Old 08-12-2003
Michiel
 
Posts: n/a
Default Re: What is/is not considered to be good OO programming

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???



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0