Hope Over Anger

That’s what their one two finish in Iowa represented. And that is the their message now. It’s all about fighting for tomorrow.

The son of a mill worker from a small rural town, he was the first person in his family to graduate from college. He went on to law school, then made millions representing ordinary people against giant corporations. After his 16-year-old son, Wade, died in a car accident in 1996, Mr. Edwards cloistered himself in grief, then emerged the next year to run for the Senate, beating a three-term Republican incumbent.

Who do you think has the better vision for the country? The Bush team has shared little except for personal attacks and more of the same.

the Shortest Path to a Solution

…what is simplicity? Simplicity is the shortest path to a solution. Say somebody does a proof for a mathematical problem in 20 pages. You study those 20 pages, and finally you say, “Oh, I get it.” You get a reward as the result of understanding that proof, because the proof was a solution to an interesting problem, not just a difficulty. Later, somebody else comes up with a 10-page proof for the same problem. Maybe the new proof uses a branch of mathematics that you might have to study to master, but once you master that branch of mathematics you can use it. And a 20-page proof becomes a 10-page proof. You’d have to say it’s simpler, because it’s a shorter path. Maybe it’s longer if you have to do a digression to actually learn a new branch of mathematics, but let’s assume that over time we realize that this branch is important to know in general, so we all become familiar with it.

What we’re really trying to do in software is find a way to make it easy to get value from having solutions to problems. How do we do that? When we work the program, we put in what we think is the shortest path to a solution. When we discover that the problem is different than we thought, we rewrite. And then we rewrite again. We work the program. That process is just like doing the proofs over and over. Sooner or later we discover that instead of doing something in 30 lines of code, we can do it in 15 lines, because now we have another capability that fits in. It really is just the right capability, so the work done there we don’t have to do here. We’ll just invoke that capability from here. That makes our solution easier to follow. Plus the effort you expend today to understand the code will make you a more powerful programmer tomorrow. So that simplification is very valuable.

If you write a lot of programs, and you’re used to squeezing them all the time, you find that it’s easy to write a program that’s simple. A lot of it is having a clear sense of what you want to say?writing the proof by choosing what to prove, and being clear about that. In programming, a lot of simplicity comes from knowing what matters and what doesn’t matter. A lot of times a program is made complicated because it’s attending to details that aren’t needed, or could have been avoided, or could have been relegated to something else.

Someone says, “You should always check your arguments to see if they’re in range.” Someone else says, “Half the statements in this program are checking arguments that are intrinsically in range.” Have they made the program better or worse? No, I think they’ve made it worse. I’m not a fan of checking arguments. On the other hand, there ought to be a fail fast. If you make a mistake, the program ought to stop. So there is an art to knowing where things should be checked and making sure that the program fails fast if you make a mistake. That kind of choosing is part of the art of simplification.

…Coding up the simplest thing that could possibly work is really about this: If you can’t keep five things in your head at one time and make a decision, try keeping three things in your head. Try keeping just one thing in your head, and see if you can make a decision. Then you can think of the next thing. And amazingly, when you write some of this dumb, straight-ahead code, it often turns out that it was all that was required. It works great. When a second programmer comes back later and reads the code she might say, “The people who wrote this are morons. They just wrote a simple linear search here. This thing’s ordered, so they could have done a binary search. They could have used a hash table here. Why are they doing a linear search?” Well, because a linear search worked. And when the other programmer looked at the linear search, she understood it in a minute.

Ward Cunningham, in an interview at Artima

PHP Scales

The news that Friendster migrated to PHP from JSP for scalability reasons has triggered much needed discussion in the Java community.

Chris Shiflett at O’Reilly had this to say (source rc3.org):

…how does scalability apply to the Web? First, you should ask yourself whether the Web’s fundamental architecture is scalable. The answer is yes. Some people will describe HTTP’s statelessness in a derogatory manner. The more enlightened people, however, understand that this is one of the key characteristics that make HTTP such a scalable protocol. What makes it scalable? With every HTTP transaction being completely independent, the amount of resources necessary grows linearly with the amount of requests received. In a system that does not scale (where “does not scale” means that it scales poorly), the amount of resources necessary would increase at a higher rate than the number of requests. While HTTP has its flaws (the proper spelling of referrer being one), there’s no arguing that it scales, and this is one of the things that made the Web’s early explosive growth less painful than it would have otherwise been.

The present discussion is about developing Web applications that scale well, and whether particular languages, technologies, and platforms are more appropriate than others. My opinion is that some things scale more naturally than others, and Rasmus’s explanation above touches on this. PHP, when compiled as an Apache module (mod_php), fits nicely into the basic Web paradigm. In fact, it might be easier to imagine PHP as a new skill that Apache can learn. HTTP requests are still handled by Apache, and unless your programming logic specifically requires interaction with another source (database, filesystem, network), your application will scale as well as Apache (with a decrease in performance based upon the complexity of your programming logic). This is why PHP naturally scales. The caveat I mention is why your PHP application may not scale.

A common (and somewhat trite) argument being tossed around is that scalability has nothing to do with the programming language. While it is true that language syntax is irrelevant, the environments in which languages typically operate can vary drastically, and this makes a big difference. PHP is much different than ColdFusion or JSP. In terms of scalability, PHP has an advantage, but it loses a few features that some developers miss (which is why there are efforts to create application servers for PHP). The PHP versus JSP argument should focus on environment, otherwise the point gets lost.

I actually disagree with George’s statement, “PHP doesn’t magically scale ‘naturally'”. Of course, I understand and agree with the spirit of what he’s trying to say, which is that using PHP isn’t going to make your applications magically scale well, but I do believe that PHP has a natural advantage, as I just described. Rasmus seems to agree with me, and George might also agree, despite his statement.

I think PHP scales well because Apache scales well because the Web scales well. PHP doesn’t try to reinvent the wheel; it simply tries to fit into the existing paradigm, and this is the beauty of it.

When he quotes Rasmus Lerdorf I think he gets to the heart of the matter:

A typical Java application will make use of the fact that it is running under a JVM in which you can store session and state data very easily and you can effectively write a web application very much the same way you would write a desktop application. This is very convenient, but it doesn’t scale. To scale this you then have to add other mechanisms to do intra-JVM message passing which adds another level of complexity and performance issues. There are of course ways to avoid this, but the typical first Java implementation of something will fall into this trap.

PHP has no scalability issues of this nature. Each request is completely sandboxed from every other request and there is nothing in the language that leads people towards writing applications that don’t scale.

It’s been my experience that because of Java’s abundance of riches when it comes to application design, many using it concentrate too much on tuning the Java code on the application tier, instead concentrating on all other areas of opportunity.

Because PHP does not offer so many different options to cache or pass data within applications written with it, there is far less chance for a developer or project manager to think the scalability problem can be solved entirely there. It forces you to look at the other sub-systems in across your architecture and make sure you have the resources to do so.

I have a perfect example from work experience that I?ll share with you sometime.

Happy 4th of July: Harmid Karzai Sets The Left And Right Straight

I’ve spent some of the weekend on a patriotic inspired commenting tear in other weblogs, in an attempt of fight willful ignorance. I think I connected in a couple of situations, even among those intent on putting all those on the other side of the argument in a narrow box defined by the stereotypes of their political parties.

Today I listened to Harmid Karzai of Afghanistan receive the Philadelphia Liberty medal. His speech was powerful and I’m sure there are some on the far left and far right who didn’t appreciate what he had to say.

He quoted Patrick Henry’s famous liberty or death speech and talked of the sacrifice in blood that Afghans are making and willing to make for their freedom. He then spoke of how important is that children have been able to go to back school and how thankful he was for it.

On July 4th many direct you to read The Declaration of Independence, but without context, so very few understand reasoning of it’s author, of those who signed it, or what they put on the line to do so.

In honor of the Harmid Karzai speech today, read Patrick Henry’s “Liberty or Death” speech and then what Thomas Jefferson had to say about an informed citizenry, of public education, of science, of trust in our people over our leaders, of light and liberty.

They are bound to get you thinking about what freedom means.

Voting Against, No, Voting For

Jeff Jarvis knocks the Democrats for running a race against George Bush and not for John Kerry. The distinction is important and I’m glad that Jeff Jarvis highlighted it. He lists a few observations that lead him to think that this is the case and uses a Google search as additional proof. I respectfully disagree.

While it is true that negative messages get more press, and that webloggers are focusing on the misdeeds of the current administration far more than John Kerry’s stances on the issues, this has more to do with the nature of weblogging and the news cycle than it does with any coordinated DNC activity.

A simple glance at his official advertisements vs. George Bush’s (where the vast majority of communication money is spent) and you will see who the true negative campaigner is vs. the one with a message of optimism and faith in the future of America.

In short: the Bush campaign is selling fear and division. And it’s fear that is Bush’s most potent weapon. Their campaign knows it and is using it like baseball bat across the head. Again and again and again.

Deep in the Buzzmachine comments thread, Jeff Jarvis posts some important advice that left leaning weloggers better take heed: “The best thing a supporter can do is push the guy you’re supporting to do better. So look at that from two perspectives: First, pushing Kerry to get out there more and excite voters with his stands. Second, pushing fellow liberals not to fall into the trap of extremism as Moore et al copy the tactics of Coulter et al.”

The fact that some people still don’t know John Kerry’s stands on the issues is a problem. The question: is it a problem of willful ignorance or not? Or is it that we are hard wired share negativity?

As Nicholas Kristof says in the NYTimes:

“the rush to sling mud is gaining momentum, and “Fahrenheit 9/11” marks the polarization of yet another form of media. One medium after another has found it profitable to turn from information to entertainment, from nuance to table-thumping.

Talk radio pioneered this strategy, then cable television. Political books have lately become as subtle as professional wrestling, and the Internet is adding to the polarization. Now, with the economic success of “Fahrenheit 9/11,” look for more documentaries that shriek rather than explain….

Mr. Bush got us into a mess by overdosing on moral clarity and self-righteousness, and embracing conspiracy theories of like-minded zealots. How sad that many liberals now seem intent on making the same mistakes.”

He’s right, but one thing is for sure: people vote for candidates who exemplify optimism and belief in America. So I hope the Bush campaign keeps going in the revealing direction it is in and the Kerry campaign not only stays the course, but pushes it harder. Kerry’s grassroots supporters (webloggers and those hitting the streets) need to get this straight and fast.

As Things Improve In Iraq, We Raise Our Fist In Another Direction

There have been plenty of positive changes occurring in Iraq this week.

But of course, we couldn’t leave it that way.

We now plan to send an unprecedented number of aircraft carrier strike groups off of China’s shores, in a massive display of force, that is bound to do wonders for our relationship with them.

China, a country moving towards capitalism slowly, but surely, is about to get a black eye from us. This, after their efforts to help broker communication between us and North Korea just doesn?t make sense.

Ya know, I think I know why: it’s because it was the Chinese who attacked us on 9/11.