Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Pear
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-20-2007, 7:41 PM   #1
Mark Wiesemann
 
Mark Wiesemann's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default 1 class = 1 file?

Hi,

we have currently added a stream wrapper class for the CSV DataSource
driver for Structures_DataGrid. This class is used only for internal
purposes and won't be used by any user script, and it would therefore
make sense to put this class into the CSV.php file together with the
Structures_DataGrid_DataSource_CSV class.

I remember a "1 class = 1 file" rule, but can't find anything about it
in the manual. Do we really have this rule? Can somebody point me to it?

Regards,
Mark

--
http://www.markwiesemann.eu
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 05-20-2007, 7:41 PM   #2
David Soria Parra
 
David Soria Parra's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default 1 class = 1 file?

Am Sat, 12 May 2007 12:17:39 +0200 schrieb Mark Wiesemann:

I don't know if we have that rule, but PEAR.php itself has two classes
in one file. But this might be an exception.

If it is just for internal purpose it should be okay to include into one
file.



> Hi,
>
> we have currently added a stream wrapper class for the CSV DataSource
> driver for Structures_DataGrid. This class is used only for internal
> purposes and won't be used by any user script, and it would therefore
> make sense to put this class into the CSV.php file together with the
> Structures_DataGrid_DataSource_CSV class.
>
> I remember a "1 class = 1 file" rule, but can't find anything about it
> in the manual. Do we really have this rule? Can somebody point me to it?
>
> Regards,
> Mark
>

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #3
Lukas Kahwe Smith
 
Lukas Kahwe Smith's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

David Soria Parra wrote:

> If it is just for internal purpose it should be okay to include into one
> file.


There is no rule that mandates one class per file really. Personally I
have always gone by the rule 1 file file per public class.

regards,
Lukas
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #4
Mark Wiesemann
 
Mark Wiesemann's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

Hi,

Lukas Kahwe Smith wrote:
> David Soria Parra wrote:
>
>> If it is just for internal purpose it should be okay to include into one
>> file.

>
> There is no rule that mandates one class per file really. Personally I
> have always gone by the rule 1 file file per public class.


Yes, this makes sense, and this was also what we were thinking about.
Thanks for the quick replies.

Regards,
Mark

--
http://www.markwiesemann.eu
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #5
till
 
till's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

On 5/12/07, Mark Wiesemann <wiesemann@php.net> wrote:
> Hi,
>
> Lukas Kahwe Smith wrote:
> > David Soria Parra wrote:
> >
> >> If it is just for internal purpose it should be okay to include into one
> >> file.

> >
> > There is no rule that mandates one class per file really. Personally I
> > have always gone by the rule 1 file file per public class.

>
> Yes, this makes sense, and this was also what we were thinking about.
> Thanks for the quick replies.


I thought I read this somewhere in the CS when I started working on my
package. I also remember someone reminded me to put my Exception into
a seperate file. Maybe that was even you, Mark? ;-)

IMO and for clarity, it's one class per file. Having too many
exceptions to the rule just weakens the "standard". And maybe - if
it's not hidden somewhere already - this should be added to the docs.

Cheers,
Till
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #6
Mark Wiesemann
 
Mark Wiesemann's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

Hi,

till wrote:
> I thought I read this somewhere in the CS when I started working on my
> package. I also remember someone reminded me to put my Exception into
> a seperate file. Maybe that was even you, Mark? ;-)


Right, it was me and it was the (non-existing) rule that I thought about.

> IMO and for clarity, it's one class per file. Having too many
> exceptions to the rule just weakens the "standard". And maybe - if
> it's not hidden somewhere already - this should be added to the docs.


Well, the rule Lukas, David and (later also) I were talking about makes
sense IMHO. Only internally used classes would be put together with
other classes, public classes would still go into new files. Exception
classes are public and used by user code, and would therefore also go
into a new file.

If you want to have a written rule somewhere in the docs, you should
send an email to the PEAR Group. Adding a short paragraph to the docs
would be easy, but there needs to be a decision about the rule first.

Regards,
Mark

--
http://www.markwiesemann.eu
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #7
Greg Sherwood
 
Greg Sherwood's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

Mark Wiesemann wrote:
>> IMO and for clarity, it's one class per file. Having too many
>> exceptions to the rule just weakens the "standard". And maybe - if
>> it's not hidden somewhere already - this should be added to the docs.

> Well, the rule Lukas, David and (later also) I were talking about
> makes sense IMHO. Only internally used classes would be put together
> with other classes, public classes would still go into new files.
> Exception classes are public and used by user code, and would
> therefore also go into a new file.


If a rule like this were to be introduced (and I'd really love to see
something solid in the standards) then we'd need to have some way of
determining if a class is internal so that we can ensure that the
standard is being followed. In my experience a standard that is not
enforced, or hard to enforce, is going to be ignored.

I'd actually vote for one class per file no matter how the class is
intended for use at the time of release. I think it's a clearer standard
that is easier to follow because the developer doesn't need to decide if
the rule applies to them. Plus, you never know how your code is going to
be used in the future. Maybe those internal classes will be extended by
someone else, in which case they become public without your knowledge.

Greg
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #8
till
 
till's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

Hey,

On 5/13/07, Mark Wiesemann <wiesemann@php.net> wrote:
> till wrote:
> > I thought I read this somewhere in the CS when I started working on my
> > package. I also remember someone reminded me to put my Exception into
> > a seperate file. Maybe that was even you, Mark? ;-)

>
> Right, it was me and it was the (non-existing) rule that I thought about.
>
> > IMO and for clarity, it's one class per file. Having too many
> > exceptions to the rule just weakens the "standard". And maybe - if
> > it's not hidden somewhere already - this should be added to the docs.

>
> Well, the rule Lukas, David and (later also) I were talking about makes
> sense IMHO. Only internally used classes would be put together with
> other classes, public classes would still go into new files. Exception
> classes are public and used by user code, and would therefore also go
> into a new file.
>
> If you want to have a written rule somewhere in the docs, you should
> send an email to the PEAR Group. Adding a short paragraph to the docs
> would be easy, but there needs to be a decision about the rule first.


Don't get me wrong. I was not trying to bust on you. :-)

In general I am lazy and I tend to do all sorts of things when people
don't look (= classes are only used internally) and because I know
that I try to enforce rules on myself, my code and development which
essentially improves whatever the outcome is, or whereever it is used.

So instead of saying "this is internal", I am instead for one rule
which is applied everywhere, as opposed a lot of if's and when's.

Till
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 7:41 PM   #9
David Coallier
 
David Coallier's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default [PEAR-DEV] Re: 1 class = 1 file?

On 5/13/07, till <klimpong@gmail.com> wrote:
> Hey,
>
> On 5/13/07, Mark Wiesemann <wiesemann@php.net> wrote:
> > till wrote:
> > > I thought I read this somewhere in the CS when I started working on my
> > > package. I also remember someone reminded me to put my Exception into
> > > a seperate file. Maybe that was even you, Mark? ;-)

> >
> > Right, it was me and it was the (non-existing) rule that I thought about.
> >
> > > IMO and for clarity, it's one class per file. Having too many
> > > exceptions to the rule just weakens the "standard". And maybe - if
> > > it's not hidden somewhere already - this should be added to the docs.

> >
> > Well, the rule Lukas, David and (later also) I were talking about makes
> > sense IMHO. Only internally used classes would be put together with
> > other classes, public classes would still go into new files. Exception
> > classes are public and used by user code, and would therefore also go
> > into a new file.
> >
> > If you want to have a written rule somewhere in the docs, you should
> > send an email to the PEAR Group. Adding a short paragraph to the docs
> > would be easy, but there needs to be a decision about the rule first.

>
> Don't get me wrong. I was not trying to bust on you. :-)
>
> In general I am lazy and I tend to do all sorts of things when people
> don't look (= classes are only used internally) and because I know
> that I try to enforce rules on myself, my code and development which
> essentially improves whatever the outcome is, or whereever it is used.
>
> So instead of saying "this is internal", I am instead for one rule
> which is applied everywhere, as opposed a lot of if's and when's.
>
> Till
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


I could easily see one exception in that 1 class per file rule though.
Excepetions for instance..

<?php

class MyNewException extends Exception { }

class MyEvenNewerException extends MyNewException { }

class OtherException extends Exception { }

class PackageException extends PEAR_Exception { }

?>

Don't get me wrong, but php itself (not talking about caching) is not
*fast* at reading multiple includes. Doing one include where all the
execptions are is (imo) a gain of speed after many includes (instead
of doing require 'exceptionone.php' , require 'exceptiontwo.php', ....
Having one file called for instance Exceptions or better yet
Package_Execptions.php will be an easy gain of speed in general.

Anyhoo, I would also be in favor of seeing something like this in the
coding standards (which we are re-defining atm)

--
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
file recovery tool terry brian Operating Systems And Software 5 05-22-2007 7:15 PM
Calling PHP file David Cain PHP 5 05-20-2007 6:33 PM
How do I read a php file into a php program boombangabang PHP 2 05-20-2007 6:33 PM
Free FILE hosting modric Web Site Hosting 6 07-31-2006 12:15 PM
File Recovery Software FilleFolle Mac 0 07-31-2006 7:44 AM


Featured Websites




All times are GMT +1. The time now is 6:12 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98