Jump to content

Recommended Posts

Im wondering where to draw the line of "make it its own object / class"

Like with the user system im making:

Got your class "user", with propertys to define things like his username, and methods to do things like log him in and out.
Should password be its own class? (as one wants to encrypt and compare passwords, and functions would be the way to go for that.)

How much overhead is created by making nearly everything into objects? (for the purposes of abstraction, and a fancy "OOP PHP Programer" on the ol' resume)

Is it worth, in your oppinion, to do such things?
Link to comment
https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/
Share on other sites

Memory isnt so much an issue as the time it takes the compiler to deal with objects as opposed to variables. (small, i know. But stuff adds up...)

And beyond the overhead, look at it from a design standpoint.

(im relativly new to complex system design)
first of all, this user object is store in server, via session, so, user had no way to access this object.  Suppose the password is a member var of this user class, the password should already encrypted.  I don't see any reason to make an own class for password.
If you're familiar with OOP, it'll just be very similar in PHP.

you can create a member function for user class to compare the password.
yeah, you have to went thru the same encryption mechanism.  Normally, we used md5 hashing.  If you still feel unsecure with md5, you can add a salt.  Yes, PHP took care most of the complex works.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.