Good Enough

Years ago, my then boss asked me to find a good wysiwyg editor. After a bit of research, I found one that I thought would meet all of our needs.
It had even come in second in a ranking of CMS tools (by CFDJ, if memory serves). I told my boss my conclusion and even tossed in the part about it coming in second in this ranking (not a particularly heavy influence, but it helped my case). To this, I got an interesting response.
He said, "Second!? We don't want the second best. We want the best!"
It took me a second to respond to this. As it was, the product I was recommending was a wysisyg editor which met all of our needs and could be placed on any given web site for free (albeit with a somewhat limited - though still adequate - feature set). The product which had come in first was a much more expensive solution (if I recall correctly, a full-blown CMS system costing well upwards of $1000).
The thinking of my boss on wanting the "best" simply wasn't a helpful perspective. We just needed something that met our needs.
This is the concept of "Good Enough" and it actually has fairly wide applications.
This was brought to my mind by an article I just read in the latest CFDJ by Hal Helms. He made the point that (true or not) the branding of ColdFusion and its competitors (he mentions Java and C#) is that ColdFusion isn't as fast, secure, or scalable as C# and Java.
He argues that we should spend less time trying to defend against these attacks and more time promoting what ColdFusion is better at than its competition (quickly building quality applications that are easy to modify and maintain - resulting in a better user experience).
I think this is a good point. Is ColdFusion as fast and scalable (security is a developer issue) as C# and Java? Maybe not. Is it fast and scalable enough for the vast majority of projects? Yes. It is fast enough for now and unless your site is wildly successful (MySpace or better), it is fast enough and scalable enough for the future as well.
This reminds me of  a car add I saw years ago. The add pointed to the low-cost of the vehicle, its gas efficiency, and high safety rating. As to speed, the add said that the car would easily go as fast as the law allows. The point was, it certainly wasn't as fast as a sports car, but it was fast enough. The other features more than made up for its lack of extra speed.
I was reminded of this as well when I saw someone mention that they would like a list of the top 100 ColdFusion developers to help them when doing hiring. The thing is, you don't need one of the top 100 (and if such a list existed, it would make everyone on it an expensive hire). You just need someone who can do what you need. It may even happen that your particular needs aren't best met by the particular skills of someone on a "top 100" list.
Just some food for thought.

Synchronize Database Structure

When you take development code live, you need to make sure that the production database has all of the tables and columns it needs.
Fortunately, you can define the table structure that you need in a component (or elsewhere) and DataMgr (if you've read my blog before, you saw that coming) can make sure that the required tables and column exist in the database.
The same approach can be used for to self-install tables for an application (I used this on CodeCop).
Watch the presentation.
View other DataMgr presentations.
If you use SQL Server and you aren't interested in DataMgr or you need to synchronize more than tables and column, Red Gate's SQL Compare looks to be a very good tool (I have personally heard it highly recommended by two different users this week).
UPDATE
I just saw someone mention that they used AdeptSQL Diff for this purpose as well. So you might investigate that in addition to SQL Compare.

Browser Sizes

If you want to find out someone's browser size, you can send them to BrowserSize.com (more specifically, whatismy.browsersize.com). This is basically like whatismyip.com except that it tells browser size and includes the ability to resize your browser as well.
Chris Pederick's Web Developer Toolbar for Firefox includes the ability to resize Firefox to predetermined size. To do the same for IE, try Sizer.
If you want to test what sizes of browsers visitors to one of yours sites have, I just wrote a small ColdFusion utility for that purpose.
ScreenSizes is a mini-program that will install itself (with one table named "rptScreenSizes") onto any database supported by DataMgr (currently Access, MSSQL, MySQL, PostGreSQL). It is free for any purpose.

CodeCop Beta

I uploaded a new build of CodeCop to my site this weekend. It fixes some bugs that have ben reported and adds a few new features as well.
I have improved the installation instructions a little bit per Ray's advice. I still need to separate the installation files. Given that this program basically provides that keys to the castle for anyone with access, the security implications of that aren't a major concern on this program. Even so, I plan to address it.
To reiterate about security for the program. Anyone that has access to it, has complete access to your system. Guard access to this program fiercely.
CodeCop will check your code for potential issues using rules which are completely configurable. You can arrange the rules into packages which you can share (via an XML file) with other developers who can import them into their copy of CodeCop.
It will install itself on any database supported by DataMgr (currently Access, MS SQL, MySQL, PostGreSQL). It will run in the ColdFusion Administrator or on its own in CFMX 6.1 and above.
One new feature in this build is that CodeCop will introspect any CFC that it reads and provide documentation for it, including the ability to link directly to the code for any method.
Read Ray Camden's review of CodeCop (as an entry in his Advanced ColdFusion Contest).
Download CodeCop

ColdFusion Coding Rules

Now that the first code checking application has been reviewed, I though it would be a good time to discuss the rules themselves.
For my entry, I just put together a few example rules. I looked to rules I would want to check for and turned to the list of rules for ActiveSoftware's CF Code Review Tool for inspiration. Mostly, however, I just tried to put together a few rules to demonstrate some of the capabilities of the tool.
Now that Ray has had a chance to review it, I would like to put together the first public beta as soon as I get the chance. In order for the tool to be realy useful, I need to have it start with a good list of coding rules.
To that end, I would love to get suggestions on what rules people think that a tool such as this should use (keeping in mind that the tool will allow you to add others as you see fit or have it not check for rules that are included).
To get the ball rolling, here are the rules that I included in my entry:

  • Don't use a relative URL in cfschedule
  • Use the accept attribute when uploading a file
  • Avoid Evaluate()
  • Don't start includes with /
  • Avoid shared scopes in CFCs
  • Prefer StructKeyExists() over isDefined()
  • Prefer Len Over Empty String Tests
OK. That is the list as it stands now. I think it needs to be expanded and improved.
Who's first?

Ray Reviews My Contest Entry

I normally try to avoid posting just to talk about other people's posts, but this one is an important topic... me!
Advanced ColdFusion Contest Entry 1: CodeCop
Overall I feel that Ray's review was pretty positive, which is a relief. The big fear is, you put your best foot forward and find out the the good minds in the business think you are a hack (and not in the good way).
He did have some criticisms, which is to be expected. Most of them in terms of my failure to fully explain things in my documentation. Figuring out what I need to explain in documentation is still a challenge for me. Fortunately, he pointed to specifics so I will try to get those fixed.
Feel free to install it and try it out. It will install itself on any database supported by DataMgr.cfc (currently Access, MS SQL, MySQL, PostGreSQL). All of the tables use a prefix of "chk", so it shouldn't conflict with any tables in an existing database.
I will be releasing it as a beta on my own site soon (hopefully with improved documentation). It is free and open source and will remain so.
UPDATE
Since I am talking about myself anyway, I may as well point out some of the things that I am proud of in the application.
It will run in or out of the administrator on CFMX 6.1 or CFMX 7. The skin of the application will match the environment. So, it will match the look of the administrator that it is in or it will have its own looking if running outside of the administrator. It will also have capabilities to match its environment. For example, in CFMX 6.1 or in the administrator of CFMX 7, it will provide a drop-down of available datasources (using supported databases). In ColdFusion 7 outside the administrator it will provide a text box to enter a datasource with a drop-down to select one of the supported database types.
In fact, the whole application supports the idea of graceful degradation / progressive enhancement. It will work if JavaScript is not available, but it will be work easier if it is. If you run it from within the administrator in CFMX 7, it will provide use the file-picker box used to find a local database in the satasource section of the admin.
You can view the issues found in your code in several different ways with several different routes to more information. It uses Ray's code coloring code to help make the code easy to read and understand (and all issues found are highlighted with a link to a description of the issue). For simple issues found on local files, you can even edit the file directly from the program.
You can edit or edit any rule used by the program. You can have a rule that looks for a given tag (and run custom code against the rule that will make available such data as the attributes and the code between the tags in a way that is easy to use. You can also have a rule that looks for a regular expression (again with the ability to run custom code against the results). You can place rules into packages and share those packages with other developers via an XML file.
The reports provide a nice summary of the issues and are stored for your perusal later (also allowing you to compare the number of issues found different times that code is tested).
I am sure that it has plenty of room for improvement, but I think it is a pretty good start.

Looking for some Extra ColdFusion Work?

I need a few extra ColdFusion developers to help out with some deadlines this month (and some of the next and maybe some ongoing).
I need people with good ColdFusion experience using CFCs and custom tags. I would also like people with experience with CSS and accessibility (these need not be the same people with CFC experience). I consider experience with one or more frameworks to be a plus, but not required as no published framework is in use in any of my projects.
Candidates of the CF/HTML/CSS persuasion (as opposed to the CF/CFC persuasion) should consider themselves to haveat least HTML Level 4 knowledge and be familiar with accessibility and Section 508 (though not as good a measure, I guess Accessibility Level 3 knowledge is about what I am hoping for).
Candidates of the CF/CFC persuasion need not be OO experts, but should have experience with CFCs and understand encapsulation and composition.
Work is subcontracting, 1099 strongly preferred over W2. Work at home from anywhere in the U.S.. Rates to be negotiated.
Expect this to be relatively short-term work. As I have had more work than I can comfortably handle for about the past two years, however, the possibility exists for more work ongoing.
If you are interested, let me know. My domain name is bryantwebconsulting.com. Just send an email to me (my first name at my domain name).

The Joy of CFCs

A few years ago I started a project that I knew would likely be the largest I had yet attempted. The project would also be my first on ColdFusion MX, so CFCs seemed like a good tool to keep my code organized.
As it was my first project with CFCs, I had no experience with how best to utilize them. I read about objects and design patterns. Reading, of course, doesn't substitute for experience. Still, I have been happy with the result overall.
This week, as I was changing some functionality per some new requirements, I discovered that I had written one piece of functionality three different times in three different CFCs (talk about violating DRY!).
I changed the constructor (well, the init method) of two of the CFCs to pass in a third. I was then able to call the functionality from one place. This change in code in the CFCs didn't change the methods or arguments in the CFC except the init method. The result is that I didn't have change any of the code throughout the application that relied on this functionality.
Basicaly, I kept the API the same and so I was able to change the guts of how my logic worked without needed to change any of the code that used that logic (of which I had a lot). I could do this because I had used CFCs in a well-encapsulated way and had maintainted the API of the CFCs.
The point (if there is one) is that if you are thinking about using CFCs but you are worried that you don't know enough to take full advantage, I would encourage you to go ahead and give it a try. Even if you don't use them correctly, you will probably be ahead by using them. I have been.

DataMgr 1.2 Released

As a result of Ray Camden's coding contest, I made some changes to my DataMgr that have resulted in a new release.

Since Ray extended the deadline a day, I ended up wasting even more time on the project than I already had. Fortunately, I added a feature today to DataMgr and the project entry that I am very proud of.

I won't show my project entry until Ray has reviewed it, but I will talk about the new features in DataMgr.

Least exciting is a series of small bug fixes.

More exciting is that DataMgr has some new deployment options. It is no longer required that call DataMgr from com.sebtools (though I would still suggest it).

You can also pass the database in to DataMgr instead of having to call the DataMgr component for that database directly.

So, where you had to do this to load DataMgr using MS SQL with a datasource of request.dsn:
<cfset DataMgr = CreateObject("component","com.sebtools.DataMgr_MSSQL").init(request.dsn)>

You now have the option of doing this instead:
<cfset DataMgr = CreateObject("component","com.sebtools.DataMgr").init(request.dsn,"MSSQL")>


Added today is the ability to ask DataMgr what databases it supports in its current installation.
<cfset qDatabases = DataMgr.getSupportedDatabases()>

This will return a query of the databases supported by DataMgr.

It asks for this information from the DataMgr components in its directory. So, if you don't have DataMgr_MYSQL.cfc installed, it won't return MySQL in the query. If you add that file and reload the DataMgr component, it wil be in the query.

DataMgr will also now report the SQL it used if it fails to create or alter a table or tables.

Taken together, this allowed me put together an installation for my project that I am really proud of (more details on that later).

DataMgr is free and open source.

Free free to read about and download DataMgr or watch presentations on DataMgr.

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.