Developing the basics : programming myself, post five
Head First Programming book review
Over the last few weeks, I have been concentrating on just one source of learning to program. I’m hoping that focusing on a single course will actually make it much easier to make progress with the learning. The book I have been using was Head First Programming by Paul Barry & David Griffiths.
First and foremost it is worth mentioning, there is absolutely no affiliation program going on here, I don’t get paid by them, interact with them or anything. The Head First series is pretty renowned for providing people who want to learn technical subjects with a concise, interesting, and broad way of doing it. They have a great method for teaching which takes into account a lot of the most up to date learning theory techniques, and cognitive science to create a textbook type course which is really easy to grasp and get a lot out of.
How long do you need and is it worth it?
I originally gave myself two weeks to get through this book as it is about 400 pages, and as the pages have a lot of graphics and white space on them I figured this would be enough. It isn’t. I am still working through it after three weeks, though the end is in sight. I would say that if you just did this book, then a month would be a good amount of time to set aside to get through it. But is it worth the time? Honestly, I think this is one of the best kind of books on programming I have so far come across. The examples are interesting and leave a lot of room to expand on later, the exercises on top of this (so long as you don’t cheat) force you to recall a lot of what you are learning, and so it does tend to stick better.
Getting the most out of it
My advice for getting the most out of this book would be to do an exercise and then come back to it later and try to write out the full code from scratch. Especially the code magnet exercises. It is probably the most difficult part of coding to be able to figure out what you need to implement the code, especially when you have no point of reference to build off of. The book uses Python, so you can still use Pycharm Edu effectively, though the terms given to the concepts they are describing are not Python-specific. I found this out when I was trying to describe a hash to a Python developer (apparently it is not a hash but instead a dictionary), so this specific terminology should be taken into account. Also, they say too that some of the ways of implementing the code can be done better in Python, but they are not teaching Python specifically but programming as a whole. This does though mean they get into interesting parts quite quickly, like how to access databases with code, using libraries, and using other technologies like Twitter.
It starts off by getting you used to the types of code and doesn’t hang about on them too long, instead, moving quickly through to functions, then data and files, databases, and modular programming. The best part of the book is you get a lot of practice putting together the code and testing it on real-world applications. So you can see the code in action and modify it to see what breaks. My first concern at this point was a lack of debugging lessons early on; it does include exercises which have broken code in them or code which does not work as expected, which it then goes on to explain. So debugging is covered but not early on and not in a traditional way, it can be pretty useful to carry on reading through the book if you get stuck as usually, the next page explains the issues and why it happened.
Tip of the day: using libraries (packages) in PyCharm
This book also uses Pygame. I managed to do a lot of importing of the built-in libraries like “math” etc. But trying to import Pygame was my Everest. As it is PyCharm Edu that I am using, there is a very specific (easy when you know it) way to work with these awesome libraries.
Looking it up on the internet the instructions I got where:
Pygame requires Python; if you don’t already have it, you can download it from python.org. Use python 3.6.1 or greater, because it is much friendlier to newbies, and additionally runs faster.
Visit here to download pygame: http://www.pygame.org/download.shtml
The best way to install pygame is with the pip tool (which is what Python uses to install packages). Note, this comes with Python in recent versions. We use the –user flag to tell it to install into the home directory, rather than globally.
python3 -m pip install pygame --user
And it is supposed to be that easy. So I pip’d, I installed, I failed, and then I even shouted at my fricking rubber duck. Nothing worked. Anyone who has ever been in a situation like this can probably understand the frustration. Instructions that generally seem to imply something should be that easy is my nemesis. So now, I had an Everest of a nemesis, and the internet was laughing about it like “it is easy, just use pip.” Then came a shining light from the PyCharm Edu development team (after they first asked if I had pip’d). For anyone using PyCharm Edu as their IDE, here is the best way (IMO) of how to use Pygame (and probably any other library):
First, go to File > Settings…
Click Project Interpreter and find the green “add” symbol on the right.
Find the library you are after, click ‘install package,’ and you are good to go.
It seems simple now, looking back at it, but when you are trying to get something like this to work, and you are not sure on the procedure, then it can feel pretty rubbish.
Overall I recommend this book. I give it an 8.5 out of 10. I currently don’t have much else in terms of programming books to compare it against, but I think this deserves a pretty high mark. It has explained a lot of the concepts in a way which is relatable to, and the application of the code, though it is comical, is useful to see and understand how the code functions and can be used in the real world. Can I go out and now develop something completely from scratch? Well actually I would not rule it out, it won’t be anything totally mind-blowing, but I feel confident enough that I have some tools which I can apply to other situations, and something strong to build on. All in all, this is a great book to start with and follow through with, if you like practical examples, a light-hearted approach to learning, and like to think through and test yourself a lot; then I would recommend this as a book to get you started. It is not Python-specific, so I think that if you have an interest in learning another computer language, then this book is still pretty applicable. I’m not sure though if I have picked up bad Python code habits from what I have learned as they have not made the book focus on best practice for Python, so this will be interesting to see as I progress. The concepts in the book are not really in anyway computer science aspects themselves, rather how to use the code and how to program things, so if you are looking for a book which teaches you about the computer science side, then this probably won’t help you out so much.
Do you have any books you would recommend?
Again as I said before, we have no affiliation with this book or the Head First series. If you have a different book series which you have found particularly awesome, please feel free to give it a mention in the comments here as you might help make other people aware of it.
“The knowledge we gain from textbooks can never measure to the wisdom we gain through experience.” ― Anika de Souza