By Casey Liss
Pragmatism

This morning I received a pull request for my blogging engine, Camel. The pull request had a lot of changes, and they were made with good reason. The primary purpose was to split up camel.js. Instead of one monolithic 650 line file, it was split into a total of four files. This makes sense to me. I instituted some “flower boxes”, which were controversial, in order to try to demarcate the different sections of the file. That was already indicative to me that something wasn’t quite right.

I liked the changes. They were an improvement over my monolothic file, and provided for a separation of concerns between different parts of the app.

However, I’m not sure they were right for Camel.

When I was a younger developer, I always aimed to be right about everything. I did what was considered the “best practice”. No matter what. I mean, it’s a best practice for a reason, right?

As I’ve gotten older, I’ve stopped caring as much about what’s best during practice. I’m worried about what’s best in the game. While reviewing this pull request, it occurred to me that it was done well, and done by the book. But that didn’t make it right for my project.

I’ve come to realize, with time and experience, that “best practices” are simply a starting point. They’re there to point you in the right direction. But they’re not designed to be followed letter-for-letter, word-for-word. Instead, you have to do what’s right for your project. You have to be pragmatic.

For Camel, my priorities are to be “fast, simple, and lean”. It says so right on the tin. Splitting Camel into four files just felt like too much. It wasn’t right for my project.

In my case, simplicity is important to me. I wanted Camel to serve not only as the engine for this site, but also as a sample for someone like me—a total Node noob—to learn from.

As always, I think the answer is in the middle. I think that Camel should be split into either two files (routes/helpers), or three files (entry/routes/helpers). It’s only a file or two less, but it’s quite a lot easier to swallow. Doubly so for someone who is new to the code.

And if it weren’t for this pull request, I may not have bothered to really think it through. I’m already so very glad that I decided to get over my fears and open source Camel.

The system works.