PHP Objects, Patterns and Practice (3rd edition)
C H A P T E R 6 ■ ■ ■ Objects and Design Now that we have seen the mechanics of PHP’s object support in some detail, in this cha ...
■Chapter 6: Objects and Design ................................................................................................. ...
CHAPTER 6 ■ OBJECTS AND DESIGN key1:val1 key2:val2 key3:val3 Then I'm told that the tool should support a simple XML format that ...
CHAPTER 6 ■ OBJECTS AND DESIGN Now I’ll address the same problem with some simple classes. First, I create an abstract base clas ...
CHAPTER 6 ■ OBJECTS AND DESIGN class XmlParamHandler extends ParamHandler { function write() { // write XML // using $this->p ...
CHAPTER 6 ■ OBJECTS AND DESIGN In the object-oriented version, this choice about file format is made in the static getInstance() ...
CHAPTER 6 ■ OBJECTS AND DESIGN Choosing Your Classes It can be surprisingly difficult to define the boundaries of your classes, ...
CHAPTER 6 ■ OBJECTS AND DESIGN Polymorphism Polymorphism, or class switching, is a common feature of object-oriented systems. Yo ...
CHAPTER 6 ■ OBJECTS AND DESIGN It is important to note that polymorphism doesn’t banish conditionals. Methods like ParamHandler: ...
CHAPTER 6 ■ OBJECTS AND DESIGN var $_touchezpas; Code had to be checked closely, of course, because privacy was not strictly enf ...
CHAPTER 6 ■ OBJECTS AND DESIGN Having said that, of course, I knew from the start that there would be text and XML implementatio ...
CHAPTER 6 ■ OBJECTS AND DESIGN Conditional Statements You will use if and switch statements with perfectly good reason throughou ...
CHAPTER 6 ■ OBJECTS AND DESIGN The class is divided into three sections, with the name displayed in the first. These dividing li ...
CHAPTER 6 ■ OBJECTS AND DESIGN Let’s take a close look at the attribute in the example. The initial symbol represents the level ...
CHAPTER 6 ■ OBJECTS AND DESIGN Figure 6–7. Describing inheritance The UML describes the relationship between an interface and th ...
CHAPTER 6 ■ OBJECTS AND DESIGN Figure 6–10. A unidirectional association If each class has a reference to the other, we can use ...
CHAPTER 6 ■ OBJECTS AND DESIGN Figure 6–14. Aggrgation Pupils make up a class, but the same Pupil object can be referred to by d ...
CHAPTER 6 ■ OBJECTS AND DESIGN Figure 6–16. A dependency relationship Using Notes Class diagrams can capture the structure of a ...
CHAPTER 6 ■ OBJECTS AND DESIGN Sequence Diagrams A sequence diagram is object based rather than class based. It is used to model ...
CHAPTER 6 ■ OBJECTS AND DESIGN message originator). Each message is labeled using the relevant method call. You can be quite fle ...
«
2
3
4
5
6
7
8
9
10
11
»
Free download pdf