Did you like reading about interfaces in the previous post? Interfaces are neat for sure but did you notice the shortcomings? I really hope you did. In a nutshell, interface tells you what to do, it does not care how you do it. Now we are taking it a step further. We are going to discuss a feature that looks like an interface but acts like a class. Continue reading “Traits”

Posted in PHP

PHP Interfaces: A class gotta do what it’s gotta do

These days I feel like in the 15 minutes that I spend watching TV, only educational good shows are on the channel with house fixing shows. I am not, in any way shape or form a handy man so it is nice to at least learn how things are supposed to get fixed. I am also super excited when I come across Planet Earth on BBC America but I can never catch it from the beginning. Even on Discovery channel, it is almost always some dudes fixing cars. At least on house fixing shows I can learn what to look for if I ever shop for a house. There is this handy guy generally named “the contractor” and he looks around the beat up house and writes down what the house has to have to function properly and that is the contract.

In programming world, I am almost certain you have heard house is an object and blue print of the house is the class. Now we can add one more thing. That contract the contractor hands out is the interface. Continue reading “PHP Interfaces: A class gotta do what it’s gotta do”

Posted in PHP

Big daddy of all that is PSR

Should I have a British accent to imply how important this section is? I hear that is super effective for getting someone to listen you. I assume that is only for people who does not have a British accent. Thou shall not go cray cray when thee organizes thy files. How was that? There is a time and place for everything and on this topic we are going to focus on the “place” section.

We talk about how nice it is to code in objective manner. Yea we do and yea it is. How are you going to approach organizing all those PHP files? Fear not. PHP-Fig team is to the rescue. They came up with a guideline to kindly tell us what to do.

Cool thing about the PSR-4 autoloader standard is that if you follow it, you can load all you need to the PHP interpreter with only one autoloader. PSR-4 lets you organize your folders and files as the prefix of your namespace.

There is really not much to it. Once you map your folders and files into a namespace, there is not much else to it.

Posted in PHP

PSR-3 – Logging

Unlike the previous two PSR topics we have discussed, this is actually an interface and not a recommendation. Here is another dirty little secret about PSR-3, it really does not matter. If you need to have a logger in your PHP application, just use monolog. I will talk about PSR-3 for completeness sake and just in case you are not able/allowed to use 3rd party libraries.
Continue reading “PSR-3 – Logging”

Posted in PHP

Two is better than one. Especially with PSR

You have probably heard before that what is inside counts. What they mean is that when you are looking, things like purpose and character is more important than the looks. Well … they are wrong. Not that those things do not matter because they do. Let’s get real though. You have never looked at anything and just loved the character or the behavior. At first, it is never what you think it is and you need to spend time to get to the truth for those things. What I am trying to say is that looks are first thing anyone takes notice of. Let’s figure out how to sharpen up shall we? Continue reading “Two is better than one. Especially with PSR”

Posted in PHP

My first shiny app

At this point I have finished 9 classes that are in the Coursera Data Science Specialization program. I am very happy about it but I still have the final overall project to complete. Last class of the program has a final assignment which requires a shiny app. Shiny is a tool in R that will write web apps that run R code. It uses bootstrap for the front end but I believe you can customize it to your liking. I am very new to it. Continue reading “My first shiny app”

Posted in R

Installing some basic R stuff

I am not going to talk about how to install R and all that. You are supposedly a programmer of sort = figure that stuff out. You can do it ! First part of being good anything is acquiring the ability to figure things out. I am not saying that you are going to download R and it will all go smoothly because most likely it will not. Install R then install RStudio. RStudio is the good stuff. If you are stuck, google it. You will most likely end up in a stackoverflow page. Continue reading “Installing some basic R stuff”