Posts

Showing posts from October, 2020

Comments Suck and You Probably Write Too Many

Image
The post Comments Suck and You Probably Write Too Many first appeared on Qvault . I often hear that we need more and better comments in the code we write. In my experience at previous companies as well as at Qvault , we often need better comments, we rarely need more, and often we need less. Before you crucify me for my sacrilege, let me explain. #1 – Incorrect Comments Incorrect documentation is worse than no documentation, and redundant documentation is worthless. Let’s remove the chaff. Developers typically (and rightly) take the path of least resistance when trying to figure out what a piece of code is doing. When provided a function with a comment, many developers will read the comment instead of reading the code itself, especially if the function is long and complex. Let’s take a look at this trivial example: // replace changes all the commas in the text to colons func replace(s string) string { strings.Replace("s", ",", " ", -1) } Whe...

How to Learn to Code; Top 6 Code Academy Alternatives

Image
The post How to Learn to Code; Top 6 Code Academy Alternatives first appeared on Qvault . Learning to code in the digital age is a skill that will serve you well throughout your career and life in general. However, we’ve found that many get overwhelmed trying to find the right platform, the perfect first language, the best framework, or the best online communities. There are many options out there, and where you’re at in your educational journey will determine where you should start. Let’s dive into the top 6 best code academy alternatives and what their strong suits are. Why Learn to Code? Learning to code can help you in many aspects of life and for many provides a stable career with a bright outlook. In addition to a great salary, becoming a developer can provide some of the following benefits: Remote work, depending on the company Flexible schedule, no one needs to cover your shift Casual dress, very few tech companies have a strict dress code Practice with left-brain ana...

How to Restart All Pods in a Kubernetes Namespace

Image
The post How to Restart All Pods in a Kubernetes Namespace first appeared on Qvault . Where I work we use a repo-per-namespace setup and so it is often the case that I want to restart all the pods and deployments in a single Kubernetes namespace. Maybe I want to see the startup logs, maybe I want to take down production for a few seconds, don’t question my motivations. Anyhow, what does matter is that bouncing all the deployments one-by-one is really obnoxious and I don’t like typing. In true developer laziness fashion I wrote a little script that will do it for me: deploys=`kubectl -n $1 get deployments | tail -n +2 | cut -d ' ' -f 1` for deploy in $deploys; do kubectl -n $1 rollout restart deployments/$deploy done The usage is fairly simple, assuming we named the file kubebounce.sh ./kubebounce.sh {NAMESPACE} I made a little open-source repo with installation instructions if you want to add it to your $PATH. Be sure to star the repo if you find it useful. How It ...

The Nuances of Constants in Go; Go Isn’t JavaScript

Image
The post The Nuances of Constants in Go; Go Isn’t JavaScript first appeared on Qvault . Constants can be confusing and easy to misuse in Go if you are coming from an untyped language. Let’s take a look at some of the nuanced details of how they work in Go. It’s probably unsurprising, but Go’s constants are almost nothing like JavaScript’s bastardized version of the concept. Go vs JavaScript Many programming languages support constants, often denoted by the keyword const . Go and JavaScript both declare new constants in the same way: const frameRate = 60 Constants in Go Must be able to be assigned at compile time. The value of a const can’t be the result of a runtime calculation. Run faster because the compiler can make specific optimizations. Cannot change. The compiler will not allow them to be re-assigned. Only work with some types. Arrays, Slices, Maps, Structs, etc… can’t be made constant Are not normal Go types unless explicitly assigned as such Constants in JavaSc...

6 Things to Avoid When Contributing to Open-Source Projects

Image
The post 6 Things to Avoid When Contributing to Open-Source Projects first appeared on Qvault . With #HacktoberFest being a thing, there has been an influx of devs desperately trying to contribute to their favorite Open-Source projects. Unfortunately, many of these pull requests have been a waste of time, with the maintainers ultimately unable to use the contributions. Maintainers don’t want to waste their time reviewing bad PRs, and contributors don’t want to waste their time writing code that will never make it into production. Let’s take a look at some common pitfalls that developers fall prey to when working on an open-source project. As a side note, we recently open-sourced the Qvault front-end, so take a look at that if you want to help out. 1. Don’t Start Work Without Approval If you hop into a Github repo and find something you don’t like, don’t immediately open a pull request. Follow these steps instead: Is there already an issue logged? If not, make one. If there ...

Free Functional Programming Course Released – JavaScript and PureScript

Image
The post Free Functional Programming Course Released – JavaScript and PureScript first appeared on Qvault . We just launched our new “Intro to Functional Programming” course , and frankly, I’m a bit exhausted (more on that later). This course is an interactive code-in-the-browser course that teaches the basics of FP in JavaScript and PureScript . In order to celebrate this launch, we will be offering the course for free on signup (using the 250 free signup gems) for the entire month of October ! Even if you can’t take the course this month, be sure to create an account and claim the offer 🙂 What’s In the Course? There are 5 modules: Recursion Pure Functions Data Structures PureScript Higher Order Functions The goal of the course is to cover the basics of FP in such a way that students can implement the concepts in any language, framework, or even just for theoretical practice. We go over functional versions of various algorithms and data structures, learn the difference...

How To Correctly Validate Passwords – Most Websites Do It Wrong

Image
The post How To Correctly Validate Passwords – Most Websites Do It Wrong first appeared on Qvault . You’ve probably visited a site and attempted to sign-up only to be met with errors such as: Password needs a capital letter Password needs a special character Password needs to be at least 8 characters I just released a package in Go that solves this problem. Check it out and give it a star here: go-password-validator . If you want to understand how it works, and how to properly validate user passwords, read on. Not only are the rules above quite annoying, but they can also be a security flaw in the system. Take for example a strong passphrase: super worm eaten human trike . That passphrase has plenty of entropy (randomness) but it wouldn’t pass the first two validation steps given above. XKCD puts this best: The Problem – Allow Users to Use Any Password Format as Long as It Has Enough Entropy We don’t care if a password only has lowercase letters if it’s long. All that ...

How To Hire Developers – 6 Tips From Someone You Probably Shouldn’t Listen To

Image
The post How To Hire Developers – 6 Tips From Someone You Probably Shouldn’t Listen To first appeared on Qvault . So you want to hire a developer? Or maybe you just want to know what is going through the heads of employers like myself. Either way, let’s dive right into what I think are best practices for hiring programmers. I’ve found my opinions to be quite controversial, but I do put them into practice in my own career and at Qvault . When you inevitably disagree with some of my points, feel free to @ me . The following process assumes essentially no HR to help (which I think is probably a good thing), and definitely no recruiters. I only have experience hiring direct to small(ish) companies. #1 – Throw Away Resumes With >2 Pages Like really. When I post a job I get so many candidates. I need a way to quickly filter out some bad apples. I don’t have time to read about your high-school lifeguarding job. Ideally, all resumes would be exactly 1 page . If you have hundreds of...

Running Rust in the Browser with Web Assembly

Image
The post Running Rust in the Browser with Web Assembly first appeared on Qvault . I’ve recently been working on a Rust course for the Qvault app . In order to write a more engaging course, I want students to be able to write and execute code right in the browser. As I’ve learned from my previous posts on this topic, the easiest way to sandbox code execution on a server is to not execute code on a server. Enter Web Assembly, stage left. For those of you who don’t care about how it works, and just want to give it a try, checkout the demo: Rust WASM Playground . How It Works The architecture is fairly simple: User writes code in the browser Browser sends code to server Server adds some glue and compiles code to WASM Server sends WASM bytes or compiler errors back to browser Browser runs WASM and displays console output, or shows compiler errors Writing code and shipping it to the server hopefully needs no explanation, it’s a simple text editor coupled with the fetch API. Th...

Top 4 Coding Languages To Learn For Beginners (2020)

Image
The post Top 4 Coding Languages To Learn For Beginners (2020) first appeared on Qvault . Coding languages, tools, and frameworks are in a constant state of flux, improvement, deprecation, and popularity swings. Let’s take a look at the top 4 languages for new programmers to learn in 2020. As it happens, we support all four of the top languages on the Qvault app , and have courses for JavaScript and Go, with Rust and Python courses in active development. If you are interested in furthering your career, be sure to check it out. 1. JavaScript Created: 1995 by Brendan Eich JavaScript has truly become the language of the web. JavaScript is the only language (besides the barely-supported Web Assembly) used in frontend web development. Because it’s the only language that runs in the browser, and Node.js allows JavaScript to be used on the backend, JavaScript is really the only language that can do both frontend and backend well. JavaScript is one of the older languages on this li...

Education’s Shameful State of the Art

Image
The post Education’s Shameful State of the Art first appeared on Qvault . Higher education had its problems before Covid-19. Now the crippling inefficiencies, backbreaking cost, and lack of alternatives are being forced into the spotlight. We’re working on what will eventually grow into the alternative to overpriced universities and ineffective Bootcamps at Qvault . In the meantime, let’s take a look at education’s biggest problems, and how we can solve them. Inefficiencies and Cost Universities and coding Bootcamps both suffer from a crippling cost of operation and pass that cost on to students. Think about all the expensive shit students are footing the bill for: Buildings and real estate. Their construction and ongoing maintenance. Salaries of not just the professors, but the administrators, counselors, coaches, etc. Overpriced textbooks. Students set aside ~$1,200/year just for books. Amenities that many students don’t use. Tutoring centers, gyms, computer labs, librarie...