DEV Community

Paul Chin Jr.
Paul Chin Jr.

Posted on

Pull Requests Are Magic

A journeyman's reflection on "Hello World"

repost from January 16, 2016

I decided that I wanted to get more involved making cool stuff on the web. In June I began self study of JavaScript. I started going to the NorfolkJS meetups and practicing on my own. I bookmarked and worked my way through every tutorial I could find on the basics of HTML, CSS, and JavaScript.

The good news is that it was really easy to get started, all I needed was a browser and a text editor. Getting started was almost too easy. The amount of free resources that I found were endless and it let me start seeing results immediately. My first NorfolkJS meeting was a Meteor Meetup, and I didn't even have a laptop to bring. Bret Fisher was leading it and he showed me a couple of things that totally blew my mind. I went home followed a tutorial and in a few hours I had a live public app! I shouted out loud! "This is magic! Just straight up wizardry". It can't be really this easy, right?
This led me to Clarke's Third Law: "Any sufficiently advanced technology is indistinguishable from magic."

Magic Virus Removal

This is Reverend Joey Talley and she casts literal spells to get rid of computer viruses. As crazy as it sounds to us, the things that I have done feel like real magic. After a few months of working with JavaScript, I had my first dream about programming. After binge watching Supernatural on Netflix, my dream was about exorcising demons, not with incantations in Latin, but by calling methods on them and writing code in the air.

Eventually my learning started to hit some walls. Reaching that next level becomes increasingly harder and the grind began. Newer and more complicated concepts required more and more practice. My mind started to think of possibilities that I didn't actually have the knowledge to produce. I wanted an app that did EVERYTHING!. Then it started to feel less magical, reality starts to set in, an empty page is not magic at all. Becoming frustrated, I started to wish for a hand waving gesture and poof ... a wild app would appear! But before I started building altars and sacrificing goats, I resolved to get better at learning and get better at asking for help.

Keeping it going

Actually writing the code isn't the hard part, but having enough knowledge to approach the problem is incredibly tough! Knowing how to organize your code, what to search on Google, or knowing what questions to ask at a meetup is what keeps my brain working the hardest. I have to give the members of NorfolkJS a ton of respect and thanks for throwing terms at me to help with my searches. It reminds me of the Wizards of Earth Sea where knowing the true name of something gives you power over it. Those keywords became the ingredients I added into the cauldron of Google that brews up the answers in a wisp of Stack Overflow posts.

Back to pull requests

I wanted a chance to make a game, because games are fun and interactive and really hard to make. I reached out to my college roommate, Marcus. He designs board and card games in his spare time and I asked him for a simple game that I could make into a web app. Marcus then invented Dice Wars for me. The rules were simple and I knew how to Math.rand(). Cool.. I can build this! I had a working game after a few days. It was glorious! I like to post my work knowing that it has limitations and places to improve, but I'll never make it better if I'm the only one it touches. So I posted it to a local developer Slack channel and I got some unsolicited feedback.

Here's the original code:
You will see that I had a new function for every action with lots of code repetition.

Then in Slack, Matt C. said: "the next step would be to get the players into their own DOM container and use classnames instead IDs."
WOO! I was thrilled! I got feedback! But I had no idea what any of these words meant. But that's OK! Alright, I'm thinking to myself … DOM Container. Ok… Document Object Model… Container … a thing that contains the document object model … wait what??

Then all of sudden I get an email alert, saying there was a pull request. I was like, what the heck is this? It took me a second to realize that someone was sending me help! I accepted and merged the changes and BAM! The magic came back, the code on my machine changed and it unlocked a whole new way of thinking for me.


Aw yea, the magic's back. Thanks Pull Request! Seeing the actual code changes really helped cement the idea into brain. My original code had a different named function for each action. Matt's code showed me how I could rewrite my game to only have one function for the action, then pass a player in as a parameter! My program had fewer lines of code and was easier to fix and modify. It was just two lines of code and my whole world changed. The code contained in the pull request was was more expressive than the English words he typed into Slack. The CODE itself was more expressive than the language we use every day to communicate. You can't tell me that this shit isn't magic.

Empower yourself and others around you

I eventually used his knowledge, cast a few more spells, added animation, and created a UI that allowed the players to take turns. I learned that if I didn't put myself out there and get involved with others, I would have never been able to make the huge leap that day. All developers have access to more knowledge than you can imagine and while it can be overwhelming at first, just give it some time and take a step back. If you're having trouble, give it a good solid think and put it out there. You will be surprised at what you get back. No matter what your skill level is, you can be someone else's wizard. For more experienced people, you have the opportunity to use your magic and really change someone's life. You know more a lot more than you think, don't dismiss your knowledge. Realize that we are all magicians.

You're a Wizard Now!

Go forth and cast your spells!The final game can be found here:
Thanks for reading and please find a way to help your local developer groups.

Top comments (0)