All This Object Stuff


All This "Object" Stuff

For many ColdFusion users, the object-oriented programming (OOP) model is foreign territory, perhaps ominously so. It's frequently considered an advanced topic. Why? Well, other OOP languages like Java are hard to understand, so you'd think the OOP model itself must be hard to understandright? Wrong. The reputation of object-oriented programming has little to do with the reality of its concepts. Yes, most OOP language implementations are far more complex than CFML, but the concepts behind OOP are actually quite natural and are part of what you do with ColdFusion already.

OOP is a way of developing applications around objects. Objects are not some arcane programming conceptthey are simply things. For example, let's look at some of what we know about the things in our movie studio application.

  • Actors and directors are people (despite the accusations of some with whom they've worked).

  • People have certain things in commonfor instance, they have a name, they are (presumably!) of one gender or another, and so on.

  • Not all of these characteristics are immutable. An actor's name certainly isn'tis it, Norma Jean? And, given enough cash and and a trip to Trinidad, Colorado, neither is a person's gender!

  • Films generally have one or more actors and one or more directors.

  • The movie studio can fire actors and directors and hire new ones.

We didn't need to have any special understanding of the film industry to make those assertions, did we? We certainly didn't need to know the details of, for instance, how an actor goes about getting cast in a role.

What we just created is really an object-oriented view of the application. There are objects (people, actors, directors, and films) and actions that can be taken on them (hiring and firing, casting, and the like). The application lets us perform those actions on those objects and do something with the result.



Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net