ColdFusion 9 Developer Tutorial
上QQ阅读APP看书,第一时间看更新

Chapter 2. Basic CFCs and Database Interaction

All of the major software platforms have different forms of objects. In ColdFusion, these are called ColdFusion Components (CFCs). CFCs let us package up and reuse code in ways that will make our development much easier. Our approach in this book will be to learn by doing. In this chapter, we will learn by building the start of a simple shopping system. We will also learn to work with databases. Let's start learning the easier way to write software with CFCs. The following is a list of the contents that will be covered in this chapter:

  • The ColdFusion object called CFC
  • Making objects/CFCs come alive with methods
  • The difference between a class and the objects created from the CFC
  • Using an object constructor
  • Protecting the inner characteristics of objects with getters and setters
  • Connecting to a database through the internal methods of our object/CFCs
  • A variable structure called a "query", which is used to hold query recordsets
  • Controlling different types of variables returned from methods
  • Keeping our CFCs thread-safe, when multiple users are running the same code segments