PHP

Learning PHP was interesting. I’ll echo a lot of my other classmates in saying I did realize it was a bit repetitive at times. And although I initially thought the work put into executing simple equation solutions was worth far less than the effort, when I take into account the mass production aspect of PHP, I’m more understanding.

The first meaningful tool I acknowledged though the lessons (taking them consecutively) was the strlen function to split strings into a more digestible and readable format.

For the language and technical definitions, I think the single section explaining the basics was helpful in the Objects lesson. Classes define how objects behave (and don’t have data). Objects have data. Members are variables that belong to an object, while methods are functions that belong to an object with access to its members. And constructors are methods that are executed when an object is created.

What I’m still a little fuzzy on is the concept of inheritance and private and public functions. I was able to complete the lesson, but it’s not as clear, getting to the final product without having to walk step-by-step with corrections, as I want it to be.

I’m really interested in seeing other ways PHP is used — both within the realm of this class and out of curiosity for possible future endeavors. Again, the example with the phonebook was an eyeopener as to how mass, large tasks could be done with PHP functions.

I was also wondering why, although PHP includes Javascript, HTML and PHP code, it’s free software. I was dong a bit of research and found certain licensing options, and I also found that earlier this month (Feb. 6) there was a new stable release for version 7.3.2 (not entirely sure what other functionality is involved in the latest version). But why’d the three (I believe) originators of what’s now common use PHP write a general purpose scripting language without having at continuous licensing (or at least a one time purchase) associated with its usage? I presume the more I learn about PHP’s capabilities, the more I’ll know why it could possibly for the pure benefit of fellow programmers not bound by a profit driven model.


I think the most recent lesson was really helpful for tackling areas where we were getting stuck when working the slider. The video recording of the lesson addresses all of my questions, many of which I didn’t know how to ask online.

PHP is friendly to learn

PHP was a lot of fun to learn and I really enjoyed it. I did, however, find the logic behind it a little bit redundant. I had to go over the code multiple times to understand the logic. I ended up copying the code from the top into the exercises most of the time and running it in order to see how it comes out and why. The language is also aesthetically ugly and has a slow speed. Most recently, however, there have been many changes to PHP and a tremendous speed gain. Generally speaking, PHP is an easy language to learn and tutorials are very common and often quite good, so I was not sure why I had a hard time with it.

I was curious to learn why software developers used PHP so I started reading more about it. Many developers like it, but others really do not. The language is mostly used on the server side, so it runs on the web server software. The name PHP initially stood for Personal Home Page and then later it changed to Hypertext Preprocessor.

You can do anything with PHP including blogs, scripts to process data, writing desktop applications, etc. The bottom line with this particular language is that PHP is everywhere, so a lot of extremely popular software is written in using it. WordPress is the biggest example that uses PHP. It is low cost and accepted globally, so you can use it in all website development. It also supports a wide range of databases.

It is important to note that it is super easy to change PHP to HTML. You would simply have to convert .html to .php and tweak the inside of the code a little bit to include <?php and ?> in the body. PHP is definitely evolving in many different ways since it is that widely used. It is becoming more Java-like object-oriented language. The most important language to compare PHP to is JavaScript. In modern development, we need a little bit of JavaScript for client-side development.

I want to take some time to explore WordPress and see how PHP is utilized there. I have never worked with WordPress before so this is a great opportunity to put the two together in order to understand the bigger picture. I am going to start using Drupal more often so I want to see how PHP is used there as well.

 

Making sense of PHP basics

I was nervous about being introduced to the PHP basics after the amount of time it took me to finish the gallery assignment. Another web development ingredient thrown into the mix sounded to me like a disaster in the making. This week I tried to make more sense of the purpose of PHP and I decided to turn to metaphors. The metaphor is, “the website is the restaurant and PHP is the cook who serves up a particular dinner order made from a set of ingredients. HTML is like the food on your plate when it arrives. CSS is like the restaurant decor- the color of the plates, the placement of the lights and table clothes, the quality of the silverware and the outfit of your waiter.” I understand that PHP is a server-scripting language, but wouldn’t that mean that every website requires PHP? With this metaphor in mind for the creation of websites, you can’t have a restaurant without a cook making the food. After learning a little bit about PHP in last week’s class, I feel like it would be helpful for me to reinforce the purpose of PHP with a website and then examine the impact PHP has on that website. This will definitely be one of my questions in tomorrow’s class so stay tuned!

Another thought about PHP is that it seems awfully similar to JavaScript in some aspects. For example, the “$” and for loops. I know there are some web developers that like to do HTML, CSS, and JavaScript on one file, but how do you avoid getting confused between PHP and JavaScript especially as a beginner? Is PHP basically a version of JavaScript, but for back-end purposes? Are there websites that are robust without PHP or does PHP help make the world go round in the web development world?

Is it ever helpful for beginners to understand back-end before front-end?

I found this chart on a website defining the difference between JavaScript and PHP and I thought I’d share to help other students:

 

 

HTML with a twist = PHP

Reflections on PHP

There is striking similarity between this week’s PHP lesson and HTML. But for a few differences in the syntax structure and functions, the two seem the same in my opinion. Needless to say that while HTML is a text markup language, PHP is a back-end programming language otherwise called a server-side programming language. It is fair to say a person must necessarily understand HTML and maybe CSS before taking on PHP. I also think just like transitioning from JavaScript to jQuery, a transition from HTML to PHP will be smooth and easy to comprehend, since both programs use almost same logic in concatenating among others. I discovered in my readings that, there are two different schools of thoughts among programmers on whether a person need to learning JavaScript before PHP or PHP and then JavaScript. I find that fascinating, because for me, despite the functional similarities between the two, it doesn’t really matter which one a person learns first. I will want to know what you guys think as well. I referenced a few resources on YouTube for further clarity, but ended up stopping along the way.

Challenges

A few challenges on understanding the logic behind the For loop and While loops. Also on simple arrays, it was a bit of a struggle to comprehend the logic behind the array slice and splice.

Learn-php.org

The website seem fairly basic with lots of advertisements, which are sometimes distracting, but they do acknowledge it’s still under construction so that’s fine. After all, they are offering their services for free.

 

 

PHP

For this past week’s lesson regarding learning PHP, I was initially expecting to use Codecademy, but was surprised that we were using another website — learnphp.org. I was not sure what to expect, but was happy to learn that PHP was essentially another language similar to HTML. So it started off for me as relatively simple, as most of the lessons do. However, I think that maybe I was getting accustomed to Codecademy and the interactiveness of the lessons. The lessons on learnphp.org were more difficult to understand the actions that I was doing and involved more of an attempt, attempt, look for the solution, try to make a correlation and then move forward approach.

One of the confusing things for me, or at least I know it will be confusing to execute along with other languages, is that PHP does not use carrots to open and close like HTML. Instead, it reminds me more of CSS with the semi-colons as separating elements. With the variables and types section of the lesson, it was nice to see a bit or repetition with the basic elements as a way to reinforce older lessons that were learned earlier in the semester. Specifically, the boolean values as true or false, and the strong formatting as a means to command multiple things at once. Hearing the terms over and over again was helpful because I feel that this is one of those things that you have to do everyday otherwise you forget everything you learned the day before, just like math. The arrays in the lesson plan seem easier than the ones we were learning in previous lessons because there were less of the ambiguous, or at least to me, symbols such as the curly braces, brackets, additional parenthesis, and so on. I do think that I will have to go over the lessons once again to better understand the material like I did with Codecademy before we finished our gallery assignment.

Here we go again…

Week six marked the introduction to PHP, a scripting language which, on its surface, seems relatively easy to understand. But we’ve been down this road before (JavaScript, I’m looking at you), and I know better than to assume PHP will become a stress-and-error-free part of my life as it relates to web development.

In fact, while the first lessons were easy enough, I stumbled over the exercises for While Loops, Functions, and Objects. For the most part, these issues arose from syntax errors, which tells me I haven’t seen or used enough PHP to know better (do you ever just “know” this stuff?).

There was something familiar about the lesson on Objects, though: the idea of public and private functions reminded me of the local and global scope concept from Javascript. I appreciate the literal nature of this concept in PHP—you can just call something a “public function” to designate it as such, rather than relying on its placement within the code as you would have to do with JavaScript.

A note about learn-php.org: Though it’s not as pretty as Codecademy, I found the lessons easy to navigate and complete. It also serves as yet another example of the web development world’s emphasis on the free flow of information. I’ve enjoyed our little peeks into the world of web development: the importance of community in solving problems (GitHub, Stack Overflow), the “laziness” of developers (copy and paste whenever you can), the preference for simplicity. Halfway through the semester I’m now reminded of some of the takeaways from our Week 0 pre-readings. Here’s to keeping these lessons in mind as we stare down our final project in the weeks ahead.

An update on the midterm profile assignment: I found my subject, VM Vaughn, through this article on Medium. Vaughn began learning to code at the age of 56, and told me before our interview that he doesn’t consider himself to be a “real web developer.” I was anxious to talk to him about what impact his age has had on his experience learning to code, and what, exactly, a “real” web developer is, anyway. More on that later.

Slideshow gallery

For this week’s assignment on the slideshow picture gallery, I found it challenging at times. I think since this was the first assignment in which we applied HTML, CSS, JavaScript and jQuery all at once, it was a bit overwhelming to sort through the differences of each language. What helped me the most was going back through the Codecademy lessons and reviewing all of the different languages to refresh and kind of relearn everything. It was relieving that we went over almost all of the HTML during class period to get the ball rolling on the gallery assignment. I did struggle the most with the JavaScript and jQuery portions of the gallery, which is what I expected from the beginning.

There were plenty of moments of trial and error regarding writing my code, but I did Google search lots of webpages and articles to walk me through similar projects. I personally chose to do my slideshow gallery on various puppies, which did cheer me up when I was getting frustrated and lost on what components were not working cooperatively with each other. At the very end, I added my CSS last — it is very simple, but still I was searching the internet to look for how to do things such as center align my elements, various wordings for colors and so on.

The part that had me most in a panicked frenzy so to speak was getting all work committed and saved on GitHub. I had some issues as I was confused and probably needed a break from the continuous work to look carefully at what I had completed and what was left to do. Despite getting it to work in the end, there are still lots of uncertainties I have about using GitHub and not guessing my way through whether I completed things accurately or not. I’m glad it is finished and I ended up being very proud of what I completed.

JavaScript gallery

This week was interesting. Going back and forth with the gallery took a significant amount of time. From going back through the tutorials to finding helpful YouTube videos and W3Schools pages that offer a plethora of avenues to reach the same (or similar) goal, I think my biggest issue for this week was mass overload.

In this case, I have my gallery page with tons of JavaScript (and a few different stylized buttons, etc.), but the events/const aren’t taking place like how I intended. I think with each new strategy I employed, I made the code appear more complicated and it got to the point where I wasn’t sure where the bug(s) was. In JavaScript, I actually have three different routes for coding the gallery’s auto scroll timing function. I believe I deleted the HTML- and CSS-only version, but I found a way to use span tags to link to a following or previous image. Adding a fade/transform effect to make the transition appear like JavaScript. I scrapped that because it was not how the assignment was supposed to work.

I think my biggest issue was getting the script to work inside of the container but outside of the individual images, I believe. After a while of taking a few steps backward to take one forward, I saw that the code for the script was already built, along with the container, but I ended up not being sure which code canceled out the previous.

It then made me wonder about how content management systems are built (in this case, for photo galleries). I understand having a resize function to make featured images consistent, which I initially pursued but resorted to sizing in Photoshop, but what about changing the number of images available in the gallery? After I figure out which code to delete, I’d like to know the basics around a photo being added to a collection and the container expanding (or contracting) to accommodate for different final products.

A bit of a tangent, at the three news organizations I’ve worked, I haven’t seen a wholly aesthetically pleasing gallery that fits and works neatly within a normal article. I have seen and used sliders for posts designed for the slider to have preeminence on the page, but the gallery function toward the middle of the page below the A section of an article is often very basic or clunky. And most news organizations I’ve seen generally rely on single images within the text to avoid addressing it, which leaves image heavy stories lacking in ways that simply linking to photo gallery pages (which statistically aren’t clicked at large rates) aren’t the solution.

JavaScript & jQuery: Challenge Accepted

I walked out of the February 12 class feeling somewhat positive that I could rock this gallery assignment. I quickly found out that feeling would not last as long as I would have liked it to when I was put to the test to do the gallery assignment on my own. During Tuesday’s class, my eyes were glued to the screen as my instructor went through HTML and the pseudocode for JavaScript. With Codecademy as my resource and a head start on the gallery assignment, I was not going to accept defeat. This assignment was going to be the best one yet, as so I thought!

Here is a run-down of what happened this week following the Tuesday class:

Wednesday: JavaScript lesson review

Thursday:  jQuery Codecademy review

Friday: reviewed class lecture on Google Drive

Saturday: stared at pseudo code, used YouTube as a resource

Sunday: felt confident, reviewed gallery pseudo code, felt stressed, emailed instructor, desperately emailed 2 classmates for help, met up with 1 classmate, did my best to throw something together, felt defeated

Ultimately, my goal was to meet the deadline, but I became frustrated when I could not figure out how to get my buttons to work. One of the biggest lessons learned from this week’s assignment is that there is not a right way to create a finished product. I believe that my biggest mistake was overthinking that I was not doing the assignment the right way. There are so many ways to get to the final product!

I watched plenty of videos on how to create a gallery and noticed that a few people would use the hide feature in CSS instead of using this feature in JavaScript. Is there typically best practices of when to use CSS or JavaScript? I think it also confused me when I saw HTML, CSS, & JavaScript in one file of code. Do beginners separate the files to understand how each language functions or do some developers separate the files to keep everything organized?

Although I felt very defeated from this assignment, I am not going to let that get me down. I accept the challenge to eventually understand jQuery & JavaScript at the most proficient level that a beginner can be!

JavaScript/jQuery gallery: So close yet so far!

This week’s JavaScript/jQuery assignment exposed my fear in my “bringing all the pieces together” post. The reality of contextualizing the experiences from the language programs and the others. Unlike the Codeacademy tutorials that focuses on a specific skill at a time, I noticed that the marriage between the difference programming languages could be challenging. I felt like I know and understand what is being required on the assignment, yet I was struggling to pull it off.

Observations

I made an interesting observation that, spending time to understand JavaScript is a must. There is a logical reasoning that is grounded in understanding JavaScript and without that one will be limited in their use of jQuery. I was caught up with mixing the programs from JavaScript and jQuery and I understand that is fine and will work, but will prefer being consistent with one, preferably JavaScript and eventually jQuery. I also observe from other tutorials that other programs used different methods for their gallery slideshows. They always lose me when they apply a shortcut and other built-in websites programs like light box for their projects.

I am pretty sure there are lots of mistakes in the logic I used for my code, but there seems to be no way out. I’m looking forward to reading everyone’s post on their experiences.  I had my first interaction with the developer I’m profiling for the midterm assignment and she mentioned how JavaScript could be the most challenging, but the more you go after it the better understanding you gain. “It will click after several attempts.” she said.

I will like to know your views about this JavaScript tutorial I found on YouTube for assembling a gallery. It seems pretty straight forward.