Your friends at Viget present Extend, a Code & Technology Blog

OTP: a Language-Agnostic Programming Challenge

We spend our days writing Ruby and JavaScript (and love it), but we’re always looking for what’s next or just what’s nerdy and interesting. We have folks exploring Rust, Go, D and Elixir, to name a few. I’m personally interested in strongly-typed functional languages like Haskell and OCaml, but I’ve had little success getting through their corresponding animal books. I decided that if I was going to get serious about learning this stuff, I needed a real problem to solve.

Inspired by an online course on Cryptography, I specced out a simple one-time pad encryptor/decryptor, pushed it up to GitHub and issued a challenge to the whole Viget dev team: write a pair of programs in your language of choice to encrypt and decrypt a message from the command line.


Rubyists: Just use double-quoted strings.

TL;DR

If you've written Ruby, you've heard it before: Use single quoted strings unless you need string interpolation.

It makes sense, right? When I instantiate strings using double quotes, the Ruby intepreter has to do extra work to figure out if it needs to perform interpolation. Since extra work means reduced performance, it seems reasonable to avoid double-quoted instantiation unless it's a necessity.


Building a Multi-Step Registration Form with React

We've really enjoyed working with React here at Viget. We've used it on client projects, personal ventures, and most recently on Pointless Corp.

One great feature of React is how it handles the state of our application. Each time the state of a React component updates, React will rerender an updated view. Translation: React is great at showing the user something when something happens -- if it needs to.

I thought a good example of showcasing this ability would be in a multi-step registration where we update a component's state to show which step the user is on, then show the fields for that step accordingly. But before we dive in let's see what we'll be building.


WebSockets with Elixir - How to Sync Multiple Clients

Back in November, we bunkered down in rooms across our 3 offices and went to work for a Pointless Weekend. The Boulder and Falls Church teams joined forces to bring Jambells into the world. If you haven’t seen it yet, Jambells is a fun little web app that lets everyone live out their dream to be in a Handbell Choir, with their friends, on their mobile devices. This app had all sorts of technical challenges and to tackle websocket management and client syncing, we turned to Elixir.


Speed Up Rails By Starting on the Front

Is your Rails website performing poorly? Are clients and users complaining about 5-10 second pageloads, timeouts on mobile devices, or images that take forever to display? In some cases the solution lies on the backend — caching requests, speeding up DB queries, etc — but often, there are front-end optimizations you can look at first, that could have a huge effect on how fast a site feels. 

Evaluating front-end performance

Check out www.webpagetest.org. For a quick glance at your site, look at the grades in the top right for immediate problems, and also check the two “Speed Index” measurements for first and repeat views. Since webpagetest saves all your tests, you can re-run after making some changes to easily see what's improved.

Avoiding premature optimization

Performance optimization takes time and resources, both of which are often in short supply. It’s hard to find the point where optimizations start to cost more than they save, and every site and team have their own unique challenges. I’ve ordered the notes in this post in order of payoff: if you want to start optimizing but don’t know where to begin, the first few ideas on this list will probably give you the biggest bang for you buck.