Posts

Showing posts from 2019

Exceptional Exception Handlers

Image
As a budding developer, I quickly discovered that there's nothing quite as satisfying as debugging a frustrating error after hacking away at it for what seems to be an eternity. But sometimes error messages aren't very clear and it can make the debugging process especially difficult. Enter exception handlers ! Before we dive into just what an exception handler is and does, we need to take a look at a key question - what is an error and how are errors raised?  In Ruby, an error is an instance of the predefined class Exception  that is raised (or thrown) when something has gone wrong. By default, Ruby programs terminate when an exception occurs, unless you have an exception handler  - a block of code that is executed when an exception occurs. To handle exceptions, we can enclose the code that could throw an exception in a begin-end block and use one or more rescue clauses to tell Ruby the types of exceptions to handle. Note that the body of a method d

Drag and Drop It Like It's Hot

Image
The ability to drag and drop items and elements was first created by Jef Raskin, best known for starting the Macintosh project for Apple in the 1970's. Originally named the "click-and-drag" paradigm, drag and drop is a cornerstone of the user experience when interfacing with computers and smartphones. I recently discovered how to implement this fundamental aspect of designing and developing a program, using Atlassian's React Beautiful DnD Library . This library helps to simplify and more importantly, beautiful and naturalize the movement of items within an app. There are three main parts to keep in mind when designing a drag and drop feature: 1. The Draggable component, which is the item that will actually be dropped. 2. The Droppable component, which contains the Draggable components. 3. The DragDropContext component where the other components live. To test and see how to utilize the tools provided by the library in a project I'm working on, I went

Websites that Run on Magic and Wizardry, aka Ruby on Rails

Image
As a novice programmer, being introduced to Ruby on Rails (Rails for short), a Ruby-based web application framework, brought me into a whole new world with seemingly limitless possibilities. Created by David Heinemeier Hansson, Rails was brought to into this world with the goal of helping programmers become more productive, and happy . Rails places heavy emphasis "Convention over Configuration", meaning that programmers only have to specify and code out non-standard parts of a program. With Rails, beginner programmers like myself to build large, complex applications. To demonstrate how large, we'll look at 10 tech giants that were built using Rails: Connecting travellers with hosts looking to rent their house space to others, Airbnb has over 3 million listings in 190+ countries and provides services to over 200M people worldwide. CrunchBase serves as the Wikipedia of startups, and is the ultimate go-to website to see which companies are investing the co