Saturday, September 15, 2012

Tech That I Use Professionally

I started Leavins Software earlier this year. This post discusses the technology that powers the company’s website ( and its first product (Leavins Inventory Manager).


The first version of used Jekyll. It was a no-brainer for me because I had plenty of experience using it for my personal site. But I soon needed non-static content and server-side data checks. After checking numerous web frameworks, I went with Sinatra. It felt right for the tasks that I needed to do.

The site uses ERB templates because they’re built into Ruby, they work, and they are more flexible than Liquid templates (used by Jekyll).

My Sinatra applications run on Thin, which is a good server for Ruby web apps. I chose it for three reasons:
  1. Thin is popular; it’s the most-popular Ruby web server (second behind Passenger, which is more of a deployment option for Apache/Nginx and less of an actual web server) according to Ruby Toolbox (
  2. I’ve tried to use Passenger in the past, but deployment (even on a test server) was problematic compared to thin.
  3. Running thin as a user (for development and production) is easy

My choice of SQL server (PostgreSQL) and load balancing web server (Nginx) was arbitrary. I have worked with Apache and MySQL, and I wanted to try something different.

Unlike many Ruby web projects, my deployment process does not use Capistrano. If you’re creating a new Rails project, you should use Capistrano or maybe Mina. I found that going off Capistrano’s “happy path” was a frustrating experience, and I needed deviate because I was not using Rails. I may revisit Capistrano at a later time, but my custom deploy script is currently adequate.

Software – Leavins Inventory Manager

Leavins Inventory Manager uses WPF for its UI, SQLite (and small bits of XML) for data persistence, and C# as the codebase language of choice.

I chose WPF over WinForms because WPF produces better-looking interfaces. Early on, Leavins Inventory Manager was actually written to use WinForms, but I managed to convert it to WPF without too much trouble.

The WPF parts of the application use a mix of MVVM and Code-Behind. I knew about MVVM when I started working with Leavins Inventory Manager, but I did not realize the importance of MVVM in designing major applications. After discovering MVVM and writing my own MVVM framework with support for navigation, I started writing new parts of the app using MVVM. I will likely re-write the entire app to use MVVM, but I don't like to start huge rewrites unless I can dedicate a large chunk of time strictly to the code rewrite.

The application uses SQLite when convenient. It’s awesome for persisting tabular data in desktop apps. But Leavins Inventory Manager stores program options and order information as XML files. I don’t recommend this mixed approach, but I think that using XML over SQLite in those instances saved me quite a bit of time in developing (and testing) the application.

Choosing C# as the language was another no-brainer decision. Visual Basic .NET was the first programming language that I learned (other than RCX for Lego Mindstorms), but it’s been a long time since I’ve used it. I used C# at a previous job, and I like it well enough to use it instead of VB .NET. I’m aware of other .NET languages (my favorite being Cobra), but I wasn’t sure if anything besides VB .NET and C# worked well with WPF.