Keeping memcache consistent

As an afterthought someone decided at the last minute, that maybe the architect (me) should be on the architectural review of a product.

Normally for social networking web development, I allow for a little short term inconsistency. This is because only one user has access to modify a thing and that user isn’t likely to do two things at the same time. Because of this, concurrency is almost never a problem and. even if the data gets clobbered, the database at least is consistent and your objects are quickly fixed.

The problem with this particular project is that since a paid good is involved and many users will race to the same data store—inconsistencies can occur and they’d be more harmful than a goto statement. The solution proposed was to build a Java service to keep these eight pieces of data consistent. There was also a release plan in order to estimate the resource allocation for the new service under live site load.

Though late to the meeting, I opened my mouth and said, “You don’t need a Java service to do this. You can do it all in PHP and memcache.”

Continue reading about How do prevent clobbering in memcache using PHP after the jump

Ode to Quality Assurance

Quality Assurance has been delaying a release for a month and a half. As a consumer facing website, we normally have two code pushes a week. It’s a major rewrite, sure, but at this point we’re at about 20x the bug count of any previous release. The bugs are no longer: “You do this and the site goes down” but more along the lines, “You do something that nobody in their right mind would do and sometimes you get an error message, but everything is fine if you reload the page.”

Continue reading about Drunk with power and other random reasoning after the jump

Mr. Hansson doesn’t get to shart on sharding

(A draft of this article appeared on Wednesday because I hit the wrong button on WordPress. I apologize for the confusion it may have caused. What can I say except, “Freedom is messy.”)

This morning Andrei sent me an article from David Heinemeier Hansson titled, “Mr. Moore gets to punt on sharding.”

Since Andrei and I work at pretty well-trafficked websites which couldn’t operate without the very thing David is advocating against, normally I’d just laugh naïveté in his observations—it’s been eight years since the the Internet goldrush and all that’s happened is that a new generation is repeating our mistakes and rationalizing the inevitable fail that ensues.

But there are tons of people who quote David Henemeier Hansson’s words to me at conferences and on the blogs. For every speaking engagement in which I’ve saved someone from a huge architectural misconception, Mr. Hansson has indoctrinated ten more future programmers who will make that same mistake. Like a glacier during global warming, I move forward one inch during the winter and retreat a foot during the summer.

If I don’t do something about this… well someone’s gotta think about the polar bears?

DSC_3589.JPG

Su Lin
San Diego Wild Animal Park, Escondido, California

Nikon D3, Nikkor 70-200mm f/2.8G VR

Okay, this is not a polar bear, but I couldn’t get a good photograph of one. This is a different bear similarly endangered due to habitat destruction.

No, Mr. Hansson doesn’t get to shart on sharding. I’m going to Bush Doctrine it before I see this shitfart come out of the mouths of any of my colleagues.

Continue reading about Defining sharding, dispelling myths, and delivering consequences after the jump

PHP without PHP

Original article posted to PHP Advent 2008. Happy Christmas!

Take a simple PHP trick and follow it on a huge tangent to the philosophy of good web architecture.

It’s an honor to be asked to share my ideas with the PHP community. When Chris and Sean asked me to write an entry for the Advent Calendar, I had to accept. Like last year, this article will be quite long. If you need something short and sweet like the other advent entries, you can just read the first section. But if you read it all, there might be a worthwhile concept buried in this logorrhea.

Continue reading about My PHP advent article after the jump

Terry the bully

Am I an intellectual bully?

The two faces of PHP
District Bar, South of Market, San Francisco, California

Nikon D3, Nikkor 24-70mm f/2.8G
f/2.8 at 1/50 sec, iso 12800, 45mm (45mm)

Certainly some of the comments expand on that by attributing all manner of atrocities to me, the accusation by “Joe” is especially amusing:

funny, i’d never heard of chay but stumbled upon a few posts he made about ruby on rails whilst researching the value of ror vs php. i found his posts fit very much into the “intellectual bully” category. he was more concerned with “being right” as you put it, with fairly basic arguments actually “the top 10 companies use X, therefore X is right”.…i agree with the previous poster, coding is not a competition. we want to solve problems with the right solutions. there are many solutions to a given problem, much as that would break chay’s heart.

Yes, Joe, I’m a bully! 😀

Let’s take the evidence at hand (i.e. reality) instead of the arguments based on fallacies (ad hominem: “i’d never heard of chay” or false equivalence: “there are many solutions”) and such. As I see it, the examples of bullying referenced in the discussion are:

A) Asking a candidate to define design patterns
B) Asking a candidate to distinguish C++ vs. Java
C) Writing an article comparing Rails vs. PHP

Continue reading about my bully nature after the jump

Defining Design Patterns

My friend and colleague, Paul M. Jones, calls me out as a bully. Apparently from the way interviewees complain to their headhunter about me, I am.

Like W after 2004, and fully intend to use this new capital accumulated by my just-annointed “bully-mandate” to tell him (and the interviewees) off as being sore losers who can’t handle the new asshole I tore in their shit last night. 😉

In the real world, when a candidate fails to answer a question, I say, “Don’t worry. It’s okay,” and move to a different topic area as I have lots. I’ll also point out that none of these candidates actually were around when I gave my evaluation. They’d see that the only trouble they get into is if they lied to me or express something wrong with absolute confidence. Those show a lacking the ability to be able to work well in teams or learn new things. The question is designed to test those qualities in a candidate—not whether they can recite some book definition of a design pattern.

Okay, fine, but what about Paul who stands up to The Great Bully? Well let’s get down to the nitty gritty of defining (programming) design patterns…

Three Wise Monkeys

Three Wise Monkeys
District Bar, South of Market, San Francisco, California

Nikon D3, Nikkor 24-70mm f/2.8G
f/2.8 at 1/50 sec, iso 12800, 29mm (29mm)

Continue reading about Defining Design Patterns after the jump

Challenges and Choices (Making Frameworks Suck Less Part 2)

As promised, as the election is over, I will get back to blogging non-political things.

And hey, I haven’t posted a continuation of my web frameworks presentation yet!

Good thing too because, if you don’t know, I’m giving a talk on that tonight at CBS Interactive (CNET) in San Francisco. Come see it or watch online at 7:30PM Pacific.

Software is about making choices

"Making Frameworks Suck Less" 2

Challenges and Choices

So the second thing is Challenges and Choices. When I wrote my Rant on Rails, some people jumped on me, but I don’t think they gathered the basic assumption I was coming from.

It is not so much an assumption as a fact: when you develop software, it is about making choices. It is about tradoffs. You can do “A” but you can’t do “B.” You can’t have both A and B. I know it sounds like it’d be great and I’d like to have my cake and eat it too, but really, I’d rather be playing Counterstrike—I only have so much time to devote to writing software, that software can only execute so many times, things like that. I can’t make something do everything.

One example of that is in design patterns.

Continue reading about More part two after the jump.

Presentation-Fu (Making Frameworks Suck Less Part 1)

People ask me all the time how I make such awesome conference talks, so I decided to give you the gory step-by-step. Along the way I’ll even include my top-sekret speaker notes which I never share! It’ll give you an idea of the intense mental preparation it takes to be a top conference speaker in the PHP world and general PHP hero.

Rated R again!

“Rated R again!

“Making Frameworks Suck Less”
by Terry Chay
– howto/controverse
– Rated: R (Drama, Sex, Language, Vilence)

I thought I was done with speaking for the year. I have milked my last talk for over a year now and it was time to retired it. Since I had used this talk at the conference last year, that meant skipping ZendCon. In fact, I was a little worried because I hadn’t had a clue what my next talk (to milk) was going to be about so maybe I’ll just sit out next year.

That was because I had forgotten Keith had asked me to give an unconference talk there and I had said Yes. Then, a week before said conference, I get this e-mail asking if I’d be willing to move my slot to a different day.

Doh!

I had better find out what my talk was supposed to be about. When I did, my heart sank, it was a new topic and one I had no clue what to say.

Continue reading about preparing presentations and the introduction after the jump (click)

You’ve been hacked!

Well, Yahoo! Open Hackday has come and gone, and I’m still avoiding telling my Dave Filo story, so I suppose it won’t hurt to mention a fun pre-hackday hack I saw last August.

When the hackday registration page went up, it looked like this:

Yahoo HackDay 08

Notice the sample fields in grey? The one for the URL reads http://jrandomhacker.com/coolproject. If you go to that URL you will see the following…

Where the page goes

text reads: terry wuz here

No, it wasn’t me…honest!

Continue reading about The story behind the hack after the jump.

Senior software Engineer at CBS Interactive

Another PHP job forwarded to me from Linda Lee and Andrew Mager, this time from CBS Interactive (née CNET).

Company: CBS Interactive (formerly CNET networks)
Title: Sr. Software Engineer
Division: GameSpot.com, TV.com, MP3.com
Location: San Francisco, CA

CBS Interactive is looking for Sr. Software Engineers in their Games, Entertainment and Lifestyles division—including GameSpot.com, TV.com, MP3.com and Chow.com. These engineers will play a key role within our development team. Responsibilities will extend to any of the applications associated with division’s initiatives. Real world experience and expertise with Linux, PHP, and MySQL are an absolute must, but a deep understanding of all web technologies from a technical and product perspective is also very important.

Please check out the job description here. You can apply online or email Linda directly at linda [dot] lee [at] cnetnetworks [dot] com.