0%

Book Description

Break free from procedural programming and learn how to optimize your applications and enhance your skills using objects and design patterns

  • Fast-paced easy-to-follow guide introducing object-oriented programming for ColdFusion developers

  • Enhance your applications by building structured applications utilizing basic design patterns and object-oriented principles

  • Streamline your code base with reusable, modular objects

  • Packed with example code and useful snippets

  • In Detail

    Are you tired of procedural programming or is your extensive code base starting to become un-manageable? Breathe some new life into your code and improve your development skills with the basic concepts of object-oriented programming. Utilize objects, modular components, and design patterns to expand your skills and improve your ColdFusion applications. Packed with example code, and written in a friendly, easy-to-read style, this book is just what you need if you are serious about ColdFusion.

    This book is a fast-paced tutorial to important ColdFusion object-oriented programming topics. It will give you clear, concise, and practical guidance to take you from the basics of ColdFusion to the skills that will make you a ColdFusion developer to be reckoned with. Don't be put off by jargon or complex diagrams; read and see how you can benefit from this book and extend your development skills in the process.

    Using the practical examples within this guide, you will learn how to structure your applications and code, applying the fundamental basics of object-oriented programming to develop modular, reusable components that will scale easily with your application. You will learn the basic fundamental practices of object-oriented programming, from object creation and re-use, to Bean objects, service layers, Data Access objects, and sample design patterns to gain a better understanding of OOP using examples that can be altered and applied in your application. Complete with detailed code samples and snippets, and written in a friendly easy-to-follow style, you will be able to break free from writing purely procedural code and enhance your applications by building structured applications utilizing basic design patterns and object-oriented principles.

    An introduction to object-oriented programming in ColdFusion

    Table of Contents

    1. Object-Oriented Programming in ColdFusion
      1. Object-Oriented Programming in ColdFusion
      2. Credits
      3. Foreword
      4. About the Author
      5. Acknowledgement
      6. About the Reviewer
      7. Preface
        1. Who this book is for
        2. What this book covers
        3. What you need for this book
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Introducing ColdFusion Components
        1. Why use CFCs?
          1. Grouping your functions
          2. Organizing your components
        2. The ColdFusion component tags
        3. Our first component
          1. Defining a method
          2. Returning the data
            1. ColdFusion 9 scripted components
          3. Creating your object
        4. Restricting your functions to scopes
          1. Using arguments within your methods
          2. The Arguments scope
          3. Redefine the function parameters
          4. Combining your methods
        5. Protecting your local variables
          1. Using the Var scope
            1. Placing your Var scoped variables
            2. Naming your Var scoped variables
        6. Accessing your CFC
          1. Instantiating the object
            1. Using the createObject function
            2. Using the cfobject tag
            3. Using the NEW operator
          2. Using cfinvoke
            1. The cfinvoke tag
            2. Using cfinvokeargument
            3. Using attributes as arguments
            4. Using an argument collection
        7. Passing arguments into an instance method call
          1. As a list
          2. As named values
          3. As an argumentCollection
        8. Arguments in action
          1. Merging your functions into one
          2. Using cfargument to combine your methods
        9. Creating an object constructor
          1. Creating an init() function
          2. The Variables scope
          3. Calling your init() function
          4. The This scope
        10. Summary
      9. 2. Effective Component Development
        1. Pseudo-constructors
          1. Using the pseudo method
          2. Suppressing whitespace
            1. Output attribute
          3. Pseudo-constructor or init() method
        2. Returning values and variables
          1. returnType
        3. Access properties
          1. Private
          2. Package
          3. Public
          4. Remote
        4. Getting information about your CFC
          1. Introspection
            1. CFC Explorer
            2. Component Doc
          2. Document your code
            1. Benefits of documentation
            2. Displayname attribute
            3. Hint attribute
            4. Description attribute
            5. User-defined metadata
          3. Obtaining CFC metadata
            1. getMetaData
            2. getComponentMetaData
            3. Returning metadata
        5. Detailed introspection
        6. Summary
      10. 3. Building Your First Bean
        1. What is a Bean?
          1. But what is it really?
        2. The benefit of using beans
        3. Creating our first Bean
          1. An introduction to UML
            1. Person object in UML
          2. What makes a Bean a Bean
            1. A default/no-argument constructor
            2. Easily accessible for introspection
              1. Setters/Mutators
              2. Getters/Accessors
          3. Completing our Projects Bean
            1. Calling our project Bean
        4. Populating the Bean
          1. Read/Write Bean
          2. Read-only Bean
        5. Helpful objects
        6. Implicit accessors
        7. Summary
      11. 4. Inheritance and Object-Oriented Concepts
        1. What is Inheritance?
          1. Avoiding code duplication
          2. Inheriting our products
          3. The Super keyword
            1. Overriding methods
          4. Instantiating our products
        2. The inheritance hierarchy
          1. Specialization
          2. The "IS A" relationship
        3. Polymorphism
        4. Composition
          1. The "HAS A" Relationship
            1. Implied ownership
        5. Aggregation
        6. Summary
      12. 5. Data Access Objects
        1. What is a Data Access Object?
        2. Creating a Data Access Object
          1. The create method
            1. Storing a new user
          2. The read method
            1. Handling select results
          3. The update method
          4. The delete method
          5. An alternative save method
            1. The save method
            2. The exists method
            3. Caching the Data Access Objects
        3. Dependency Injection
        4. Summary
      13. 6. Gateways
        1. What is a Gateway?
        2. A typical ColdFusion Gateway
          1. Creating a Gateway object
            1. Naming conventions
          2. Adding gateway methods
          3. Minimising code duplication
            1. Revising the gateway object
            2. Caching the Gateway object
        3. The Gateway discussion
          1. No hard and fast rules
          2. Table Data Gateway
            1. Similarities to Data Access Objects
            2. Combining the two patterns
          3. Which option is best?
        4. Summary
      14. 7. Creating a Service Layer
        1. What is a Service Layer?
          1. Facade patterns in a nutshell
        2. Creating a service
          1. Defining the User Service
            1. Adding the CRUD methods
            2. Adding the Gateway methods
          2. Adding an abstract class
        3. Defining the address service
          1. onApplicationStart (revisited)
        4. Summary
    52.15.176.80