Re: sessions/cookies

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

 



On Jan 22, 2008 9:54 PM, Eric Butera <eric.butera@xxxxxxxxx> wrote:

> I realize this link I'm posting is called "auth"
> too, but that wasn't my choice.


that was kind of funny after your initial criticizm above, but to solars
credit,
its the auth 'package' so really the name isnt too bad, id say.


>  You can see that they have drivers so
> that authentication itself is a generic idea and you implement it
> against a specific thing such as a mysql users table or htpassword.
>

eric is totally right here; at a quick look at you code, i saw auth, ...
create user,.. database.. cookie; im thinking what exactly is going on here.
the general idea behind a class is to 'encapsulate' things that change into
a
little self-contained unit.  ideally the class doent know how the insides of
other
classes work, nor do other classes know how it works on the inside.  in
order
to realize this, you should strive for classes with a high degree of
cohesion.
http://en.wikipedia.org/wiki/Cohesion_(computer_science)
although there is no real metric for this concept, most people can grasp the
concept and have an idea when code has either a low or high degree of
cohesion.

if you want some advice on your class, i would start by breaking out the
CheckUserLevel(), and CreateUser() methods into a User class, you might
also consider a Session class.
if you want some advice on how to solve your problem here is my suggestion;
you need to isolate the behavior that is not working correctly.  this feat
becomes
difficult when you have lots of variable behaviors in one place.  break your
class
into pieces and test the pieces individually; once they all work
individually, then
they should work as a group without too much effort.  if that isnt working
(when
you get there) then the code that glues it all together is to blame.

-nathan

[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