18.4. Building the Shopping Cart in Code
Most of the effort in this chapter involves writing code to create and hold shopping cart items. For this, you use object-oriented programming that involves designing your own objects and classes.
The sidebar "A tiny object lesson" offers a quick overview of objects. If the concepts don't resonate with you right away, don't worry; it takes time to get your head around these geeky things. Most of us have muddled through all this until at some point the explanations snapped into place. Just follow along and everything will crystallize eventually.
18.4.1. Defining a shopping cart item class
Somehow, you need to re-create in computer code something that resembles an item that you can put into a shopping cart. Fortunately, the people who wrote the Small Business Starter Kit defined an item in code for you. You can examine an item from two perspectives: the data and the schema.
A tiny object lessonAn object is a thingy, a whatchamacallit, a widget, or a thingamabob that sits in the computer's memory. These whatsits have characteristics (called properties), such as size, color, amount, and ID. The properties carry values, such as Large, Red, 25, and txtTextBox. Objects can also do stuff. They often contain pre-coded subroutines (methods in geekspeak), such as GrowLarge(), ChangeColor(), AddOneMore(), and Disappear(). Some objects resemble frozen dinners from the supermarket. They're cooked when you buy them but need some adjustment at mealtime, ... |
Get ASP.NET 3.5 For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.