Skip to content

u/somerandomtext

In this archive from Jul 2011 to Feb 2013

3
posts
15
comments
0
media
82
score

Top posts

Keeping up with the times

I'm looking for some . . . direction. Let me give you my situation. I'm an amateur PHP hobbyist, nothing close to a professional developer, and I doubt that I will ever get involved programming in PHP full time. That said, I am an office worker, and I find my skills in PHP (let's call them "intermed...

38 points18 comments
Open on Reddit

Some Questions Regarding OOP in PHP

I’ve got some questions about transitioning to OOP design for a website with, of course, dynamically generated content. I’ve been reading a lot about frameworks and MVC design, and I’ve read a few tutorials, such as the one for CodeIgniter and a couple for Symfony. I’m in the process of reorganizing...

1 points14 comments
Open on Reddit

Top comments

Well, thanks, I really appreciate that. It's difficult to assess one's skill level relative to the general php community, particularly when working in isolation, more or less. I've recently been trying to reach out and connect more. Maybe I'm more advanced that I realize, but there sure is a lot to learn out there.

10 points

Yeah, it's kind of an adjustment to realize that I can use something without trying to fully understand it in every detail. Like that Zend Gdata library I'm using. I understand it well enough to get the results I want. But I'm not an expert in it . . . but it's still quite useful.

2 points

No insult taken. And, I think you're right . . . it's nice to have the freedom to code in one's own style. But at some point, you want to use the utilities that other people have created, and you've got to understand their dialect. That's exactly what got me started down the road of trying to understand OOP.

2 points

This was a very useful answer, and I really appreciate you taking the time to provide some help. I've got a quick follow-up question (obviously from a novice perspective).

In your Person class, you have methods designed to set or get each of the various properties. Why not simply make those properties public and just access them like so?

$person = new Person;    
$whatever = $person->id;

It seems like all of the "extra" methods would be unnecessary overhead. That said, I know what you're showing me is standard practice. I've seen it in two of the books I'm studying. But the books don't explain why it's done that way.

(Couple of edits for clarity and formatting)

2 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.