199 reputation
7
bio website
location
age
visits member for 1 year, 11 months
seen Apr 8 at 8:40

Apr
8
answered How should one debug a PHP web application securely without exposing secrets to competitors?
Feb
22
comment Is it bad habit not using interfaces?
I enjoyed reading the quoted section, as well as what came before it.
Feb
22
comment Does it make sense to break fluid interface if a bad argument is passed?
I'm just thinking about the advantages/disadvantages. When you stop program execution you know for sure there's been an error without a doubt. But if I return $this no matter whether there was an error or not, then things keep rolling.
Feb
22
asked Does it make sense to break fluid interface if a bad argument is passed?
Dec
29
asked How to prevent re-checking already-checked data?
Nov
7
accepted How can a collection class instantiate many objects with one database call?
Nov
4
comment How can a collection class instantiate many objects with one database call?
I was using a lot of static methods for loading multiple objects. You don't have to use public setters. You can do one database call and load thousands of objects. If I use an object.loadFromDB(), then I have to call it on each one. The OOP solution would seem to be a collection class whose loadFromDB() method would achieve the same result. But then I have to make the setters of the base class public to everyone!
Nov
4
comment How can a collection class instantiate many objects with one database call?
The constructor is public, taking an integer $id to load the object from the db. I think the core of my problem is that I want to load multiple objects with one db query. I need something that can get the data, then instantiate a bunch of the target object. But how can I give a class that power without making methods public to every class?
Nov
4
comment How can a collection class instantiate many objects with one database call?
I'm experimenting with different methods of loading and right now I have several co-existing. All of my properties are non-public, but many classes have public get/set. Sometimes I havec onstructors that take a db id for existing data and 0/null to create new. Sometimes I have a static method that can save multiple data entities at once. Sometimes I have an object save() method. This is all still pretty new to me.
Nov
2
asked How can a collection class instantiate many objects with one database call?
Aug
24
answered Having a generic data type for a database table column, is it “good” practice?
Aug
24
comment Is it good/safe OOP practice to have a method whose only purpose is to send/retrieve data from another class?
Indeed I have run into problems due to my early use of table names. Are you recommending that I pass objects as parameters to other objects' methods, rather than strings/numbers? The "client" object could then use the parameter-object's methods to manipulate it or get data out of it?
Aug
24
comment Is it good/safe OOP practice to have a method whose only purpose is to send/retrieve data from another class?
Hi, sorry for the late reply. The removeWhitespace function in my example would go through a database table and remove the whitespace from every single column. I'm not sure if it would actually make sense for it to be in a utility class, which might have to work on plain strings, database tables, and database columns. What do you think?
Aug
24
accepted Why don't inherited methods use child properties? (PHP)
Aug
23
comment What are the advantages/disadvantages of using objects as parameters to other object methods?
So your distinction is between whether the instance uses the data/functions of an object of any class, or always of an object of a certain class?
Aug
22
asked What are the advantages/disadvantages of using objects as parameters to other object methods?
Feb
25
awarded  Caucus
Jan
30
awarded  Commentator
Jan
30
comment Is it a basic principle, or highly desirable, to have class methods that return “$this” rather than a value?
I understand Returning $this returns an instance of the object that the method is a member of. And in PHP OOP I believe, as I said in my question and you say in your answer, that the instance it returns is actually the very same instance as it is... i.e. it returns not a copy of itself but itself. If I am understanding correctly.
Jan
30
revised Is it a basic principle, or highly desirable, to have class methods that return “$this” rather than a value?
added php tag