"A good head and a good heart are always a formidable combination."
- Nelson Mandela





Bye bye Waterfall, Hello Agile

Come Monday I'll be starting the envisioning phase of a 4 month project aimed to enhance the overall user experience in one of our flagship applications. I'm definitely excited about the project not only because there will be some really cool components to build but also because the project will be run using an Agile methodology. For the past several years I've been working on high dollar(long running), complex business apps that followed the Waterfall approach. Each of these projects adhered to the phases of your standard Software Development Life Cycle (SDLC) and at times seemed to drag on in the least exciting phases.

Agile development is definitely different than your traditional waterfall based project, not only from a structure point of view (phases and such) but also in it's principles, which are;

  • Individuals and interactions over processes and tools
  • Working software over comprehensive documentation
  • Customer collaboration over contract negotiation
  • Responding to change over following a plan


Surprise Presentation from a CF_Celebrity

Last week my work brought in a CF consultant from Universal Mind to help evaluate the performance of our flagship application and offer suggestions for improvement. On Tuesday this consultant was set up to give us a presentation on CFMX performance, and like most learning opportunities I attended the session. To my surprise, the consultant was Brandon Purcell... holy sh*t... I have been reading his blog for a few years now and regard him as being a CF rockstar along with the usual names.

Brandon was really cool and dropped some interesting tips on performance, some of which I had never considered before like using with an isolation level of read_uncommited to speed up SELECT statements. Of course this only applies to queries where the returned results don't have to 110% accurate as the drop in the isolation level will curtail around locks from INSERTs and UPDATEs. I never thought of using for anything other than managing 'atomic' transactions that included writing to the db.

Another interesting tip that he pointed out was the use of logging run time metrics directly to the screen but using HTML comments to hide them from the users. I think in non-MVC frameworks this would well and never really considered dumping runtimes to the display in a production environment, but I guess it's a quick way to see how well a page is rendering without going through hoops to get that info (in a large corp. environment where not everyone is privy to accessing production logs without waiting for someone else to get them for you).

Brandon had a ton of other great performance tuning tips, most of which I already knew about, but it was still cool to hear it from someone who has been around CF as long as he has. I really need to start going to more conferences and getting involved in some type of Users Group.


Working with Milliseconds in Coldfusion

Now that the development and SIT phases of my current project are coming to an end, I've been focusing on preparation for Performance and Load testing. The application that I've been working on was written in Java and runs completely behind the scenes, so using Mercury Loadrunner or some other load testing tool for metrics gathering was out of the question.

The approach that I decided to take was to write a tool in CF that would parse the log files produced by the application (via log4j), aggregate the runtimes for various classes and method and then produce a graph to show average runtimes for various components. Most of the components that I will be measuring execute in an order of milliseconds so immediately I knew that I would have to tap into Java for working with time on that scale. The log files that I am working with output timestamps that look like this, 11/30/2007 13:01:59,123 (MM/dd/yyyy hh:mm:ss,zzz where z is milliseconds).

In the course of building my metrics tool, I wrote the following UDF to aid in calculating time differences in milliseconds. ** variables.runDate is set on instantiation of the object that this udf sits in.

<cffunction name="getMillis" access="public" returnType="numeric" output="false">
      <cfargument name="ts" type="string" required="true">
      <cfset var local = structNew()>
      <cfset local.xms = listLast(arguments.ts,",")>
      <cfset local.tparts = listToArray(listFirst(arguments.ts,","),":")>
      <cfset local.ntime = CreateDateTime(year(variables.runDate), month(variables.runDate), day(variables.runDate), local.tparts[1], local.tparts[2], local.tparts[3])>
      
      <cfset local.ms = local.ntime.getTime() + javaCast("long",local.xms)>
      
      <cfreturn local.ms>
   </cffunction>


Productivity with ColdFusion

With recent articles proclaiming Coldfusion to be dead or dying, there have been several 'rebuttal' posts by members of the CF community defending it from misinformation that every author seemed to have (go figure). Many of those posts did a really good job of showing the readers that CF is alive and kicking and talked about some of Coldfusion's amazing qualities. One of those qualities that seemed to come up in almost every post was that Coldfusion enables you as a developer to be more productive. This is a completely true statement (as you will see) and I totally agree with the authors when they say it. The problem however is that none of the statements made those posts, were backed up with examples.

I think it's really hard to drive home the point of Coldfusion and productivity to non-CF developers without throwing concrete examples in front of them to see first hand. Many of the skeptical readers won't spend the time to figure out on their own if that statement is true or not, most will probably see it as "my language is better than your language" flame bait. I don't blame them for thinking that way given the pretense of the article and no examples to prove it.

My attempt with the rest of this post is to help back up the claim that CF enables you to be more productive. I tried to choose examples of task that are sometimes trivial but also part of the average everyday development.

<More>


CF Haters, Please Read

This post is in response to the recent bashing and false claims made about Coldfusion, Flash and Adobe. To get an idea (if you aren't already familiar) with what I'm talking about read the comments left on digg, ColdFusion 8 Launches. I know that the vast majority of digg readers are high school students, but regardless of age I think that people should do research and put some merit behind their claims. Here is what I have to say in response to them:

  1. If a company (or government agency) can afford to purchase it, they (typically) can afford to pay you top dollar.

  2. If you can't afford the one time payment of $1300 to purchase a license, then chances are you can't afford to run a dedicated box anyways. Where is the benefit in using a free alternative then? Shared hosting for CF can be found for the same price as any other language.

  3. Some people have mentioned that CF has been "re-written" (meaning, released a new version) every few years. I didn't realize that constantly improving performance and adding more language features was a bad thing. When was the last time your language was refactored?

  4. How come no one has bashed on JSP yet? At the end of the day CF is just like JSP (if not a more enhance version of it), it provides a markup syntax, an ecma like syntax alternative, can run in a J2EE container and gets compiled into Java byte code. Sounds like there is very little difference to me.

  5. Flash = 90%+ market penetration, meaning 90%+ browsers are Flex enabled. Funny how some think that translates in a dead or dying technology. Where is the animated vector graphic support in DHTML or server side data pushing in Ajax?

  6. All of the talk about CF and increased productivity is true. What other language can you expose any functionality in a SOAP enabled web service with one tag attribute (access="remote")? Read the live docs if don't believe me.

  7. Adobe provides enterprise support services, when was the last time you asked a question and didn't receive a snide remark from someone who was too uber or 1337 to help you? Relying on community support is great until you hit a snag under deadline thats going to cut into someones WOW or 2nd life play time.

  8. When you finally graduate high school and/or migrate from your parent's basement, you will realize that you need to earn a living and that the vast majority of the jobs you find coding in PHP\Ruby are no more lucrative than working as a delivery driver full time (however there are many exceptions to that statement). Your misconception of corporate greed and business economics will soon fade when you know that you make a great living if only you had decided to at least learn that other "dead language".


mp3Salad cracks 100k

It's official, mp3Salad has cracked 100,000 page views this month. With 2 days left in the month, I anticipate the total being around 120k.

Traffic Stats: June 1 - June 28

Update The final total for the month of June was 125k!

mp3Salad hits 100k


Improving Amazon Product Advertisements

Since I last blogged about mp3Salad getting traffic the number of page views it's received have steadily increased, each time amazing me when I check on my traffic stats. The site has received over 50k+ page views a month since February, with April toppling 80k. I realize that it's not a lot of traffic in relation to other more popular sites out there, but I felt that it was decent enough to try and see if I can earn a little bit of extra scrilla. With that focus in mind I went looking for affiliate\publisher programs out there that I thought would be relevant to mp3Salad's users and landed at Amazon's Affiliate Program.

Amazon offers it's affiliates several advertising options such as targeted links and product placements, I wasn't interested in more text links (I already have Google adwords) so I focused more on their product capabilities specifically music albums. The first thing I had to do was sign up for the program, submitting some information about my site. The process was painless and in several hours I received a confirmation that I was accepted into the program, onto the next step which was to start using their tools to create my ad. Amazon has several different options for displaying product ads, such as explicitly choosing the individual products or letting them 'intelligently' decide what to show using their Omakase links (Omakase - Leave it up to us!). The Omakase links seemed to produce items that were not necessarily relevant to the page but rather to user, for instance when I viewed the page it returned me a cordless phone, a book on programming and something else which I can't remember. I wanted items that were relevant to the page at hand, so this is what I did.

Using Amazon's E-Commerce Web service (ECS) I was able to search for and retrieve relevant music albums based on what the user originally searched for. I chose to use their REST/POX service instead of their SOAP service simply because it's light weight and fast (not saying their soap service isn't but I've been fond of RESTfull services of the late). The ECS service returned me a list of products in which I strip out all but the ASIN (product id). Using that list of product id's, I then produce the <iframe>s that in turn display the individual links. Take a look at the following search result page for Bob Marley.

This is my first go around with the service and there are some things that I haven't fully completed with it yet such as using a default search term if the one submitted doesn't return results. I'd like to also try and figure out a better way to build the HTML they use for product display so that I can bust it out of the frames giving me better control of how they are displayed. All in all I like the service and hope that it brings in a few extra duckets.


Unneccessary Whitespace

A little bit of a gripe here, but why do we have to explicitly tell ColdFusion not to output tons of useless whitespace, line breaks and tab characters? Would there ever be a valid case in which that 'data' would be usefull?

My questions come from a recent post by Ray Camden, "Generating XMLfrom a CFC? Watch out for whitespace" reminding us that CFCs will generate 'whitespace' when processing a Component Constructor, unless you use output="false" in the tag. Why wouldn't Adobe make that the default behavior and force it's developer to say "Yes, I want non-sensical whitespace pushed to the output buffer!", it seems so obvious.

The extraneous whitespace adds to the content length of a page and in some cases (as Ray pointed out), can add technical challenges to your projects.


Coldfusion can be Free

A while back there were a lot of comments being made on some blog posts about beginners shying away from ColdFusion because it wasn't free and how CF has become more focused on the corporate market. While I think that moving towards corporate is a natural progression of any language (except php which will almost always remain in the hands of common man/woman), I want to dispel that myth that there aren't non-Adobe alternatives that are 100% free. Below is a list of CF alternatives that can be run in enterprise environments without dropping a dime:


An important thing to keep in mind is that the above engines don't neccessarily have all of the features (includes tags, functions, ect...) that the official Adobe version contains, however some like BlueDragon contain additional features (like interfaces) that Adobe does not.

Update: 03/05/07
Here are two more CF Engines


mp3Salad gets traffic!

mp3Salad is actually getting some traffic, not much, but traffic none the less. The other day I was fooling around in the web stats from my hosting provider (which I rarely do) and I noticed that I had about 5k+ page views to my 'domain' this month. Thats unusually high for me considering that no one except a few friends and family visit my sites.  Upon looking, I saw that mp3Salad alone had about 3.5k of them!! I couldn't believe it, considering I had done nothing more than submit it to Google to be indexed (and placing a link to it on this site). I'm starting to think it might be worth while to give the site some more of my attention.

Update (01/18/2007):
Here is a snapshot of the traffic to my 'domain' from Jan. 1 - Jan. 18


Has the CF community forgotten about no-argument constructors in CFCs?

After reading the following quote in the Wikipedia entry for ColdFusion;

"Unlike other object-oriented languages, ColdFusion does not support constructors as a first-class language concept. Rather, all constructors must be factory methods."

and seeing the question "How do I get around a lack of constructors in CFCs" on CF Cookbook (which I commented on),  I'm left to thinking that the CF community has forgotten entirely about no-argument constructors in our components and their ability to do more than just simple variable declarations upon object instantiation. Take for example the snippet of code I posted on CF Cookbook,

<cfcomponent name="myObj">

<!--- No-Arg constructor zone --->
<cfset variables.test = "testing">
<cftry>
       <cffile action="read" file="#expandPath('property.txt')#" variable="myvar">
       <cfset variables.test = myvar>
       <cfcatch>
                <cfrethrow/>
       </cfcatch>
</cftry>

<!--- Method to return 'test' variable --->
<cffunction name="printTest" returnType="string" output="false">
       <cfreturn variables.test />
</cffunction>

</cfcomponent>


Before I start getting comments (haha-no one reads my blog!) on how that is not considered best practice, stop your self. I agree, I think that it's better practice to use init() as a 'pseudo constructor' to do stuff like this, but lets not pretending and present to others (like beginners) that they don't exist.


More Entries