Basecamp API Update

First of all thanks to all of the people who have either promoted or contacted me about BasecampCFC. I am really excited about all of the interest. As of now it’s been mentioned at:

I have to admit, getting it on 37Signals’ radar was pretty cool.

Now on to the meat of this post, the latest update…

I’ve fixed a number of issues with both the basecamp.cfc and the demo app that goes along with it.

Basecamp.cfc

  • I added a debug setting to the init method. It adds extra information to the ColdFusion debugging output.
  • I added an authentication method. It allows you to tell the difference between
    • Authentication failure
    • API not being enabled
    • Basecamp project not existing
  • I made steps to ensure that all get methods would return consistent column lists for queries.

Demo application

  • Now tells you if you haven’t enabled the API
  • Now gives directions on enabling API.
  • It’s a bit more robust in handling blank records

Finally, if anyone is interested I added the unit tests to the SVN repository, if anyone wants to see how I’m testing the whole thing.

How to convince yourself to Unit Test

I was talking with someone recently about unit testing. His dilemma boiled down to the idea that he knew unit testing was one of those mythical “Good Things” but he couldn’t bring himself to do it; it seemed like such a large commitment in time. I’ve been thinking more and more about this, and I have come to the conclusion that the time factor in unit testing is actually a myth. Here’s why I think so.

Do you write code, and declare it finished when you are done editing it? I hope not. No, you go to your application and test the page you just changed through your browser. If you’re working on a CFC, maybe you go to a page named test.cfm, on which you have a few CFC calls and a CFDump. You then looked to see if the results you got conform to the results you expected. Did you do that? Then you just unit tested! The only difference between that and a formal unit test is that you throw away the test after you were done writing that piece of code.

I propose you formally unit test instead. Instead of throwing away that test code, put it in a formal testing framework. You’ll probably have to change it a bit to get it to work with one of those frameworks, but the learning cost for doing it this way is much, much cheaper that TDD. Once you do that, you’ll never have to worry about breaking code again because you hold on to every test you’ve ever written. Well, okay, you’ll still worry, but you know as soon as you do it what code you’ve broken, which is a much better place to be at.

I think a big part of the underlying misconception comes from the fact that most discussions of unit testing include a description of Test-Driven Development (TDD). That is the system were you figure out how exactly your code should behave, write tests to check for that behavior, then write code that behaves in a way to pass all of your tests. That is going to change the amount of time you spend on development (at least up front, where we tend to myopically be focused.) More than just a hit in terms of development time, it’s a hit when it comes to spending the time learning it. Mind you, I’m not saying that TDD is bad; it’s just a paradigm shift, and a big one at that.

BUT that doesn’t mean that unit testing IS Test-Driven Development; TDD relies on unit tests, not the other way around. Go ahead, write your unit tests after the fact. No one will know. In fact, many unit tests get written in response to bugs, even when you are doing TDD.

Another misconception is that you have to test everything you do. Some things work better with formal unit testing than others. Yes, with mock objects and development databases you can unit test anything, but that makes the learning curve even steeper. Screw that; don’t make it harder for yourself. Small components with a limited range of functions are the easiest to start to work with. Examples usually include some sort of calculator, or other such item that I never use in actual code. So here are my recommendations for low hanging unit testing fruit.

  • Authentication code, specifically that which test usernames and passwords (as opposed to session management)
  • Utility code, like a phone number formatter, or custom date converter
  • Parsing code, like code that takes a custom XML format and converts it to a usable format
  • Problematic code, code that breaks every time you do an update.

So start moving your informal tests to a formal unit tester. Start with the small stuff and don’t worry about testing everything. And for god’s sake don’t think you have to reach for TDD to be successful with unit testing. Somewhere between where you are and where you are heading is a much better place.

In case you want to know more about unit testing and ColdFusion, check out the ColdFusion unit testing frameworks:

Update: Someone pointed out to me that I had misspelled “TDD” as “TTD.” Sorry. I’m dumb sometimes.

Basecamp CFC

I’ve been using Basecamp for freelance consulting and I absolutely love it. I have one problem with it, once you shut down a project the client can’t get any of their materials. It would be nice if you could export the entire contents of a project, compile it into a .pdf, and ship it off to a client as part of a project closeout.

They have a pretty thorough API, and I happen to know a language that can make pdf’s pretty easy. So I figured I could make my own solution, and I did. In doing so, I had to create a service CFC for the Basecamp API. Since there wasn’t one when I looked around for it, but there were a few questions about one, I figured I would share it on RIAForge, and I have. You can download Basecamp CFC from there now.

A few things to note:

  • I implemented all of the data retrieval methods
  • I implemented create, update, and delete methods for comments and messages
  • I have not implemented create, update, and delete methods for categories, todos, or milestones
  • There are not API methods for create, update, and delete of companies and people.

I haven’t implemented everything, because, frankly I didn’t need it all. But, if anyone uses the thing and really wants them, I will be happy to implement more.

If anybody uses it, let me know.

Yet Another Community Expert

Adobe Community Expert

I’m a little late to the party but I got word yesterday that I was selected as an Adobe Community Expert for ColdFusion. I’m a little humbled by the company in just this last round of Community Experts, let alone the whole group.

I’m sure it will be a bit before my information is up on the site, but I just couldn’t contain my excitement.

Once I get the hang of this whole “being a dad thing” I’ll be posting ColdFusion content regularly again.

Thanks for letting me in, Adobe.

Simple IT Success

Avish Parashar, a friend of mine, is starting a new business venture. It’s a consulting and training company which is directed at teaching technical people non-technical skills. You know, those elusive “soft skills” you hear about from time to time.

I recommend Avish and his training in the strongest terms possible. I’ve worked with him in this capacity for eight years getting guidance on courage, creativity, communication, and influence along the way. I have definitely enjoyed the fruits of applying his philosophy and techniques to my regular working life.

Anyway, check out his site, simpleITSuccess.com, and if you are even considering it, drop him a line. You won’t regret it.

cf.Objective Progress

Less than a year ago, I went to cf.Objective for the first time, and came back with a list of items that I wanted to see myself do, because I was introduced to them at the conference. I thought I would do a quick public coming clean about my progress.

To recap, my list was:

  • Start using Coldspring
  • Start using an ORM
  • Start using a real (UI) framework
  • Stop thinking about objects in terms of data
  • Start doing development on my local machine
  • Stop spreading rumors that the man saying he is Sean Corfield having the real Sean Corfield tied up in his hotel room.

My progress:

I started using ColdSpring for dependency injection in a few of my projects. I haven’t reached by goal of using it for Aspect Oriented Programming yet. So that will go back on the list.

I refined Squidhead to work against multiple DBMS’s and to understand foreign keys; making is a real solution for at least me.

I failed to start using a real UI framework. I would still like to, but I’ve been lazy. I need to be more disciplined. I really want to start using either Fusebox or ModelGlue.

I think I’ve switching from thinking about objects as objects first, and then going into the database to represent them, not the other way around. Could I do better? Sure. But I am much further ahead of myself a year ago.

I switched to local development solely. No more remote servers. Feels great, I never want to go back. Thank you, Mark Drew, your “car with a spike on the steering wheel” analogy changed my professional life.

I don’t spread rumors about Sean’s identity anymore. In part, Sean finally updated his picture. In part because I heard if you make any sort of fun of him, he will track you down, and shave a half dollar sized bald spot onto your head. That man is dedicated! And a Philadelphia winter is much, much colder with a mini-tonsure. Trust me.

So that’s it. I’ll hold off on making a new list until after cf.Objective 2008.

And if you aren’t going, don’t worry, every ColdFusion blog will be full of stories of how awesome it is. So, you know, that will be just like being there.

ColdFusion – Market Share vs. Profitability

There is a very interesting article over at Knowledge@Wharton about Market Share vs Profitability.

I skimmed it a few months back when it came out but never thought about it in terms of the ColdFusion community until I saw this link at Daring Fireball applying this phenomenon to Apple.

Basically the gist I get from it is that profitability is more conducive to long term health of a company than market share. It’s not proven, but if it is true it puts the ColdFusion market into a particular light. If what is true for companies is true for products, it might not matter to ColdFusion’s long term health if it steals market share from ASP.NET or PHP. ColdFusion’s long term health might be in its profitability, which according to Adobe has been very good.

Market share is still important to us, as it helps determines availability of work. But this phenomenon might a good explanation for why what we see Adobe doing with ColdFusion doesn’t always match up with what the community wishes it would do.

Speaking at cf.Objective() 2008

I got word tonight that I will be speaking at cf.Objective() 2008. Needless to say I am thrilled, excited, and a little intimidated. Cf.Objective, in my experience, has the most advanced content of any of the various ColdFusion world events. It’s a lot to live up to, and almost everyone there blogs, so if you screw up big it’s not like you can keep it under the radar.

My topic is “Selling Professional Development Techniques at a Hostile Shop.”

Here’s the abstract:

You’ve started using Subversion, you’ve drunk the frameworks Kool-Aid, and you go so far as to use an Ant script to launch CfEclipse. There’s only one problem, your co-workers don’t want to join you. Worse still, your boss doesn’t see the big deal, and upper management starts an anti-framework club. You don’t want to leave but you can’t fathom staying at a workplace that doesn’t embrace progress. What do you do?

You leave the technical behind, dust off those so called soft skills, and turn to politics to get the job done.

This session will help you to identify all of the players on the opposing team, figure out their issues, determine what techniques to use to change their minds, and avoid turning into Machiavelli in the process. By the end of the session, you should have a set of concrete tactics and strategies to go back to your organization and start converting the masses.

The basic gist of the session revolves around the question: What do you do when your co-workers or management reject your efforts to introduce “professional development techniques?” What are “professional development techniques?” For the purposes of this talk they include (but are not limited to):

  • Frameworks
  • Version Control
  • Code Reviews
  • Unit Testing
  • Company specific Best Practices
  • Automation
  • Code Generation

It’s a question I’ve found myself asking from time to time over the past few years. I’ve had to make find my own answers for it. My hope is to help make it easier for others.

Obviously this isn’t a technical presentation, but I hope to keep it practical instead of theoretical by providing concrete tactics and strategies to employ.

I have the outline mostly ready at this point, but if anyone has any specific problems or scenarios they would like advice on, please feel free to drop me a line either in the comments or through my contact form.

Speaking at WebManiacs 2008

I’ve been a little busy with the newest addition to my family, but I wanted to drop a line about an upcoming conference appearance.

I’ll be speaking at a session at WebManiacs 2008 on AIR and SQLite. My session is on the first day of the conference, which runs from Monday May 19th until Friday the 23rd. It’s shaping up to be a great conference, and I’m a bit humbled by some of the other names that will be appearing. I don’t know how I got on the speaker’s list, but however it happened; I’m very excited about it.

Squidhead Updates and New Features

It’s been a little while since I’ve talked about new features of Squidhead, so I figured I would take the opportunity to blow my own horn.

New features:

  • Oracle Support
  • Linux Support
  • Linking table support
  • FKCrazy Application template
  • Rudimentary ColdSpring Support

Squidhead will run against Oracle 10g. It alters its model a bit to create stored procedures within packages, as this seemed to be in keeping with Oracle Best Practices.

Squidhead will run on Ubuntu. I haven’t tried it in other flavors yet, but I can’t tell why it wouldn’t.

If you follow the convention of naming tables [table1]To[table2] and have the primary keys from table1 and table2 as foreign keys, Squidhead will recognize the table as a linking table. It will create stored procedures that pass queries through this linking table to create relationships between linked tables.

FKCrazy application will use the linking table information to automatically create interface that uses all of the foreign key relationships to add and delete child records. It can do this in a one to many relationship, or in a many to many relationship. Translation: If you’ve seen my Facebook in 17 minutes presentation – everything I did manually at the end now happens automatically. So if I did it today, it would be more like Facebook in 12 minutes.

Squidhead can create its own ColdSpring configuration files. Not earth shattering but makes integrating a Squidhead application with an application already in ColdSpring much easier.

So there you go, quite the update over the past few weeks.