Prev | Current Page 63 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

In any case, the presentation
tier is informed about the status and provides human-readable feedback to the visitor.
CHAPTER 2 ?–  LAYING OUT THE FOUNDATIONS 17
What??™s in a Number?
It??™s interesting to note how each tier interprets the same piece of information differently. For
the data tier, the numbers and information it stores have no significance because this tier is an
engine that saves, manages, and retrieves numbers, strings, or other data types??”to the data
tier this data is just arbitrary information, not product quantities or product names. In the
context of the previous example, a product quantity of zero represents a simple, plain number
without any meaning to the data tier (it is simply zero, a 32-bit integer).
The data only gains significance when the business tier reads it. When the business tier asks
the data tier for a product quantity and gets a ???0??? result, this is interpreted by the business tier
as, ???Hey, no products in stock!??? This data is finally wrapped in a nice, visual form by the presentation
tier, such as a label reading, ???Sorry, at the moment this product cannot be ordered.???
Even if it??™s unlikely that you want to forbid a customer from adding a product to the shopping
cart if the product is not in stock, the example (described in Figure 2-3) is good enough to
present in yet another way how each of the three tiers has a different purpose.


Pages:
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75