Projects
-
Why I'm Not Doing Advent of Code (in Go)
I want to learn Go.
- another statically typed language would be good to have under my belt
- everyone seems to LOVE go
- I want to see what all the fuss is about and stretch my brain
Ergo1, I should do a bunch of coding puzzles this month in go, right?
That’s what I thought, until I actually started working with go. Perhaps embarrassingly, I didn’t know much about go before that other than the facts listed above: it’s strongly typed, and developers who use it love it, like Crossfit cult levels of love. Obviously I want to know what all that is about.
After I went through a few tutorials, I decided that I like:
- My god it’s fast. Go says “you won’t feel like you’re running a compiled language” and that is absolutely true.
- Go’s error handling feels a lot like the
Either
control structure in Java that we use a lot at work, so while I don’t have strong opinions on whether that’s the “best” way to do error handling, at least it’s familiar - Pointers (jk, I do not like these, but I should probably learn how to use them eventually)
However, besides those strengths, Go is not the best language for me for Advent of Code, which (in my experience) requires being fast, flexible, and a little bit hacky. This is the canonical way to reverse a string in go:
func reverse(s string) string { chars := []rune(s) for i, j := 0, len(chars)-1; i < j; i, j = i+1, j-1 { chars[i], chars[j] = chars[j], chars[i] } return string(chars) }
In hindsight, Go’s strengths are not those that serve one person doing silly coding puzzles for a month2. As I have now read, Go is fabulous for concurrency, memory management, for working on big codebases with multiple people, and for deploying across multiple computers, none of which I will be doing in December.
The other factor that worried me is that Advent of Code prioritizes speed. Not that I’m going to be hitting any leaderboards, but I still want to keep up with the daily exercises. I got to worrying that learning a new language while trying to be that fast might start me off learning bad patterns, and I want to learn Go correctly.
So for Advent of Code this year, it’s back to Python for me, which is great because I can always improve there too. The first day wasn’t so bad so far. And I’ve picked out a Coursera course on Go that I’ll be working through instead.
-
About The F*ck
Dunno how y’all are feeling lately, but I just have a lot of curse words on my mind. And by complete coincidence (actually no really), continuing with my theme of terminal tricks I have discovered the most perfectly named, magnificent app: The Fuck. It corrects your previous console command. All you have to do is install it and type:
fuck
.Here’s an example that I have already used (twice):
➜ git push fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master ➜ fuck git push --set-upstream origin master [enter/↑/↓/ctrl+c] Counting objects: 9, done.
(And yes I’ve done
git config --global push.autoSetupRemote true
but I just got a new work computer argh)It also works on typos:
➜ git stats git: 'stats' is not a git command. See 'git --help'. The most similar command is status ➜ fuck git status [enter/↑/↓/ctrl+c] On branch main Your branch is up to date with 'origin/main'.
I suppose I could make aliases for all my common typos but this is way easier. Also, it’s fun to type swears in the terminal.
It auto-configures itself after you install it and type
fuck
the first time, and even can configure itself withfish
(which I’m trying out on my work computer). Also, have I mentioned it’s fun to type swear words? -
Webpack, Explained by Someone Who Just Learned What It Is
Image by digital designer from Pixabay
What is webpack?
At a recent casual meeting of Women & Gender eXpansive Coders DC (a local group I’ve become involved with over the past year) a Python user asked me this question, and boy did I stutter out a non-answer. I think I said something like, “Webpack is a build tool that magically bundles all your Javascript for the web.”
Does that sentence actually mean anything? I mean, I think I got the basics down, but I did use the word “magically,” so negative points for that. Also, pretty sure I inserted about a million “um”s as well.
I work with Javascript pretty much daily at work, but I’ve never really put much thought into Webpack or other Javascript build tools. That’s probably a good thing – after all, it shouldn’t be something I need to think about – but I decided I should have a slightly deeper level of understanding of these tools that are ubiquitous in modern front-end development.
For this post I’ll be talking about Webpack exclusively, but know that it’s not the only tool out there.
Okay, but what is Webpack, actually?
(Most) modern websites need Javascript to run. (This site uses no JS, thank you Jekyll.) Javascript used to be just added to the top of each page where you wanted to use it:
<!--index.html--> <html> <head> <script src="notavirus.js"></script> </head> <body> ... </body> </html>
//notavirus.js window.alert("Your computer has been compromised! Click here to download our malware remover!")
And that worked fine for years. It was all we had and we were okay with that.
-
Getting Unblocked, Faster: 5 Lessons from Journalism (and One Bonus Lesson) That Can Help You Ask Better Questions
Most loyal readers of this site know that before I was a software engineer, I was a journalist. I pivoted to my new career during the pandemic and have zero regrets! But there are certainly times I am grateful for my journalism training.
Frequently those times are when I need to get unblocked. I believe I can get unblocked faster than the average person at my level because my former career has taught me how to ask questions. Here, I’d like to share those tips so that you, too, can ask better questions.
1. Find your expert, and embrace the directed question
If you’re writing about the pandemic, you need Anthony Fauci on the line. If you’re debugging React, who’s your subject-matter expert?
At work, I try to notice who’s really good at certain tasks, whether or not they’re the official on-call for that task or service. I don’t hit them up all the time, but if a question in a public channel goes un-answered, or something is extra-urgent, I’ll send a quick DM.
Outside of work, I try to do the same, although sparingly. This blog is made using Jekyll, and for the most part I don’t have to know any Ruby to maintain it, but you absolutely bet I took notes when a woman in my local women-in-tech meetup was solving leetcode problems with Ruby one-liners.
Where else to find your expert? If your company has a formal mentorship program, get matched up with a mentor, and find out what they’re great at. Then say, for example: “I know we meet [biweekly, or whatever the time period is], but I’m new to [thing], and I know that’s one of your strengths. Would it be OK if I reached out outside of our set meeting times if I have a question about [thing]?”
Are you part of a tech meetup, Discord, user group (are those still a thing)? Sometimes a polite, respectful note to a helpful person there goes a long way.
All this does not overrule the idea that public conversations are, in general, better than private ones, because if your conversation is public, more people can learn from the discussion. But realistically, sometimes you just gotta get an answer.
-
Teaching a Reinforcement Learning Algo to Play Queens
Once you have created infinite games of Queens, you need to play infinite games of Queens. I don’t have time for that, so the next logical step is to teach the computer how to play, taking humans out of the equation entirely.
A very cool data scientist I know recommended getting to know reinforcement learning algorithms. These are the AIs that do cool things like speedrun Mario. Why not train one to beat Queens? Why not, indeed. Ignoring the part where I have no experience in machine learning and don’t think much of my math skills (I was a middle school mathlete, but I still don’t think much of my math skills), this should be fun. Follow along with me as I take my first steps into machine learning.