Monthly Archives: November 2014

My Journey thru OOP (Object Orientated Programming) – Day 1-2

I am by far no expert programmer, however, over the years I have worked to learn just enough principles to carry me through a world wind of scenarios. Though most of my learning has been on the fly, thanks to my previous employers ;-), my perception of the web and applications are beginning to change over all. For a while I looked at Software Applications as a whole other beast, but these days I see the development community working hard to sew the seams in web and software technology. HTML5 I can say has made this possible…

My employer is notorious for development projects on the fly. My dev team can literally be working on a project involving big data that is supposed to span into a completion date, but because our field of work is so key to our clients, there are times (like every other day) where we need to stop the big important project and begin another big important project. The catch is usually, the new rush project is usually due in 2-days, fully tested and deployed to the client before the deadline.

This type of demand had me thinking of ways I could modularize my various development needs. One main process I see we utilize a lot is a Login feature. Mostly every project we work with, requires us to define a Login security feature allowing user to access secure content. For months, my team would reuse content and modify were needed. I’ll be honest with you, though copying-and-pasting code is easy to implement and mod, it gets messy. Especially if a team member accidentally copy’s over or edits the example docs instead. Been there, done that!

My thought process begin to change when it came to code reuse and modular architecture. We (My org) are a Apache/Linux environment but do also support and work in Windows which has a far more structured framework that handles the heavy lifting of object orientated programming. I am most comfortable in a .net, asp/C# environment when working in Windows so I am familiar with Class, Methods, Constructors and so on. I wanted to alternative in my Apache environment so I begin looking how to construct this same process in PHP.

Day: 1-2

My first step into my implementation is to create a Login class. This class will hold the connection strings we can add to and utilize anywhere where our script needs to execute various SQL statements. Long story short, I’ve spent the last few days defining classes for my new Login class. The classes contain our various SQL environments, my first being our MySQL connections, then our MSSQL connections, as well as Oracle. We utilize PDO in our environment so we defined all the MS connections to connect using the latest PDO security standards.

I spent a good day just doing my research on the principles. I wanted to make sure I understood as a whole how OOP in PHP worked compared to .NET. Honestly, I see no differenced besides the different syntax. The principles seem to be the same when delegating tasks and calling methods thru functions. It’s just more spelled out in .NET and more straight forward in PHP. My next couple of days I will be completing all the configurations for our other connections and defining them into classes.

My next post will be about the next module I’ll create in my quest to modularize some of our development features using object-orientated programming. Here’s a screenshot of my login-class. There is a separate file called db-mysql.php and db-mssql.php which holds the variables with db values.

Screen Shot 2014-11-09 at 10.37.11 AM

Advertisements
Tagged , , , ,
%d bloggers like this: