Lately, I have been working on Web Service and API projects. During initial working process, I always thought whether I should use SOAP or REST. After done some research and learned by mistakes, I concluded that in most cases, SOAP is a better choice. Why? Because SOAP can handle complex operations more than just CRUD. REST, of course, can be used for non-CRUD operations. However, the use of HTTP method verbs creates barriers in the implementation.
Tuesday, April 8, 2014
Wednesday, April 2, 2014
The existence of Application.cfc is a huge enhancement over Application.cfm. Whenever feasible, always use Application.cfc. It provides methods, such as onApplicationStart(), onRequestStart(), onSessionStart(), onCFCRequest(), and so on. Understanding how the Application.cfc works is a bit confusing, especially when you come from Application.cfm. In this blog, I'd like to focus on how variables-scope behaves on the requested page when onRequestStart() and onRequest() are implemented.
We all know that any variables-scope variables defined in Application.cfm are available on requested page. Now, how can we translate this behavior to Application.cfc? Here's the answer. Variables-scope variables should be defined in onRequest(). If we defined in onRequestStart(), it would work as well. However, the variables would not be available on request page until onRequest() is implemented. In other words, any variables-scope defined in Application.cfc live inside until onRequest() is implemented.
BONUS: When implementing Application.cfc's native methods, don't add output="false". Simply omit it, unless you know what you are doing.
- Adding output="false" is equivalent to cfsilent, which suppresses contents generated by CF tags.
- Adding output="true" is equivalent to cfoutput, which evaluates expression between pound signs; and outputs other contents.
- Omitting the attribute outputs contents.