This is the P2PU Archive. If you want the current site, go to www.p2pu.org!

PHP to objects and beyond

My recent threads

You haven't posted any discussions yet.

Recently updated threads

Week 1

Go back to: General discussion

Topic for week 1 assignments, questions and answers. Please post only pastie links if you have a lot of code. It is easier to read and to refer to exact line.

Matt Weeden's picture
Matt Weeden
Wed, 2011-02-23 08:23

Here's my first stab at the assignment, using furnace and air conditioner as the objects.
http://pastie.org/1596872
I think I hit on just about every point from the reading, except for the private properties/methods as I wanted to reuse elements from furnace in ac. I kept the $temp variable outside of the objects, as in real life temperature is an ambient thing and not tied to a particular appliance :)

Bienvenido Del Rosario's picture
Bienvenido Del Ro...
Thu, 2011-02-24 17:28

This week's assignment: http://pastie.org/1602457
I'm excited because it's all clicking into place, the article is very clear and easy to understand.

I used a person / student analogy I think it fits nicely.

Ville Viklund's picture
Ville Viklund
Thu, 2011-02-24 20:04

http://pastie.org/1603000

I went with a modified car idea. I also tried a thing my friend told me(can be seen at set-methods and on lines 103 and 104). I had trouble of finding "real life" useful idea, but I think I got the point.

Tibor Soviš's picture
Tibor Soviš
Sat, 2011-02-26 00:42

FlashLight: http://pastie.org/1607768
I don't know if I use Inheritance the right way.

It's hard to pick simply-enough real world object for this assigment. I think there are 2 types of objects:
1. Objects with properties only, for example: apple, battery, paper. For this objects i can do only get/set methods for getting/changing state of object (apple is green, battery is empty).
2. living objects or objects with some controls, for example: dog, mobil, elevator. This objects can DO something.

What do you think about this?

rojan sinha's picture
rojan sinha
Sun, 2011-02-27 01:43

http://pastie.org/1611322

Could not think of any "real life" example so i did some file handling stuffs. I have tried to follow Zend coding stander.

Alberto Rascon's picture
Alberto Rascon
Sun, 2011-02-27 10:47

Does this ( http://pastie.org/1612454 ) makes sense ?
Oh well, at least I had some fun coding it.

Enjoy "Pokenom battles" php style.

Vladimir's picture
Vladimir
Mon, 2011-02-28 23:47

Example from my life:)

http://pastie.org/1618362

Pavel Kostenko's picture
Pavel Kostenko
Mon, 2011-03-07 19:14

Finally done my assignment #1.
It's a classes to work with html tags
http://pastie.org/1643830

I've also created single html page with TOC about Zend Framework Coding Standard (http://pastehtml.com/view/1dj918o.html). All texts was taken from http://framework.zend.com/manual/en/coding-standard.html . I've done it to read on my kindle.

abdallah dorra's picture
abdallah dorra
Tue, 2011-03-08 09:05

here is my assignment for week 1,
http://pastie.org/1642920
i think that the material is not enough to give u a good idea about php classes if any one knows any good links that explain more about classes that would be helpful