Tech Is Hard

Credibility = Talent x Years of experience + Proven hardcore accomplishment

What Happened to my ID?

So far, User looks like

class User {
   public $id;
   public $DistCenter;
   function __construct($id) {
      $this->id = $id;

Now Foobar is unsetting $id, which could be fixed by swapping the lines in User’s constructor. But I don’t feel comfortable that this is the only public property I’m going to want to protect and I think the programmer should explicitly declare which properties should be handled by Foobar. I also know I want to use PHPDoc in a disciplined way to make these classes self describing.

Let’s create one for User::DistCenter.

 * Distribution Center
 * An object reference to $this User's distribution center object
 * @foo
 * @var DistCenter

The first line, the short description, will be used for labels and error messages. @var is a standard tag and the type DistCenter will be our class name for distribution centers. @foo is going to be our special tag.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: