Joe Haley Posted July 16, 2006 Share Posted July 16, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/ Share on other sites More sharing options...
hvle Posted July 16, 2006 Share Posted July 16, 2006 is there a good reason why should you concern about this issue?it's a script, run and exit, load and unload. Memory is not a big issue. Quote Link to comment https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/#findComment-58922 Share on other sites More sharing options...
Joe Haley Posted July 16, 2006 Author Share Posted July 16, 2006 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) Quote Link to comment https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/#findComment-58923 Share on other sites More sharing options...
hvle Posted July 16, 2006 Share Posted July 16, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/#findComment-58929 Share on other sites More sharing options...
Joe Haley Posted July 16, 2006 Author Share Posted July 16, 2006 Yes, but where would one stick the functions to encrypt and compare a password?And its not just this specifically, its generally. Is there some sort of rule of thumb, or just mess with it till it works and still makes sense? x) Quote Link to comment https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/#findComment-58931 Share on other sites More sharing options...
hvle Posted July 16, 2006 Share Posted July 16, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14761-question-about-oop-and-php/#findComment-58932 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.