Posts from August 2016

Kotlin, a new JVM language created by Jetbrains, is quickly becoming the go-to programming  language used for Android development at Hootsuite. Its many features and Java interoperability make writing code much faster, cleaner, and less verbose. However, without being aware of language idioms it can be easy to fall back to old Java patterns. In order to maximize the utility of this new language, it is important to familiarize yourself with writing idiomatic Kotlin code. Kotlin’s features, such as the nullable types, lambdas, and delegates, differentiate the language from Java and are useful for writing effective code.

Kotlin

Read More …

Understanding JavaScript’s object oriented programming system can be difficult, especially if your background is in a language that uses a class-based system such as Python, Java, or C++. I can remember being incredibly frustrated trying to understand how objects, prototypes and constructor functions work together when I first started out in JavaScript. This blog post is meant to be the guide that I never had back then. In it, I’ll introduce the key concepts in JavaScript’s prototype-based OOP system, hopefully addressing some of the confusion surrounding it.

Objects in JavaScript

Javascript has six primitive types as specified in ECMAScript 2015: undefined, null, boolean, number, symbol, and string. Everything else is an object. Objects are collection of key-value pairs called properties. An object can be created by enclosing colon-separated keys and values in curly braces, and is called an object literal. Here’s an example:

Read More …

As part of the engagement team at Hootsuite, we use React as part of our front-end framework for everything from the streams that users see when they log on to dashboard to the new Assignment Manager. Testing is crucial to ensure that our code will work correctly when it has the right inputs, or will fail gracefully when it doesn’t. One of the many challenges of front-end testing is that with increasingly complex frameworks like React, thorough tests are needed to ensure that components render correctly, receive the right props, and update properly. Such tests are often difficult to implement, maintain, and understand. While React offers a  ReactTestUtils library, the library is very basic in terms of ease of testing and manipulating the React component’s output. We went as far as writing our own test utils but it simply did not provide the extensive coverage needed.

Enter Airbnb’s Enzyme!

enzyme

Read More …

While working at Hootsuite, I’ve had the pleasure of working in-depth with React to build our newest features for the dashboard. For example, I was tasked with building a component to show a horizontal list of items that adapted to the changing window size. Based on the window width, my component would show a dynamic amount of items and tell the user how many of those items were hidden if any. It’d be a fairly simple task if the amount of items was static, but but since the number of items is dynamic, I had to calculate how many to display each time the window size changed.

More specifically, the amount of items in the list should change depending on the size of the container. The last item in the list should show how many hidden items there are in the list if all the items didn’t fit (i.e +3).

For example:

  • 6 items
  • Can only fit 4
  • (item) (item) (item) (+3)
Read More …

Moving to Docker and Container Orchestration

At Hootsuite, we are moving from in-place deployments with statically provisioned hosts to running Docker containers on an orchestration platform. This platform manages the running containers and handles scaling and failure recovery. Transitioning to Docker will allow us to build microservices more quickly and with reduced operational overhead. We’ve chosen Marathon and Mesos as our orchestration platform (other options were Docker Swarm, Kubernetes, ECS, and Nomad).

How do we deploy with Marathon and Mesos?

image01

Read More …