I constructed the Battleship game with JavaScript and uploaded it to GitHub. It’s a game I found in the book “Headfirst JavaScript Programming” by Eric Freeman & Elisabeth Robson, and I call this constructing because it was not me creating it, rather it was me following the instructions like for an IKEA furniture, to make the game work. And it works. Unfortunately, I can’t take much credit for it except for being able not to leave any bugs in the process of constructing it. But there were a couple of things I have learned on the way.
One of them is the fact that I need more projects like that to start connecting the dots. There already were a few things I used that I have learned in my other courses, and I recognised them before they were mentioned on the book (along with some code that looked like old Javascript and I knew there was a newer, better way to achieve the same result but didn’t yet know what it was). True, I do feel far behind from my aim to be able to have an idea and code it myself independently from a course or a book. But there is this thing called patience and I do have a lot of it. So I trust the process and don’t rush ahead even before I can understand what I am doing.
The second thing I learned was comments. Sure, I knew they were important but only now I realized how helpful to my learning they actually are. At least for me, I found it’s not enough to just read through the code and the info in the book and agree in my mind that I understood it. Actually writing it down next to the code and trying to put it in my own words made a few things click together. Once the realisation came (about in the middle of the Battleship game Javascript coding), I started putting comments even next to the most obvious things, just because I knew it will root the information better. I still wouldn’t be able to sit down and code that game out straight away but I am a little closer to understanding the logic behind all those algorithms. And I did enjoy those heaps.
The weirdest feeling of all is that few weeks ago when I only started with the book, I put together a few lines of code that could play a basic one row, one ship kind of game with a computer; and now I made a complete, legitimate game that my 7-year-old enjoyed (to his credit, he liked the first one too). And I also liked to make this game my own by creating ship graphics and the board to suit my style. It’s nothing magical but boy I feel good about being able to see the progress. More than anything I am constantly amazed by the possibilities ahead and eager for more every day.
No progress is too small when you learn to code
I do believe that even a little progress has to be celebrated that’s why I am putting those little games on GitHub. It’s not only for prospective employers to see that I am working on something, more than anything it is for my own sake, just like this blog, to see the progress unfold. It is very easy to get into things and naturally forget where we started. I am happy that from the get-go I decided to record as much as I can so that years down the line I can look back and cheerfully laugh at my beginnings.
I encourage everyone to use Git and share even the tiniest of codes. It will come in handy when you are looking for work, or partners for your venture, or just friends who code.
Now, go and try my far from perfect little Battleship game.
This post contains affiliate links.
Disclosure. To support this website, some links that I share on this website have affiliate marketing attached to them. I only choose to represent products that I use myself and trust their brand, I don’t receive any free products. The opinions I share are purely my own and in no way affected by the brands I choose to showcase. The cost of the product on the links are not affected by this link, I only receive small commission if you use it and buy the products. Thank you for your support.
Hey man can I get the source code for this?
Comments are closed.