GettingStarted
|
Getting Started With ColdBox
Important : This guide is based on ColdBox 3.1. Some of the code shown here will not work in earlier versions of ColdBox.
Assumptions
This guide is designed for beginners who want to get started quickly developing ColdFusion applications with the ColdBox Platform. However, it does expect you to have prior experience with the following topics:
- ColdFusion language and semantics
- ColdFusion Components (CFCs)
- ColdFusion ORM (Basics)
- HTML/JavaScript/CSS
- Any relational database system
If you need some guidance and best practices when developing ColdFusion applications, you might be interested in our theory, best practice guides and some external resources:
- ColdFusion Development Best Practices
- ColdFusion SQL Injection Protection Best Practices
- Database Naming Conventions
- Sun's Core J2EE Patterns Catalog
- Catalog Of Patterns of Enterprise Application Architecture
We would also recommend that you use Adobe ColdFusion Builder as your ColdFusion editor as then you can leverage our ColdBox Platform Utilities extension. Our official extension supports a wide array of functionality like: code generation, RESTful style generation, ORM based scaffolding generator, code introspector, integrated help, APIs, search and so much more. It will really accelerate your development and boost your introduction into the semantics and API methods available within ColdBox.
Now, since we have set the formalities behind us, in this guide we will investigate the basics of the Platform and get you trained enough so you can be well in your way to becoming a coding ColdBox ninja. So let's get started and start our training my young apprentice.
What is ColdBox
ColdBox is an event-driven, conventions based Object Oriented ColdFusion framework. It provides a set of reusable code and tools that are used to increase your development productivity, as well as a development standards for working in team environments. ColdBox is comprehensive and modular, which helps address most infrastructure concerns of typical and enterprise ColdFusion applications. We strive to make your applications easier to create, extend and scale thanks to our development guiding principles:
- Conventions Over Configuration: means we agree on specific contracts for file locations, method placements, etc instead of requiring you to specify endless configuration specifications on configuration files.
- Modular Architecture : ColdBox is built on the concepts of modular architecture and sports a wide array of best practices, tools and services to help you build applications using modules instead of a big monolithic application.
- DRY : "Don't Repeat Yourself" is a principle in software engineering targeted at reducing boilerplate or repetition of code. We encourage encapsulation and cohesive designs.
- RESTful Services : We encourage you to build applications that can be organized around resources and standard HTTP verbs, especially for exposing services to multi-faceted applications.
ColdBox also offers you several integrated tools and libraries apart from normal MVC concerns:
- Dependency Injection (DI)
- Aspect Oriented Programming (AOP)
- Enterprise caching
- Enterprise logging libraries
- Testing, Mocking, Stubbing and Integration Testing libraries
- Flex/Air/Web Services Integration
- HTML generation and JS/CSS asset management
MVC Architecture

MVC is a software approach that separates application logic from presentation. In its most basic form, a ColdBox application can be layered/divided into three layers: Model, View, Controller. The most important lesson in creating sustainable and object oriented applications using the MVC design pattern, is understanding that there are separations of concerns; separation of code, business logic and presentation data. This separation is key to a succesful transition into an object oriented framework and applying object oriented design & analysis. This separation brings in turn a decoupling or interdependency between layers/objects that help in creating more maintainable software. Your layers/objects become in fancy terms cohesive or tight, they do one thing and one thing right. I hope you are not shivering with fear by this point. Relax, object oriented analysis and design takes years to master and the best recipe is to learn and practice. So I will repeat this again, separation is key. You don't have to understand all the concepts like design patterns, MVC, domain model or all the fancy words all at once, I encourage you to keep reading, practicing and enjoying how to build better software. That is why you are here, to take it a step further.
Resources
- Model View Controller by Wikipedia
- Domain Model by Wikipedia
- Domain Driven Design
- Martin Fowler's Domain Model
MVC Layers
- The Model layer represents your data structures and business logic. The domain-specific representation of the information that the application operates on. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the Model. This is the most important part of your application and it is usually modeled by ColdFusion components. You can even do the entire model in another language or physical location (web services).
- The View layer is the information that is being presented to a user, in our case it can be HTML/XML/Raw. It can be used to build various views, composite views, layouts-view combinations, etc. ColdBox even has a layout manager to help you create easy to use applicaton/website layouts and render single or composite views. This layer uses the model data to present itself or change itself.
- The Controller layer serves as an intermediary between the Model, the View, and any other resources needed to process a request. In ColdBox, it processes and responds to events, typically user actions, and may invoke changes on the model or any other external feature of the web application. In ColdBox, a Controller is called an Event Handler
The ColdBox Universe
ColdBox has several internal frameworks and libraries that are part of the ColdBox Platform but can also be leveraged by any ColdFusion framework or application. Our internal frameworks are:
- WireBox - Dependency Injection and Aspect Oriented Programming (AOP) Framework
- LogBox - Enterprise ColdFusion logging library inspired by Log4J
- CacheBox - Enterprise ColdFusion caching engine, aggregator and API
- MockBox] - Mocking/Stubbing framework
Our ColdBox applications will deal with the following major concepts:

SideBar
User Login 



