Speedbumps On the Web Dev Journey


Once again, I’ve been a busy little bee and studying really hard for the current Lab test for Section 8 in my PHP and MySQL course. This time the Lab title sounded innocuous enough…”Reading A CSV File”. Okay, apparently the instructions were going to introduce something new as well as go over the material from Section 8. (I really hate that). I began to read the instructions and about three steps in my eyes started to glaze over. By the time I reached the end of the instructions, my brain imploded. This is what happens to a newbie learning a new language. Often the instructions have many of the same words repeated in different forms and each have totally different connotations. Once I regained my senses I had to read them several times. For the rest of you out there that are beginners like me, I will give you an idea of what you may come up against in you online education journey. The following were my instructions.

“The purpose of this lab is to demonstrate how to open and
read a CSV file. Copy the file “files_project_products.csv” into “htdocs/sweetscomplete/Model/products.csv”. Create a file htdocs/sweetscomplete/Model/Products.php…In the file set
up a class with the name “Products”. Define a public function “getProducts()”. Define a public function “getTitles()”.  Define a public variable $products…at the top of the file, inside the class: public $products. Define a “function __construct()”…Open the file “./Model/products.csv” using “fopen()”. Use a “while()” loop to read until “eof()”. Use “fgetcsv()” to read one line at a time
into an array $row. Using a foreach loop, convert the numeric array into an associative array which then can be added to
$this->products. Define “getProducts()” and “getTitles()”, “getProducts()” just needs to return $this->products. In this getTitles() define a “foreach()” loop using $this->products as $row. Populate an array $titles assigning $row[2]. Have the function return $titles. Modify htdocs/sweetscomplete
/products.php. At the top of the file add the statement: include “./Model/Products.php”. (btw-when I finally saw the answer they used “require” instead of include without explaining the difference). Delete the two arrays $titles and $products as they will be replaced. (Slight panic at this thought but I had backup). Create a “products” object: $products = new Products();  At the top of the file add a line “$titles = $products->getTiltles()”. Have “$maxProducts” be a count of $titles. Replace $products with “$products->getProducts()” in the call to function “displayProducts()”.”

Anyone still with me? If you passed out at sentence number 2,
I understand, I was just showing an example of what you might come against in some online courses. These directions were the longest I have had yet for a Lab exercise. Now, most of these instructions I could do but I had trouble understanding how to get the elements to work together. I could define the class and the functions even set up the loops but only partially. And the instructions were inconsistent with their punctuation and let me tell you that is a big deal to a beginner. The quotation marks and a comma that were left out could have given so much more clarity to the directions. I had to go back to my notes and really dig for examples of some of these things to find anything that looked familiar to the instructions. Once again, as I’ve experienced my whole life, it doesn’t matter how hard you prepare, the instructor is always going make certain that the test looks nothing like all the homework and exercises you’ve been studying. If you are an experienced programmer, you may be laughing right now but you were once a newbie too! And why are you reading this anyway? Nostalgia? Don’t judge me! Don’t get me wrong…I would love some advice or insight from experienced programmers regarding any computer language. The more helpful information, the better. Maybe your experiences  in learning and any advice on how to avoid any pitfalls you came upon during your educational journey. You have no idea just how your input could help us novices.

I finally made it through Section 8 and onward to 9…Managing A MySQL Database. Wooo! A little over halfway in the course and I made it to the database information. The introductory section seems easy enough but I better not get too big for my britches. Next time I’ll tell you about the latest course I signed up for but will have to wait a bit to get around to taking it. It sounds very web development all encompassing and I’m not sure if that is a good thing or a bad thing. But the very special price was too good to pass up and I don’t feel like I’m wasting money if I’m learning.

My first and foremost concern at the moment is that I’m out of coffee. And I can’t even make espresso because my tendinitis is so painful I can’t work the machine. We are talking a desperate situation. I never did get a birthday present. Who could deny me one cup of overpriced coffee? See you all later and keep learning!

 

 

Leave a comment