Re: cvs: /php3 ChangeLog
| From: | Sascha Schumann | Date: | Wed, 24 Nov 1999 21:23:16 +0000 |
| Subject: | Re: cvs: /php3 ChangeLog | ||
| References: | 1 2 3 4 5 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-13089@lists.php.net to get a copy of this message | ||
On Wed, Nov 24, 1999 at 10:57:20PM +0200, Zeev Suraski wrote:
> At 22:24 24/11/1999 , Sascha Schumann wrote:
> > > I like the approach of simply removing the username/password from the
> > > hashed-details and always doing a change_user() on a pconnect. That
> > > shouldn't be hard to do and I will take a whack at it today.
> >
> > Urgh, another layer for a special version and more
> > precompiler directives... one day, someone should clean up
> > mysql.c.
> >
> > To see what I mean have a look at php3_mysql_do_connect(). It
> > should be at least split up into multiple functions.
>
> Well, I'm not sure where's your frustration comes from. Actually I do, but
> it's such a typical case of backwards compatibility that I didn't expect
> you to get upset by it.
I'm not upset, but I tend to prefer clean and readable code.
> It's as simple as that - we can decide to drop support for earlier versions
> of MySQL, or we can choose to have code that has compiler directives in
> it. You say it calls for dividing it to subfunctions?
> Perhaps, even though I personally don't think I agree.
The advantage of splitting a large function into multiple
functions would help in this case to
- avoid redundant code (i.e. you have the same code multiple
times to connect to the database)
- avoid massive use of preprocessor directives (i.e. have
multiple versions of the same "subfunction". The right one
can be chosen by a preprocessor directive. That frees the
main function of dozens of directives.)
Quoting Zeev Suraski:
"I'll refamiliarize myself with my old code [...]"
If the author of the code needs to "refamiliarize" himself
with his code, the code cries for a rewrite. Just imagine how
lost someone completely unfamiliar with the code will feel.
--
Regards,
Sascha Schumann
Consultant