Sunday, December 30, 2012

2012 - What A Year

Well, 2012 is wrapping up. What a year it has been! Here's a partial recap of some of the things that happened to me and that I did this year:

Top 5 Blog Posts (By Page View):

  1. PHP Sucks, But I Like It
  2. The True Problem With PHP
  3. Anatomy Of An Attack: How I Hacked StackOverflow
  4. OOP vs Procedural Code
  5. The Secure Programmer's Pledge

Bottom 5 Blog Posts (By Page View):

  1. Upcoming Presentations - Fall 2012
  2. The True Power of Open Source
  3. The Grass Is Always Browner
  4. Programming With Anthony - Responsive Web Design
  5. Programming With Anthony - Boolean Logic

Top 5 Blog Post Referring Sites:

  1. Reddit
  2. Hacker News
  4. PHP Developer
  5. DZone

Presentations Given:

  2. Password Hashing in PHP - PHPNW
  3. Cryptography For The Average Developer - True North PHP
  4. Don't Be STUPID, GRASP SOLID - True North PHP
  5. Cryptography For The Average Developer - PHP Master Series vol 1

Conferences Attended:


New GitHub Repositories (notable):


  1. Implemented: Simplified Password Hashing
  2. Implemented: PBKDF2 Hash Function
  3. Draft: Scalar Type Hinting (with casts)
  4. Draft: Scalar Type Casting Magic Methods
  5. Withdrawn: Parameter Type Casting Hints

Some Interesting Numbers (Blog):

  • New Blog Posts: 70 (including this one)
  • Comments: 700
  • Subscribers: 695
  • Google Plus +1's: 582
  • Unique Visitors: 178,000
  • Unique Page Views of Blog Posts: 500,500
  • Estimated Total Time Writing: Over 300 Hours
  • Total Ad Revenue: $110

Some Interesting Numbers (YouTube):

  • New Videos: 8
  • Comments: 21
  • Likes: 186
  • Subscribers: 195
  • Unique Video Views on YouTube: 7,200
  • Estimated Total Time Producing: Over 30 Hours
  • Total Ad Revenue: $11

Some Interesting Numbers (Me):

  • New Twitter Followers: About 800
  • Mailing List Posts: About 400
  • Commits To Public Repositories: About 450
  • Age Change: + 1 Year
  • Miles Traveled: 22000 (12,000 by airplane)
  • Emails Received (personal): 15,000
  • Apocalypses Survived: 2
Thank you to everyone for making 2012 such a great year! Let's hope 2013 is at least as good as 2012 was...

Have a GREAT New Year, and I'll see you all again in 2013!

Wednesday, December 26, 2012

Programming With Anthony - Responsive Web Design

This week we are joined by Responsive Design thought leader Sam Richard. He introduces us to the concept of responsive web design, tells us a little bit about its history and talks about best-practice and the future of the web! Check out the video:

Monday, December 24, 2012

The Brain Is A Muscle

The brain is a muscle, and as all muscles, it needs regular exercise to keep sharp. Or at least that's what the old adage says. This is a post that I've been meaning to write for a long time now, but never got around to (until now that is). Sparked by a twitter conversation with Mr Grumpy himself (Chris Hartjes), I decided that the time was right for it. So, here's my method for staying sharp and exercising my brain...

Wednesday, December 19, 2012

Programming With Anthony - Logic

This week's Programming With Anthony video is up! In it, we discuss the foundations of Boolean Logic and introduce some very interesting tools for analyzing logical constructs (including Truth Tables and De Morgan's Laws). So without any further ado:



Monday, December 17, 2012

Seven Ways To Screw Up BCrypt

There are numerous articles on the web about how to properly use bcrypt in PHP. So this time, rather than write yet-another-how-to-use-bcrypt article, I'm going to focus on the mistakes that are commonly made when implementing bcrypt. So, let's dive right in:

Friday, December 14, 2012

Contribute to Contributors

The holidays can be a trying time of year for everyone, with all the gift buying and stress and all. I wanted to take this time to make a plea. The open source software that all of us use is powered by volunteers! Show them your support by donating! I'm compiling a list here of prominent contributors to donate to, and I strongly urge you to consider saying "thank you" to people who work hard to give you the tools and knowledge that you use every day! So, without anything further:

Thursday, December 13, 2012

Upcoming Appearances - Winter 2012/2013

I've got a few talks coming up in the near future, so if you can make one of these events, be sure to come say hi to me!

Wednesday, December 12, 2012

Programming With Anthony - Prepared Statements

The fourth video in the Programming With Anthony series is live! In this video, we'll explore the basic principles of prepared statements, and why you should use them instead of using escaped input directly in queries.

I'm still playing around with the approach and style of these videos (as well as content structure), so your feedback is extremely valuable! Please let me know what you think!



And as always, thanks for watching!

Tuesday, December 11, 2012

Response: Private Methods Considered Harmful

Brandon Savage has recently posted two blog posts portraying his opinion that using private visibility on class methods can be considered harmful in a lot of situations. While I understand the point he is trying to make, I can't say that I agree with it. I do like private visibility and think that it's actually under-used in a lot of software. But it's not because I think Brandon is wrong...

Monday, December 10, 2012

On Templating

I've been playing around with tempting engines a lot lately. For a recent project, I needed the ability to re-use the same template set in both JS and PHP (coupled with the History API, providing seamless dynamic behavior, yet still having raw content pages). Realistically today, there's only one choice for that sort of requirement: Mustache. I've learned a lot while playing with Mustache, and it's really changed my entire viewpoint on presentation layer construction.

Wednesday, December 5, 2012

Programming With Anthony - References

The third video to my Programming With Anthony series is up! In this video, I talk about variables in PHP and how they work under the hood. I explain the difference between variable references and object references, along with the semantics of each. Give it a watch!

This is the culmination of my trial at these YouTube videos. I have done a high-level one (focusing on abstract concepts), a mid-level one (focusing on the theory behind a concept) and a low-level one (focusing on implementation details). So my question to you all, is where would you like to see this go? Would you like more high-level concept videos? Or would you like more hands-on theory? Or would you like deeper dives into more technical areas?

Of course the series will continue with a mixture of the three, but I'd like your feedback on the direction of the series, so that you can get the most out of it! Leave a note in the comments with your thoughts!



And as always, thanks for watching!

Friday, November 30, 2012

The True Power Of Open Source

It's not really a secret, but I'm not a huge fan of the modern education system in America (I only speak about America, because that's the only education system that I have experience with). I'm not just talking about "higher education", but education as a whole. There are many problems with it, but I don't really want to get into enumerating the problems. What I want to talk about is the lessons that education can learn from the Open Source movement.

Wednesday, November 28, 2012

Programming With Anthony - Encryption

Encryption can be a complex beast of mathematical operations. In this video, we explore the evolution of modern cryptography and some of the basic underlying principles that it uses to keep data secure.

Wednesday, November 21, 2012

Programming With Anthony - Paradigm Soup

So, for the past few days I've been talking about a secret project that I've been working on. Well, today I'm pleased to announce the project. I've been working on starting a series of YouTube videos about programming. The first of these videos is about Paradigms (Procedural, OOP, Functional). Plenty of future ones are planned, but the topics, order and even if they happen is completely up to you! I want your feedback on the concept. Is it something worth pursuing? Any topics you'd like to see? Any other comments about the concept? You can reply to this post, or to the video itself. So, without further adue, here's the video:

Friday, November 16, 2012

Designing An API: Simplified Password Hashing

The other day, PHP 5.5 Alpha 1 was released to the public for the first round of testing the new features that are coming out. One of those new features is the Simplified Password Hashing API that I proposed (and was accepted). I have received a lot of feedback and criticism of the new API in the months since it's been committed. I figured now that Alpha 1 is out and people can play with it, I should respond to some of those items, and give a little bit more insight into why it was built the way it was...

Wednesday, November 14, 2012

Change: A Two Faced Devil

There's nothing as universally controversial in this world as change. Change can be (in aggregate) for the better or for the worse, yet people will always be split down the middle. Some will believe that the change is a good thing, and others will see it as a bad thing. Often your view points will be dictated by your perspective and how the change will directly effect you. When it comes to software projects and change, what's the right thing to do?

Monday, November 12, 2012

Anatomy of an Attack: How I Hacked StackOverflow

Almost two years ago I had stumbled upon a pretty significant vulnerability in the StackExchange network. I say stumbled, because I wasn't actually trying to attack the site. Circumstance just showed me a door. The actual attack is pretty interesting, and it holds a lesson for everybody who builds or maintains websites or server infrastructure. So here's the story on how I hacked StackOverflow...

Friday, November 9, 2012

I am not a programmer. And neither are you!

Last weekend I was at the True North PHP conference in Toronto, Canada. Aside from being an incredible experience (really, it was an incredible conference, huge props to Chris Hartjes (@grmpyprogrammer) and Peter Meth (@mrpmeth)), it was an inspiration. I was particularly inspired by both of the keynote speakers. They both really took really unique spins on programming and how the culture of open source inspires, enables and empowers programmers to do cool and important things. The problem with all of this is that I hate the term programmer. I think it unfairly paints a picture of what we do. Let me elaborate.

Saturday, November 3, 2012

Slides for SOLID Talk at TNPHP

This afternoon, I gave another talk at TrueNorth PHP. The talk is a version of a previous talk that I gave on Object Oriented Design. I've changed it significantly, so here are the slides.

Friday, November 2, 2012

Slides for Cryptography Presentation at TNPHP

This morning, I gave a talk at TrueNorth PHP. The talk was aimed at explaining the basics of Cryptography as needed for the average developer. It is intended to give a high level understanding of cryptography and cryptographic techniques. So, with no further adue, here's the slides:

Thursday, October 11, 2012

Password Hashing in PHP Talk

Last week, I was at PHP North West. The conference was incredible to say the least. One of the best I've been to in a very long time. But to the point of this post, I did an unconference talk about password hashing in PHP. Since I had my camera with me, I also took video of it. So included in this post is both the slides from the talk, and the video of the talk. So, with no further adue:

Monday, October 1, 2012

Upcoming Presentations - Fall 2012

Well, I know it's been a while since my last post here. I've been keeping busy (but also working on some cool stuff for you all, when the time is right). I figured that it was worth while pointing out a few upcoming talks that I'm going to be giving and conferences that I'll be attending.

PHP North West

I'll be a regular attendee at the PHP North West 2012 conference in Manchester, UK on October 5th through the 7th. While I'm doing any scheduled talks, I've got a few lightning talks prepared for the unconference track. I'll also be participating in the Hackathon on Friday night leading a PHP Core project hack. So come find me and say hi!

True North PHP

I will also be speaking at the new True North PHP conference in Toronto, Canada on November 2nd and 3rd! I'll be giving two talks, one on Object Oriented Design. It's similar in concept to the Don't Be Stupid, Grasp Solid talk I gave at NYPHP, but drastically reworked. I'll also be giving a brand new talk entitled "Cryptography for the Average Developer". It's aimed at introducing the concepts of modern cryptography, and arming the average professional developer with enough knowledge to be safe (a daunting task for a 45 minute talk).

Tickets are still available for the True North PHP conference, and it's shaping up to be an awesome one! I'd highly suggest that you try to make it if possible!

I hope to see you there! If you do come to either conference, be sure to find me and say hi!

Monday, August 27, 2012

Thoughts On PECL Frameworks

In recent months, a number of new frameworks have cropped up for PHP as PECL extensions (Including YAF and PhalconPHP). They promise to provide huge performance gains and lower resource usage for PHP applications. On the surface, they appear to be incredible tools for improving development. But they aren't all they are cracked up to be. In fact, I would argue that they are actually not necessary at all.

Wednesday, August 22, 2012

Object Scoping: A Triste Against Service Containers

Yesterday, I got in an interesting conversation on twitter about object scopes and what constitutes a global scope. The discussion started around a piece of code that I stumbled upon from Fuel 2.0. I am a firm believer that service containers are not a form of Dependency Injection, and are only slightly better than global variables. That led me to make a few comments that elicited a reply from two Fuel developers. That led to a rather interesting debate that just couldn't fit into 140 characters... So I'm going to go into topics that are tightly related: variable scoping and service locators.

Monday, August 13, 2012

The Anatomy Of A Great Conference

I had the pleasure of attending the North East PHP conference this weekend. I've attended a lot of conferences over the years, but I found this one to be one of the most enjoyable ones that I've ever attended. On my drive home (4.5 hours in a car gives you a lot of time to think), I was thinking about what made it such an enjoyable time. Here's what I've come up with goes into making a good conference.

Friday, August 10, 2012

Don't Listen To Me!

Or anyone else for that matter. Lately, I've been getting a lot of feedback about my posts that I'm suggesting things that are going to get less experienced developers into a lot of trouble. Or that people are going to use my posts as justification for bad practices. Or that people are going to cause major issues by putting experimental concepts into production. My initial response is "That's their problem."

Wednesday, August 8, 2012

Thoughts On Space Shuttle Code Process

Today's post is in response to an article that I read yesterday entitled They Write The Right Stuff. It's a very interesting and insightful look into one of the most complex and critical pieces of software ever produced (also one of the most expensive). I think we can learn a lot from what they are doing, but I also think we should avoid copying what they are doing. The point that's missed is practicality.

Monday, August 6, 2012

Garbage In, Gold Out

Every developer who studies computer science (and most who haven't) has heard the phrase "Garbage In, Garbage Out" before. It's such a logical concept that it's almost beyond refuting. Almost. While the phrase still definitely holds true for some situations, it doesn't hold for most. How can such a logical and straight forward saying lead us down the wrong path?

Friday, August 3, 2012

Reinvent The Wheel!

"Don't Reinvent The Wheel" is a phrase that we hear used all the time in software development. Usually it's used in the context where a library exists to do what the user wants, but they are writing their own. While the sentiment is usually correct, I can't stand the implication of the phrase. Therefore, I can't stand it when people use that phrase without understanding what it really means. Let me explain:

Wednesday, August 1, 2012

N-Tier Architecture - An Introduction

If you've been following me for a while, you've likely heard me use the term "N-Tier Architecture" before. Today's question comes from Arno. He basically asked "What is this N-Tier Architecture thing you keep talking about?"... So, to answer his question, a N-Tier Architecture is one that uses more than one tier. Of course there's more to it than that...

Monday, July 30, 2012

The Grass Is Always ... Browner?

As you can probably tell, the title of this post is based off the common saying "The Grass Is Always Greener On The Other Side." I've always been amazed by this saying, because while we can find countless cases of it being true, we can also find countless cases of it being completely and utterly false. Take smart-phones for instance. People are quite dogmatic about which they choose, and they believe that the grass is definitely not greener. This is something that's bothered me for a while. But yesterday, I think I've made a cognitive leap towards understanding why it works for some things and not others...

Friday, July 27, 2012

Framework Fixation - An Anti Pattern

In this day in age, it seems that the community trend is completely and unequivocally trending towards the use of web application frameworks. So much so that the defacto first comment to someone asking how to do something seems to be "Just use a framework, and it'll solve the problem for you." While I completely understand why this is the case, I can't say that I agree with it. And while I do believe that frameworks serve a purpose, I think that they are vastly over-used. Let me explain why...

Wednesday, July 25, 2012

DAOs and MySQL - A Response

In response to last week's ask for questions, I received a number of questions that I'd like to address. Since it would only do the question justice to have a dedicated post for each question. So I'm going to try to do one post per week on a user-submitted question (probably on Wednesday, but no promises). This week's question is a rather abstract one:
I've been learning a lot about service layers and managers and domain objects and one thing really confuses me. Why is MySQL being turned into a non-relational database? It has so much power, so much flexibility, but it seems like many programmers want to abstract it to the point of near uselessness.
Now, there are so many facets to that question that it's hard to find a starting point. But let's try:

Monday, July 23, 2012

What Generators Can Do For You

The concept of generators was recently proposed for addition in PHP's core (Possibly for 5.5.0). While I believe that this is a great tool, it appears that many PHP developers aren't familiar with the concept of generators. So I thought I would take a little time and explain some of how it works, and how it can be used to greatly simplify code.

Friday, July 20, 2012

Is Autoloading A Good Solution?

One of the most powerful changes that PHP5 brought to the table was the ability to autoload classes. It's such a useful tool that it was the first standard the FIG group put forth. Almost every single major PHP framework and library uses an autoloader to include its classes. It always felt somewhat wrong to me to autoload in production at runtime. So I decided to give it a bit more exporation...

Wednesday, July 18, 2012

The Anatomy Of Equals - Opcode Analysis

I was asked an interesting question via email yesterday. The question is fairly simple. The answer, not so much... So, rather than reply in an email, I figured that I'd write a post about it instead. The question, simply stated, is:
When comparing a float to an integer using ==, where does the conversion happen?
So, let's begin...

Monday, July 16, 2012

The Secure Programmer's Pledge

Every day I come across code that is insecure. Sometimes the code is so hilariously insecure that any 10 year old could break it. I've also gotten into discussions with people who should know better about their practices. It's very, how to put this, disheartening. It's sad that the average developer knows (and cares) so little about proper security practices. So, I've put together a simple pledge (or manifesto, if you'd like).

Friday, July 13, 2012

So, You Like To Read?

One of the things that I see repeated over and over again is the simple question "What books should I read to become a better developer?". Or "How did you learn about that?". Or even "What does a coding standard matter?"... OK, so that last one was a bit of a sentinel question, but the point is clear. Where should you look if you want to read to improve your development abilities? Well, I figured I'd take a few pages out of my library and share which books worked for me, in order of significance. If you remember from a prior post, I indicated that you should choose concepts over implementations. This list should illustrate that.

Wednesday, July 11, 2012

OOP vs Procedural Code

This morning I was asked a question that took me by surprise: "Your examples for PasswordLib are in OOP style, how do I write it in procedural style"... This took me by surprise, because the examples actually are in a procedural style. So I felt that I should write a post about the real differences between OOP and Procedural coding styles. Hint: whether you use classes and objects or not has very little to do with the answer...

Monday, July 9, 2012

Building A Multi-Version Build System

I've been using Jenkins to manage builds of my projects for a while now. This was fine for a while, but now that my projects need to support multiple versions of PHP, it left something to be desired. I wanted a system that could build against multiple versions of PHP. And more so, I wanted to be able to build against multiple compiles of the same version (different options, etc). This is how I built just such a system...

Friday, July 6, 2012

The True Problem With PHP

There's been a lot of traffic lately about what's wrong with PHP, and counter posts about how good it is. I've even fallen into the fray in an earlier article trying to step up and defend the language. The problem with almost all of these posts is that they focus on the language itself and what's wrong (or right) with it. This is not one of those posts.

Wednesday, July 4, 2012

A Tale Of Open Source

As recently as 5 years ago, I barely understood the meaning of Open Source. I had been working with computers for my entire life (I was using a Commodore 64 before I could walk). I had been programming them nearly as long (I wrote my first program before I started grade school). I was an early adopter of Linux (I still have a Red Hat 1 disk somewhere). But I never guessed the impact that open source would have on my life. I never appreciated the impact that open source would have on the world. The past 5 years have changed me forever. This is my story.

Wednesday, June 13, 2012

Reply: Use Cuda Accelerated PBKDF2

Yesterday, I read an article about using GPUs to accelerate password hashing: No, Heavy Salting of Passwords Is Not Enough, Use CUDA Accelerated PBKDF2. The article makes some very interesting points about password hashing. But the conclusion of the article really misses a huge point, and get a major point fundamentally wrong (bordering on misunderstanding). Let's start with the part they got wrong...

Thursday, June 7, 2012

Application Architecture - The Case For Layers

Very often when we look at a class diagram for a new application, it's quite overwhelming. There are tons of classes, all interacting with each other. These interactions are everywhere. It actually resembles a spider web of interaction. Trying to decode this web to figure out what the application is doing can be a lesson in futility for some applications. 

How then, can we design an application such that it's easy to follow? How can we build an application that's easy to understand on all levels? The answer is deceptively simple: by using layers. Let's explore how we can use layers to help build our applications in a clean, easy to follow and maintainable manner.

Tuesday, June 5, 2012

To Comment Or Not To Comment - A Tale Of Two Stories

A few weeks ago I was sparked into a twitter conversation with Larry Garfield (@Crell) about the value of comments in code. Really, twitter is not the best place for that conversation, so I decided to write this post to illustrate my beliefs on commenting. Let's start this story with the tweet from Larry that set off the conversation:
Nothing drives home the need for good code comments like working on code that doesn't have them.
A pretty innocuous comment that is quite insightful. But that led me to respond with:
Nothing drives home the value of good, clean code by working on code that doesn't need comments.
That led to an interesting discussion that just couldn't fit on twitter. So let me explain...

Wednesday, May 23, 2012

Open Standards - The Better Way

There has been a lot of traction lately on the topic of the PSR "PHP Framework Interoperability Group". They are introducing two new proposed standards: PSR-1and PSR-2, both dealing with code formatting standards. Actually, calling them proposed is a bit of a short-fall, since they both already have enough votes to be approved. I have read both, and actually agree and think they are quite good.

However, there's a deeper problem. Open Standards is something that the internet was built upon. From HTTP, E-Mail and HTML to ECMA Script (JavaScript), OAuth and JSON, open standards are everywhere. The problem with the entire PSR process is that it is not designed to produce open standards. 

Tuesday, May 22, 2012

Thursday, May 10, 2012

Talk - Don't Be Stupid, Grasp Solid - NYPHP

Time for some more shameless self-promotion...  I'll be doing a talk at the New York PHP group on Tuesday May 22, 2012. I'll be discussing some Object Oriented design principles and how to apply them to your projects. We'll specifically discuss the STUPID and SOLID principles. Here's the full abstract:

When it comes to Object Oriented Programming, there is no shortage of guidelines and principles for how to properly design an OO system. There is also no shortage of acronyms to describe these principles: DRY, SRP, LSP, LoD, ISP, OCP, etc. However, there are two acronyms that really shine through to describe how to, and how not to do OOP well. The two acronyms are SOLID and STUPID (respectively). We'll discuss some of the underlying principles of Object Oriented Programming, and how we can learn from the principles identified by each of these two acronyms. Additionally, we'll explore some additional anti-patterns of Object Oriented Design and how they can be avoided. Finally, we'll talk about how all of this applies to our every day development tasks, and the real-world benefit these design principles provide...

If you plan on attending, be sure to RSVP first! If not, the talk will be streamed via ustream.

Tuesday, April 17, 2012

Properly Salting Passwords, The Case Against Pepper

The other day I announced the release of my new password hashing library, PasswordLib. As I've come to expect, Reddit was full of interesting commentary on the topic. Some was good, some was bad and some surprised me. What surprised me was the insistence on a global salt (otherwise known as a "pepper"). So, I started thinking about it some more, and I figured I'd write a post on why I don't use peppers in my hashing algorithms (and why you may want to rethink it too).

Saturday, April 14, 2012

Introducing: PasswordLib

Today, I'm proud to announce the immediate availability of a new password hashing library for PHP: PasswordLib. The project is a spin-off of another that I started about a year ago, CryptLib. I was unable to find a clean solution to a few problems in CryptLib, so dev work stalled for a while. I realized recently that the password hashing functionality was complete, so if I stripped out the incomplete parts, it would still be a very useful library. And so PasswordLib was born.

Tuesday, April 10, 2012

PHP Sucks! But I Like It!

I read a rather interesting post yesterday called PHP: a fractal of bad design. It's been getting a lot of traffic among the PHP community lately because it's rather inflammatory. But to be honest, it does make a lot of really good points. It also makes a lot of mistakes and misses a bigger picture.

Wednesday, March 28, 2012

PHP's Source Code For PHP Developers - Part 4 - Arrays

Part 4 of the PHP's Source Code for PHP Developers series is up over on Nikic's Blog.  In it, he discusses how arrays are handled in PHP internals.  He talks a lot about hash tables and symbol tables, and how they work together to make PHP a working language.  Part 5 will be back over here, and we'll talk about objects and classes!  Enjoy!

The Power of Technical Debt

Lately, I've found myself in a number of discussions about Technical Debt and how it applies to project development. Overall, I think it's a very powerful tool that -- when used wisely -- can be a great asset to any team. It seems to me that most of the people that I've been talking to really don't agree, and see Technical Debt as a plague that should be eliminated at first sight. So, I figured I'd share my opinions, and see what you think...

Wednesday, March 21, 2012

PHP's Source Code For PHP Developers - Part 3 - Variables

In this third post of the PHP's Source Code for PHP Developers series, we're going to expand on the prior posts to help understand how PHP works internally.  In the first post of the  series, we looked at how to view PHP's source code, how it's structured as well as some basic C pointers for PHP developers.  The second post introduced functions into the mix.  This time around, we're going to dive into one of the most useful structures in PHP: variables.

Friday, March 16, 2012

PHP's Source Code for PHP Developers - Part 2 - Function Definitions

Part 2 of the PHP's Source Code for PHP Developers series is up over on Nikic's Blog.  In it, he discusses how internal PHP functions are defined, and how to figure out what they do.  Part 3 will be back over here and will cover how variables work internally (The ZVAL).  Enjoy!

Monday, March 12, 2012

PHP's Source Code For PHP Developers - Part 1 - The Structure

As a PHP developer, I find myself referencing PHP's source code more and more in my normal everyday work.  It's been very useful in everything from understanding what's happening behind the scenes to figuring out weird edge-cases to see why something that should be working isn't.  And it's also very useful in the cases when the documentation is either missing, incomplete or wrong.  So, I've decided to share what I've learned in a series of posts designed to give PHP developers enough knowledge to actually read the C source code behind PHP.  No prior knowledge of C should be necessary (we'll cover some of the basics), but it will help.

This is the first post of the series.  In this post, we'll walk through the basics of the PHP application: where to find it, the general structure of the codebase and a few really fundamental concepts about the C language.  To be clear, the goal of the series is to get a reading comprehension of the source code.  So that means that at some points in the series, some simplifications will be made to concepts to get the point across without over-complicating things.  It won't make a significant difference for reading, but if you're trying to write for the core, there is more that will be needed.  I'll try to point out these simplifications when I make them...  

Additionally, this series is going to be based off the 5.4 codebase.  The concepts should be pretty much the same from version to version, but this way there's a defined version that we're working against (to make it easier to follow later, when new versions come out).

So let's kick it off, shall we?

Friday, March 9, 2012

Handling Plugins In PHP

A common problem that developers face when building applications is how to allow the application to be "plug-able" at runtime.  Meaning, to allow non-core code to modify the way an application is processed at runtime.  There are a lot of different ways that this can be done, and lots of examples of it in real life.  Over a year ago, I wrote a StackOverflow Answer on this topic.  However, I think it deserves another look.  So let's look at some patterns and common implementations.

Monday, March 5, 2012

Parameter Type Casting in PHP

As any of you who follow the PHP internals list know, scalar type hinting has been a hot topic as of late.  You'll also know that I've submitted two new RFC (Request For Comment) proposals for inclusion of two new major features in the PHP language.  I figured it was worth going into both RFCs and patches a little deeper, explain my rationale and (hopefully) garner some more visibility of the proposals.

Friday, January 6, 2012

How We Interview Developers

The other day I had read an interesting post by 37 Signals entitled Why We Don't Hire Programmers Based On Puzzles, API Quizzes, Math Riddles or Other Parlor Tricks (say that 10 times fast).  Then I was pointed to another article by C for Coding entitled Interview Programming Problems Done Right.  That got me thinking about the interview techniques that I've used at my current and prior jobs.  It's a different style than either of those two posts, so I figured it was worth talking about.

Wednesday, January 4, 2012

The MicroPHP Fallacy

I came across a rather interesting post yesterday entitled The MicroPHP Manifesto.  The author made clever use of a very interesting analogy (drum players) to try to prove his point that less is more.  The article makes a very interesting read, and I would suggest that everyone reads it.  Go ahead.  I'll wait.

With that said, I have to disagree with the article rather vehemently.  I think the message is somewhat right, but for all the wrong reasons.  Let me try to explain: