When I was 10, my sister was learning QBASIC at high school. As most younger siblings do, I harassed my sister to entertain me almost constantly. Eventually, my sister got annoyed with me and handed me some floppy disks with games on them so I would leave her alone. These games were written in QBASIC and the files were not compiled, so I had to open the IDE (or the equivalent of) to play them. After I quickly got bored with the rather simple games, I started to mess around with the QBASIC code to see what would happen if I changed things around.
From this, I taught myself how to make my own programs; these were usually quizzes that I asked everyone in my family to complete and usually were some form of Harry Potter trivia (I was seriously obsessed). My sister was also learning HTML at school and those floppy disks contained some of the websites she’d built. They were your typical 90s web design fare with animated GIFs, marquee and blink tags, and clashing colour schemes. As with the QBASIC programs, I opened these webpages up (with some guidance from my sister) in Notepad and started moving things about to figure out what was going on. This was late 1990s, early 2000s and we had the internet but my mum ran a business so I was only allowed two hours a week on the internet in one hour blocks so I didn’t tie up the phone line for too long. I used those one hour blocks of time on the internet to download and print tutorials on HTML. It was funny in a way, on 56K internet I could only find and print maybe two or three tutorials in the time I had… it’s kind of crazy to think we’ve got internet over 1,000 times faster in our pockets at all times. I spent a lot of time learning the ins and outs of HTML, I got free web space online and hosted my Harry Potter fan site (I told you I was obsessed). It wasn’t until I was about 14 that I was introduced to CSS and PHP. I took to CSS pretty well, spending hours moving divs by two pixels to get my layouts just right and then having to start over because Internet Explorer 6 implemented it completely differently and it looked like crap. I don’t miss those days, but I’m not that keen on the generic framework-y mess that web design has become in recent years where most sites look like the same rehashed Bootstrap template. PHP was kind of a different kettle of fish though. I had a friend that helped me make my website a little easier to update with PHP include(). That was about the extent to which I learnt PHP and I used and reused the PHP include method across multiple recodes of what was then a help site for a virtual pet site I played (think Neopets but less commercialised). Sometime around when I was 15 or 16, when I was dabbling in a lot of Linux, I consecutively tried to pick up lots of different languages.
I tried C#, C++ and Perl all within the space of about a year. I never really got far with them because I’d hit a wall in understanding and had no one to help me. I hit the same wall every time… somewhere after loops and arrays, where the difficulty just seemed to ramp up insanely in whatever book or online tutorial I was following. C++ was one of the worst for this, I had a For Dummies book that went straight from arrays to pointers, without so much as an introduction. So I kind of just bumbled along with my HTML and CSS throughout most of my teenage years, trying different programming languages and never getting very far with them before getting overwhelmed and giving up. I didn’t realise until around early 2016 was that I was missing something pretty vital to learning to program. It was pointed out to me by someone far more experienced in programming; I didn’t understand the logic of what I was doing. This was evident in the types of bugs that manifested themselves in my code and my lack of understanding when the reasons for the bugs were explained. That experienced friend suggested that I would get some benefit out of purchasing a discrete mathematics book and working through it. So that’s what I did. I bought a book called Discrete Mathematics for Computing by Peter Grossman and read through the first chapter. The end of the first chapter offered exercises like the following:
|
|
The book dictated that these lessons be completed in pseudocode similar to the way in which the question is posed. I decided that the more valuable way to approach these questions would be to code them in an actual programming language. At the time, I was learning JavaScript and I’ve included my JavaScript solution below but I quickly found that people online had opinions about JavaScript and it was extremely difficult to get assistance with certain things in the vanilla language. Some of my questions were answered with “Why aren’t you using JQuery?” and the answer is “Because I’m a beginner.”
|
|
I expanded on this one a little over the initial exercise, adding a sum and an average of the list of numbers entered. I am glad to have finally found a method that seems to work for me and a place to find exercises to do as practice seems to be the most important part for learning and in particular, being able to add features and then troubleshoot those features. Here are a few other resources for PHP exercises I found during my search for things to code: Exercism PHP Exercises, PHPExercises.com