How Computer Science Kept My Project Afloat
Back in 2016, I was working for a small company building digital interactives with web technologies. Most of the time, I worked on projects for museum kiosks and things of that sort, but this particular project had me writing code for a cruise ship. The project consisted of a giant 4k touch screen where up to four guests at a time could scroll through carousels of the various ports they were going to visit on the trip. The user could then click one of these port cards and a large detail view with more info about the port would appear in the UI.
This interaction, selecting the port and displaying the detailed information in a different part of the UI (this was pre-Portals) turned out to be an expensive operation. My test data was only a few dozen items in an array, but the cruise ship was storing hundreds of these ports. Once we got some real test data (which you should try and get as soon as possible in your work), you could see noticeable jank when the user made their selection. The lookup of the info was too slow. What could I do?
Lucky for me, I had started to study some computer science fundamentals and had learned a bit about big O notation and tradeoffs in performance we make with arrays and objects. I won’t go into the details as I have already talked about this in a blog post a while back, but knowing that the lookup speed for find()
on an array is an O(n)
operation, i.e. linear time, and doing so for an object is an O(1)
operation, i.e. constant time, helped me make the right decision to change my collections from arrays to objects. This solved the performance problem and was a big win for the project.
How did I learn that? Well, I found an online course that introduced me to computer science fundamentals. Now, I’m doing the same for you.
This past week, I wrapped up filming and editing the screencasts for a course called “Data Structures and Algorithms in JavaScript” for egghead. It’s going to be released as part of their December promotion and I couldn’t be more excited to get something like this out into the world for you all to see.
The course walks through implementing several data structures: queues, stacks, linked lists, graphs and trees. It also covers algorithms for tree traversal, breadth-first and depth-first search, as well as a variety of sorting algorithms. I think it’ll serve as a great introduction to these concepts.
More importantly, I hope that the course helps to train you on how to think about the problems you face. It’s not that you’ll be implementing these data structures from scratch in your day job, it’s that it gives you the knowledge to understand the underlying fundamentals of the work you are doing and the confidence that you’re making the right, responsible tradeoffs in your applications.
It also teaches you to think divergently, that there may be more than one solution to the same problem. What are the tradeoffs made for these solutions and is one more optimal than another? Getting to a place where you can conceive of your problems in this manner, will help you break through some of your personal walls and barriers that hold you back from being the best dev you can be.
It’ll also help you pass those nasty technical interviews more often, too! 😉
I hope you’ll check it out when December gets here. I’ll send out another blast to let you know when it does.
You Thought I Was Finished
If there’s anything I’ve learned from finishing a big personal project, it’s that you shouldn’t rest on your laurels. You have to start a new thing soon while you still have momentum.
In that regard, the next big project I’m undertaking is a course on React. I want to create a course that makes React inviting to everyone, that takes you from start to finish on a project and gives anyone the confidence to build great apps with it. In particular, I plan to focus not only on the latest and greatest stuff, e.g. Hooks and Suspense, but also patterns that might one day be called Legacy React, or as I like to say, React Classic. Why? Because there will be legacy React projects around for a long time. I don’t love the idea of a brand new dev only learning the latest material and being dreadfully confused when they run into code that shows a little age. Businesses have so much money tied up in legacy code and upgrades and rewrites aren’t always feasible. Showing these patterns will be a good way to help people have well rounded knowledge.
I’ll keep you updated on my progress as this course starts to take shape!
Alright, now I’m really finished. 👋
-Kyle