SitePoint Sponsor |
|
User Tag List
Results 26 to 45 of 45
Thread: Why get/set methods?
-
May 19, 2004, 04:58 #26
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If he had provided a wealth of examples, he might convince me, but he doesn't.
Originally Posted by widowmaker
Once the design as settled, removing / rewriting dumb setters / getters that are redirecting data is probably a worthwhile exercise.Which is better off spent having some fun and relaxing over a few beers
-
May 19, 2004, 06:23 #27
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by pippo
Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 19, 2004, 06:49 #28
- Join Date
- Jul 2001
- Location
- Italy
- Posts
- 4,514
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think nominating Iraq was out the contest.
If you want we can discuss this by PM.
-
May 19, 2004, 07:16 #29
Originally Posted by dagfinn
Originally Posted by HarryF
Octal - All your base-8 belong to us
"Knowing is not enough, we must apply.
Willing is not enough, we must do." - Bruce Lee
-
May 19, 2004, 07:38 #30
- Join Date
- Apr 2003
- Location
- London
- Posts
- 2,423
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi
Originally Posted by Azmo
.
Originally Posted by Azmo
http://www.phplondon.org/wiki/BeerExample
The first part was written without mock objects and has the isDrunk() method. The second part, with the actual drinking, is a much more complete and clean expression of what the object does.
yours, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
May 19, 2004, 07:59 #31
- Join Date
- Jun 2003
- Location
- Elsewhere
- Posts
- 107
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by dagfinn
I do think that getters and setters are dangerous though, since they break object encapsulation.
Originally Posted by Allen Holub
), I do have a lot of respect for Andy and Dave.
-
May 19, 2004, 09:00 #32
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Azmo
But not in PHP 4. Everything is public, so if you use getters and setters, you'll get more encapsulation rather than less. It doesn't enforce encapsulation, though.
The real issue applies to PHP 4, though: not using the object's data outside the object if you can avoid it. The Tell, Don't Ask article is focused on the principle rather than the language implementation, which makes it more relevant to PHP 4.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 19, 2004, 10:42 #33
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by pippo
Just a suggestion.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 19, 2004, 12:06 #34
- Join Date
- May 2004
- Location
- New Jersey, USA
- Posts
- 567
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by dagfinn
You don't ask for much, do you?
=Austin
-
May 19, 2004, 12:09 #35
- Join Date
- Jan 2004
- Location
- Planet Earth
- Posts
- 1,764
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Now and again, we all get to the point where we really, really need to be explicit to get our own point of view across
Now and again, you get an administrator coming along, who feels they just have to censor a post, maybe because they can ?
Maybe they're bored ?
Maybe they think it'd be funny ?
Who knows, but it doesn't make it right.
Somehow
-
May 19, 2004, 22:35 #36
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Austin_Hastings
Like I said, it's just a suggestion. Think about it if you want. Otherwise, forget it. I don't think there's a need to argue about it.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 19, 2004, 22:49 #37
- Join Date
- Jul 2001
- Location
- Italy
- Posts
- 4,514
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Stop it to talk here about that Dagfinn, you are going to be off topic of this thread.
Please stay on topic.
I think you are smart enough to understand things, if you are not that's not my problem.
Further answers offtopic from you here will be removed.
This is not the right place to discuss about that.
-
May 20, 2004, 03:35 #38
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Azmo
Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 20, 2004, 05:39 #39
- Join Date
- May 2004
- Location
- New Jersey, USA
- Posts
- 567
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by pippo
I didn't see what was posted, so I'm not quite sure what Dagfinn did to put this particular bee in your bonnet. And since it happened some time ago, I don't care to know.
But he was responding to a comment addressed specifically to him from me, so I think it is you, not he, who are out of line here.
What's more, I (and probably some others) read your comment: "Further answers offtopic from you here ..." as a direct, punitive attack on Dagfinn.
I'm just as guilty, for speaking to him, as he is for answering.
I'd suggest that you provide a pointer to the "rules" and a citation of which "rule" was violated at any time you remove a post - it makes clear to everyone what happened. If there's no "rules" link to point to, then perhaps that is what Dag is talking about.
I looked around the forums, and I couldn't find a single place that seemed like "the right place to discuss this", which means either that: (1) SitePoint's policy is to prohibit discussions of this nature; or (2) this is equally as good (and equally as poor) a place for this discussion as any other.
=Austin
-
May 20, 2004, 05:54 #40
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Austin_Hastings
Apart from that, I've said all I need to say about this subject.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 20, 2004, 06:00 #41
- Join Date
- Jul 2001
- Location
- Italy
- Posts
- 4,514
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I was not going to punish anyone, it's not in my shoes.
I simply removed his comment that refers to Iraq.
I think nominating Iraq here is really out of context.
I edited that little part and make a note.
I also asked to continue the discussion by PrivateMessage if he was going to discuss about my action.
Eventually you can contact the admins here, the one marked in red, if you feel that I was rude, it was not my aim and I do apologizes if I acted like that.
Also the Suggestion and Feedback is another good place to share your thoughts, not this thread.
As I said I still think that mentioning Iraq was not a good thing,
that's the reason of my action.
I'm not going to punish anyone, I was only trying to redirect discussions about my action to another place, PM or the suggestion and feedback forum, just to keep this thread clean.
I really appreciated your efforts here,
I really appreciated dagfinn posts.
If I was not clear about my action, I'm sorry but you could have used PM to ask clarifications about that.
Maybe I should have contacted you by PM too in the first place.
Peace.
p.s.
Sorry if my English is far from to be professional and is far from to be easy to read, but that's me.
-
May 20, 2004, 06:13 #42
- Join Date
- Jul 2000
- Location
- Perth Australia
- Posts
- 1,717
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'd suggest that you provide a pointer to the "rules"
I find Sitepoint one of the least moderated and open forums I goto , 99/100 when a mod mods something its valid (e.g whatever was modded was going to lead the thread wildy OT of make for flames) , dragging it out by pretending you don't understand only makes you look daft , take it like a man
-
May 26, 2004, 01:37 #43
- Join Date
- Jun 2003
- Location
- Elsewhere
- Posts
- 107
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I came across a nice article by Gregor Hohpe today: The Dark Side of Encapsulation?
Originally Posted by Gregor Hohpe
-
May 26, 2004, 06:35 #44
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If you hold an apple in front of you, you're not hiding the apple. But if you hold the apple behind your back and say "I'm holding an apple behind my back", are you hiding it?
Probably not, but you could start lying at any time. That's the extent of "encapsulation" and "information hiding" provided by a getter method.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
May 26, 2004, 06:49 #45
- Join Date
- Dec 2003
- Location
- Arizona
- Posts
- 411
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by dagfinn
JT
Bookmarks