The technology behind Leaderboard

I just finished my first solo product, Leaderboard, a SaaS app for managing competitions. I’ve done tons of little side projects, but I either abandoned them or I built them only to learn a new language, framework, or stretch my programming ability. I’ve had a lot of things going on in my life since the beginning of the project (just like everybody else). Regardless if I make one cent or not, I’ve finished a product (meaning I got software working to a point that someone could pay me and built-in a way for someone to pay me).

Tech Used – First up, C#

Since I’m a programmer, I want to talk about the technologies I used to build the product. First and foremost, I used C#. I can’t get enough of C#. I know there are better languages out there, but it’s really the best of the top 10 languages. It’s right in between terse and verbose. I’m most familiar with OOP, which C# makes easy and simple. I like auto-properties, extension methods, and reified generics. I write what I’m thinking in a pretty frictionless way with lambdas and LINQ, both of which I use all the time.

While I don’t think it’s buying me much, it’s been pretty painless to use the async/await keywords that allows for easy concurrency. There are other niceties like multi-line strings and using @ to escape names that are reserved keywords (think @class in Razor templates). Nullable types like int? help you keep your code clean, with both database logic and HTTP routing. The var keyword allows to use a little type inference to cut down on the amount of typing you have to do. The very flexible dynamic objects look nicer than hashes (obj.field vs hash[“field”]), even if I don’t like using them in my own code.

Speaking of dynamic, I’m encouraged by the fact that it’s a strongly- and statically-typed, compiled language. So many languages used for the Web are dynamic, meaning that there’s a whole class of errors that are checked only at runtime. That’s slightly scary, considering how easy it is to fat-finger a controller name or something of that nature. I like that even the HTML templates I used compiled.

ASP.NET MVC 5 – Rails on .NET

Thank heavens for Rails. Even though I don’t use it, Rails has saved every Web programmer from the travesty of PHP or ASP programming that encouraged giant pages of duplicative spaghetti or the horrors of Java Web programming with Servlets and JSPs and Beans. They reused the simple MVC pattern to allow you to organize and to reuse your code. To sweeten the deal, they threw in things like database migration, testing, and the asset pipeline.

ASP.NET MVC 5 is inspired by Rails, although it’s not a clone. C# is still a static, compiled language, so the macro magic that Rails uses is just not present. The closest thing to that is reflections and annotations which allow you to configure how your controller methods work. I use Razor templates (views), which has a great idea at its core: each template has a model (a plain old C# object) that has all the data that the view will use. I can then use that object to display data on page or use it to pass data from a form back to the controller. I can annotate the object with data validators and check those validations before I save it to the database, and if there are errors, I can provide a custom error to my users (without really touching the view).

Entity Framework 6 – A robust ORM

I really like Entity Framework, mostly because of the nice database migrations it buys you. You can setup your system to apply migrations automatically (I wouldn’t use this for a bigger project, but it works for mine). I can update my model classes and EF6 figures out how to update my database.

EF6 is pretty simple to use since it uses LINQ and it gives ok performance (probably the worst of any .NET ORM, but on a project this small, it doesn’t matter). You can also swap out SQL Server for a memory-backed List for running integration tests.

I can also seed my database nicely. That’s one thing I really like to have in any project: a dead simple setup. I hate it whenever a project has a bunch of dependancies that you have to manually setup before you can use it. On most projects, I’d like to just have a database and the code to get going (external APIs are another matter).

As a side-note, I used to hate EF – it used a visual tool for developing your database. Now that you can write simple objects or SQL first, I’m won over.

Visual Studio 2013 – IDE par excellence

VS is one of those tools that’s a pleasure to use. I just set it to the dark theme and I’m ready to go. I really like having almost everything within the IDE itself – editor, SQL query tool, package management, terminal, debugger, test runner, Git client, and deployment tool. The only thing that’s missing is a browser (for Web programming), but I don’t mind tabbing over to Chrome to test something.

I have all the usual praises for VS – quite responsive, solid debugging, IntelliSense is really helpful, code navigation is nifty. Oh, and the ability to push the play button, and my site is run in a development server without any configuration my part. I miss having all these features in a regular text editor, and other IDEs just seem stupid in comparison. IntelliJ is nice, and Xamarin Studio is ok, but they aren’t as well put together as VS.

Stripe – payments simplified

I like Stripe for many reasons – they made it so you could integrate payments in your app in hours instead of days. Anybody who’s ever had to take credit cards with other vendors has experienced this pain. No longer.

Misc

Like so many people, I used Bootstrap for the CSS framework, YouTube to host a video, QuickTime for video capture, Fireworks for image processing, Trello to get organized, and Parallels to host Windows on my MacBook Pro.

Limitations

The biggest issue with my stack was the code -> compile -> run loop took far too long. At the same time as I was building this, I was teaching Python with the Flask framework. With Flask, you just keep it running and it reloads when it detects you’ve changed the code. For simple projects, you don’t even notice the reloads. I really wish that something like that existed for ASP.NET MVC. I don’t want to wait to run my code!

Another weird thing I discovered was that Razor templates are tied to your HTTP stack. If you want to use Razor in an email, for instance, you have to mock a controller context or pass it in your Controller. That’s a bit crazy.

Another bummer was that for certain, more difficult queries, LINQ is pretty hard to use (for me). I could not figure out how to write in LINQ a query that would be simple in SQL, so I ended up splitting it into two parts and combining the result.

That stack is fun!

I really enjoyed using C#, ASP.NET MVC 5, and Entity Framework 6 on Visual Studio. I’ve looked all around, used so many other tools, but I think these tools get you up and running, and then provide assurances that your code can grow with your product.

I’ve written a little more about the purpose of Leaderboard

Posted in Programming

Leave a Reply

Your email address will not be published. Required fields are marked *

*