background preloader

Dev

Facebook Twitter

Comments aren't evil; comment your code -- ramblings of a PHP enthusiast. Dissenter: Charles, you noob! Comments are evil. They can muddy up your code, nobody keeps them up to date and they're completely unnecessary. Write short, concise code and you don't need comments! Me: You're absolutely right. Comments can be evil. But you're taking it too far! That was the envisioned conversation when you saw my bait title and wanted to come tell the new guy how comments are evil. Stop blaming the comments for how you use them Let me start off by saying that I am not encouraging the use of comments everywhere in your code. <? Please, PLEASE, stop doing this. That being said this isn't the comments fault. Doc-block all the things If it is a constant, class member, returns a value, takes a parameter, results in some side effect or is in some way a major block of code it should be documented. Dissenter: Charles you fool! Wait! <? See, that's not so bad is it?

Finally, comment your cleverness <? This closure is also stored as a github gist. Wrong. Comment it! <? Wrapping it up. Log In. Stop calling them getters and setters -- ramblings of a PHP enthusiast. I was having a talk with a fellow programmer and he said something to the effect that if a class property is commonly used it might as well just be public because it is easier to work with.

I rebutted that you should just use getters and setters and, of course, the discussion turned toward the validity of getters and setters and whether they break encapsulation. Having had some time to chew on the information I've come to a couple conclusions, the foremost being that we should stop calling them getters and setters and the second being that the use of these mutator and accessor methods does not break encapsulation. why getters and setters is bad terminology A lot of people think of, and use, getters and setters like the following class. <? In fact, a lot of IDEs will go ahead and auto-generate this boilerplate code for you. Of course, I'm not a big fan of having my IDEs make code API decisions for me but the feature is available and people do take advantage of it.

<? Conclusion.

Test unitaire

Going from solo to professional -- ramblings of a PHP enthusiast. As I alluded to in my previous post about leaving school and the state of the modern CIS program, I recently got a job! I'm really excited about this opportunity and wanted to take a look at it from a different kind of light. What I didn't really talk about much in the previous post was what it took for a solo amateur developer to join the ranks of the paid professionals.

Maybe you're in the same boat and want to become a developer in one of the most awesome industries ever. Well, this is how I did it; maybe some of the stuff I learned can help you in your own journey. this is what I think… There's no way anyone can really know, short of just asking, why they were hired by a particular company. Actually writing code This was definitely the key, essential ingredient in my career cake; the flour to your normal confectionary delight. I have several repositories on my github account and will likely have several more being created in the coming months as my ideas start to become reality. All Code Is Bad, So Don't Stress If Yours Sucks.

PHP

Architecture. DB. Javascript. Git. Microsoft. Android. Web.