Update on life, as well as more blabbering on PHP

You know, at one point I was going to use this blog as a vehicle to talk about what’s happening in my life. However, things changed as I started learning PHP, and now here I am talking about programming and design and stuff. This wasn’t how it was meant to be! (As you may have guessed, I’m going to talk code again. Before I do, though, I’m going to at least try to write some kind of update on how I’m doing.)

Work at Mainstreethost is going quite well. I had my 90-day performance review a couple weeks ago and passed it with flying colours. This is especially nice because I really do like it here a lot. The apartment is feeling more “homey” too. It’s not quite where I want it to be yet, but it’s getting close. Once I get a bit more furniture (like a couch, armchair, stuff like that) I think it’ll be set.

The last couple months have been very busy. I’ve been trying to keep on top of all the new stuff that I’ve been learning, but it’s a difficult mindset to switch to – while what I’m doing is still solutions-based work, which I love, I was originally a tech support guy, not a coder. Now, not only am I coding, but I’m coding a timeclock system…something that I thought I wouldn’t have to think about again. I’m also doing it in CodeIgniter, which is yet another completely new technology to me. The idea of frameworks – well, I mean, the idea of how to write PHP in general was new to me a few weeks ago, so frameworks are just another thing on top of the pile of things that I’m trying to pick up on the fly – with this project, that list also includes jQuery, AJAX, and Bootstrap 3 (which, to be fair, is pretty similar to Bootstrap 2, but still, it was an adjustment). As I do try and keep these posts accessible to everybody, I’ll try and explain the concept of frameworks as I understand them.

Basically, a framework is a set of conventions, maybe some shortcuts, to help you modularize and easily develop a web application. This might include things like making database connections easier, or allowing you to easily manipulate data that you wouldn’t normally use. (For example, in CodeIgniter, it’s really easy to use what’s called “session flashdata”, which is data that basically only lasts until the next time you refresh the page. I use this to pass alert messages to the user; for example, “Clock submitted successfully.” would get posted into an alert box using this flashdata when someone starts clocking time. While I could do this using raw PHP, it would be a lot bigger pain because CodeIgniter has a shortcut that makes it straightforward while raw PHP does not.

Similarly, Bootstrap 3 is a framework, but in a different sense. Where CodeIgniter is helping me on the back-end, Bootstrap helps me design the front end of the web application – what the users see when they log in to clock time. Without getting too in-depth, Bootstrap applies styles to various elements of the web page based on “classes” that are assigned to those elements. For example, in my alert above, to display the “Clock submitted successfully” message I use the “alert”, “alert-success”, and “alert-dismissable” classes. These apply styling which make the alert appear with a green background and be able to be closed on the page. Other things that I can (and do) use Bootstrap for include navigation bars at the top of the page, nice-looking tables, and form input fields that will resize based on the size of the window the page is displaying in.

Anyway, when I put this all together, it led me to a much easier method of development. Instead of using raw PHP code to write my timeclock, I put it together using function-based programming in a CodeIgniter environment. It was so much easier and quicker to do things this way, and while I still think coding in pure PHP has its benefits, especially when I was first learning the language, a framework can really speed up your development processes.

Another method that I think is worth mentioning here is something that I found myself doing a lot over the course of developing this project. When I ran into a bug, I would typically ask another programmer about what might be going wrong – however, this process would often simply involve me talking for a couple of minutes, suddenly stopping, and then saying something along the lines of “…Oh, that’s what’s going wrong. Thanks for your help!”

Apparently I’m not alone in this one, at least. Rubber duck debugging is apparently an actual thing, and is actually what I intend to graduate to later this week. (Of course, since I don’t own a rubber duck, I’ll use something I do own – my stuffedWeighted Companion Cube.)

I’ll try and post these updates more often; unfortunately, this timeclock system has been keeping me very busy! I’ll try and post some cool screenshots later, though. There are a lot of really cool features that I’m very proud of and I can’t wait to show them to you!

Leave a Reply