Designing and Implementing a Ranking Algorithm

I recently had the desire and need to create a ranking algorithm for a side project I was working on. I wanted to keep both the design and implementation fairly simple for my project, so I think this post will be great for people wanting to get their toes wet.

The ranking algorithm I ended up building is used for ranking user-created content – similar to the ranking of posts on sites like Reddit or Hacker News. So one might describe it as a ‘hotness ranking‘ opposed to a ‘relevancy ranking’ used in search engines.

My goal is to walk through the basics of designing a ranking algorithm and then sharing my experiences and findings from implementing my algorithm. My implementation was done for a web application using Node.js and MongoDB.

Designing the ranking algorithm

When starting to design my algorithm, I naturally wanted to understand how other sites’ ranking algorithms worked, fortunately I found a couple of blog posts that provided great introductions for ranking algorithms used by both Reddit and HackerNews. I would also recommend reading this blog post that describes the design process around Reddit’s ‘best’ comment ranking algorithm. Continue reading

Real-world programming interview question #1

As programmers, we like to solve problems. In school, we thoroughly enjoy working through solutions for our homework problems. When interviewing for a developer job, we have to solve some complex programming problems (on the spot). As software developers, we still work through complex problems, but suddenly our solutions have more weight because they are solving real business problems. I enjoy solving problems that come from real-world business context; I find that my motivation to solve these problems is greater. Today at work, I came across a problem and worked through a solution that reminded me of a challenging problem one might see at school or in an interview.

Here is the problem:

You are processing potentially thousands of units of inventory and you are writing code to take inventory data from a supplier and syncing it with a distributor. The inventory is comprised of rental properties which have restrictions on specific days that are ‘closed to arrival’ and days that are ‘closed to departure’. Unfortunately, the format that the supplier stores this information is very different from the format that the distributor’s API expects. It is your job to transform this data to be in the proper format for the distributor’s API to handle. Continue reading

Node.js for side projects

There is one thing that unites people who work on software: we like to create things that work. Nothing is more satisfying than finishing a feature or project that simply does what it was intended to do. When it comes to my side projects, I love learning new frameworks, technologies, and languages. But in the end, the most rewarding and satisfying part is finishing the project and releasing something to the wild. Let’s be honest, if you work full-time and worry about things like exercising, chores, and possibly sleeping – then you understand me when I say it is not always easy finding time to complete a side project. We can help ourselves by planning ahead and perhaps utilizing some fancy project management tools. But what about our technology stack? If our end goal is to finish and release our project, then it makes sense to pick a technology stack that is well-suited for rapid development.

Node.js has become a popular server-side platform used to power the web servers for many modern web applications. When developing a Node.js application, you will be writing everything in Javascript and you will be able to run your applications on any type of server (Windows, Mac, or Linux). Node.js consists of a large pool of tightly-scoped modules and packages that you can utilize. What is great though is that you only use what you need, keeping your application as lightweight as possible. At the end of the day, side projects should still be enjoyable, and Node.js applications are fun to write. Continue reading