Re: Script ID?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 21, 2011 at 5:14 PM, Peter Lind <peter.e.lind@xxxxxxxxx> wrote:

> On 21 May 2011 18:05, Stuart Dallas <stuart@xxxxxxxx> wrote:
> > On Sat, May 21, 2011 at 4:57 PM, Peter Lind <peter.e.lind@xxxxxxxxx>
> wrote:
> >>
> >> On 21 May 2011 17:34, Stuart Dallas <stuart@xxxxxxxx> wrote:
> >> > On Sat, May 21, 2011 at 4:24 PM, Peter Lind <peter.e.lind@xxxxxxxxx>
> >> > wrote:
> >> >>
> >> >> On 21 May 2011 17:18, Stuart Dallas <stuart@xxxxxxxx> wrote:
> >> >>
> >> >> *snip*
> >> >>
> >> >> >> Again, this depends upon what your url scheme looks like - and
> >> >> >> without
> >> >> >> knowing that, there's simple no clue as to whether or not this is
> a
> >> >> >> good solution to the problem (though it might be a good solution
> to
> >> >> >> A
> >> >> >> problem).
> >> >> >
> >> >> > Again, I disagree. If you have an example of a URL structure where
> >> >> > this
> >> >> > would not work I'd love to hear it.
> >> >> > -Stuart
> >> >>
> >> >> Having to replace several times just in order to figure out the path
> >> >> to your script is pointless if you know the name of the script (which
> >> >> you always do - it's __FILE__ ) and you're using a one-to-one
> >> >> request-to-script scheme. Then just grab the part of the url up to
> and
> >> >> including your scriptname.
> >> >
> >> > Well, it would be basename(__FILE__), but that's beside the point. In
> >> > this
> >> > particular case, where the PHP filename is the last part of the URL,
> >> > that
> >> > will indeed work. However, as you have pointed out several times
> that's
> >> > not
> >> > always the case and I tend to write generic, defensive code rather
> than
> >> > make
> >> > assumptions.
> >>
> >> Not a bad habit. I would personally go with "let's either find out or
> >> make a decision" instead of wasting time on coding for situations that
> >> will crop up.
> >
> > Assumptions cost money, and if you haven't discovered that yet then
> you've
> > either not been in the software development game very long or you've been
> > lucky so far. Hold on to that feeling, cos you can't get it back when
> it's
> > gone!
>
> Assumptions and knowledge are two different things. If you haven't
> discovered that yet then you've either not been in the software
> development game very long or you've been doing things wrong so far. I
> suggest spending some time checking up on the difference.


You can't know everything, and anything you do know is only true as of right
now.

You can't control the future and all predictions you make are based on
assumptions, and if/when your assumptions turn out to be wrong it will cost
money. Trust me on that.

http://en.wikipedia.org/wiki/Defensive_programming

You do things your way and I'll do things my way. Best of luck to you.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux