Paul M. Jones

Don't listen to the crowd, they say "jump."

The Ryan Plan -- Not Enough

Considering the situation we are in today, the size of government, the level of our debt, the continuous violations of our economic and personal freedoms, free-market advocates should be breathing fire everyday and fight for truly smaller government. This plan isn’t enough.

It doesn’t balance the budget in the next ten years. ...

It will spend $4.9 trillion in 2022. ... That’s only 13 percent less than the president’s plan.

It focuses on a few villains like high-speed rail and the president’s healthcare law but it fails to propose the elimination of programs, agencies, or departments that should be terminated either because they are the responsibility of the state and local governments or the private sector.

It once again fails to reform Social Security. ...

It reneges on sequestration-induced reductions in military spending (it finds the “savings” elsewhere). I think a serious plan would put everything on the table. ...

This plan doesn’t close the emergency loopholes. This means that spending cuts brought about by the BCA caps or the Ryan budget can be easily restored by claiming that the spending is an emergency.

On Medicare reform: Why push off urgent reforms for a decade? ...

This is a good example of dessert-now-spinach-later policy. In this case, however, older people are the only ones eating desert and younger people are left with the spinach and little prospect of any dessert at all.

The proposal includes no credible plan to force future Congresses to implement its reforms.

... Considering the level of compromises and the amount of watering down that Congress will do once they put their hands on this or any budget, the original document should have been much stronger.

via A Critical Look at the Ryan Plan - By Veronique de Rugy - The Corner - National Review Online.


The Real "War On Women" Is In The Middle East

March 8 was International Women’s Day. On what was suposed to be a celebration of the brilliance, beauty and achievement of the female sex, we [American women] were complaining about our entitlement to insurance coverage for contraception. We let our newly anointed spokesperson Sandra Fluke tell the world that there is a malicious war on women in the United States of America.

In Saudi Arabia, women are forbidden to drive or use public facilities when men are present. If their bodies are not completely covered, they face verbal and physical harassment from the religious police. Jordanian women live in fear of honor killings from their husbands. In Egypt today, women wonder if they will see their hard-fought rights removed when the new constitution is drafted by an Islamist-majority parliament.

On International Women’s Day, these people were victims of the real war on women.

via PLOTT: The real war on women | Yale Daily News.


Interview Tip: Avoid Mentioning PHP Frameworks

If the job description does not mention "Framework X," you should probably avoid answering that you use "Framework X" to solve the problem presented to you by the interviewer. If I ask you to perform a simple task, such as parsing a string in a well-known format, saying "Framework X does that for me" is likely to be seen as a negative.

You should be able to do the simple things in PHP itself (e.g. parsing strings). As interviewers, we generally care about your proficiency with the language, not with how much you like the framework of your individual choosing.

Saying that you use a feature of "Framework X" for simple things is a negative. It sounds like you're dependent on that framework for basic tasks. That means we (the employers) will need to train you how to do it without that framework, and that's a hassle for us.

One caveat here is that if the employer has already specified that they use "Framework X" then they probably do want to see that you're familiar with it. Alternatively, if you are going to be the only person on the team, you're also probably fine. But in collaborative, team environments, it is unlikely that the employer is already using the framework you, individually, prefer.



War On Women? No -- It's A War On Men

War is where the enemy decimates your numbers – like, say in China where abortion is killing mostly females.

War is where you are kept from learning – like in most Arab countries, where women have restrictions placed on their education.

War is where your houses are burned, your children taken away into slavery, your goods looted, and you are dragged away in chains.

In the United States, right now, women have preferential treatment – by law – in any company that gets federal funds (which heaven help us, right now, is most of them.)  Women live longer than men.  Cancers that affect females get more money and more attention than those that affect only men.  Women have the right to be sole deciders on abortion, and if they decide to keep the child and make the man pay, he pays.  (This by the way is a complete reversal of the “penalty” of sex which used to fall mostly on women.)  And if he doesn’t pay, he goes to jail.  Divorce courts award custody to mothers overwhelmingly.  Oh, and in college campuses, women outnumber men.

If this is war it is war on men.  And I’ve had just about enough of everyone who claims otherwise.

Sarah Hoyt, War Is Hell | According To Hoyt.


phpDocumentor2 === DocBlox

This is great news. Congratulations to both projects!

Announcing phpDocumentor 2 – the merging of the old (phpDocumentor) and the new (DocBlox).

With the first alpha release of phpDocumentor (2.0.0a1), the new “Responsive” default template sports a new page layout, along with the useful layout improvements that the original DocBlox templates provided (which remain available) over the old phpDocumentor templates (which will retire with old phpDocumentor).

via DocBlox is unmasked … it is really phpDocumentor 2! : DocBlox.


Complex Societies Need Simple Laws

Big-government advocates will say that as society grows more complex, laws must multiply to keep up. The opposite is true. It is precisely because society is unfathomably complex that laws must be kept simple. No legislature can possibly prescribe rules for the complex network of uncountable transactions and acts of cooperation that take place every day. Not only is the knowledge that would be required to make such a regulatory regime work unavailable to the planners, it doesn’t actually exist, because people don’t know what they will want or do until they confront alternatives in the real world. Any attempt to manage a modern society is more like a bull in a darkened china shop than a finely tuned machine. No wonder the schemes of politicians go awry.

F.A. Hayek wisely said, “The curious task of economics is to demonstrate to men how little they really know about what they imagine they can design.” Another Nobel laureate, James M. Buchanan, put it this way: “Economics is the art of putting parameters on our utopias.”

Barack Obama and his ilk in both parties don’t want parameters on their utopias. They think the world is subject to their manipulation. That idea was debunked years ago.

“With good men and strong governments everything was considered feasible,” the great Austrian economist Ludwig von Mises wrote. But with the advent of economics, “it was learned that ... there is something operative which power and force are unable to alter and to which they must adjust themselves if they hope to achieve success, in precisely the same way as they must taken into account the laws of nature.”

via Complex Societies Need Simple Laws - Reason Magazine.


On Preferring Spaces Over Tabs in PHP

The best lack all conviction, while the worst are full of passionate intensity. — “The Second Coming”, William Butler Yeats

Keep the above in mind when considering either side of the debate. ;-)

tl;dr

Herein I assert and discuss the following:

  • Using spaces has subtle advantages over using tabs in collaborative environments.

  • The “tabs reduce file size” argument is factually true, but is a case of optimizing on the wrong resource.

  • The “tabs allow each developer to set his own indent widths” argument sounds good in theory but leads to problems in practice regarding line length recognition and inter-line alignment.

Introduction

In the PHP world, there are effectively two competing indenting practices: “4-spaces” and “tab.” (There are some in the 2-space camp as well but they are very few.)

I want to point out a couple things about why spaces might be considered preferable in a collaborative environment when style is important on a PHP project. And yes, it turns out this dicussion does matter.

I used to use tabs, and slowly migrated over to spaces. Over the course of several years, I have found there is a slight but useful advantage to using spaces for indentation when working with other developers, and I want to discuss that one advantage in this essay.

Note that I am not asserting an overwhemling, absolutely obvious, infallible moral rule that clearly favors spaces over tabs as the One True Path. It is merely a noticeable improvement regarding more sophisticated rules of style.

Do I expect this essay to change anybody’s mind on using tabs? No; but, I do hope it will give some food for thought.

Regarding Tabs

When making an argument, it is important to state the alternative viewpoint in a way so that people who hold that viewpoint actually agree with it.

What are the reasons for preferring a tab indent? As far as I can tell, they are:

  • The tab is a single character, so files are smaller.

  • Using a tab character allows each developer to change the level of indent
    that he sees, without actually modifying the on-disk file.

If there are other reasons I have missed, please let me know.

File Size

In general, I assert that the “file size” argument is a case of “optimizing on the wrong resource.”

By way of example, let’s take one file from a real project that uses 4-space indenting, Zend_Db_Abstract, and use wc -c to count the number of bytes in the file.

$ wc -c Abstract.php
40953 Abstract.php

Now, let’s convert each 4-space indent to a tab.

$ unexpand -t 4 Abstract.php > Abstract-tabs.php
$ wc -c Abstract-tabs.php
34632 Abstract-tabs.php

We save 6K of space on a 40K file, or roughly 15%, by using a tab character for indents instead of a 4-space indent.

Now, to get an idea of how that compares to another way to reduce size, let’s remove all the comments from the original 4-space file and see what that does. We’ll use a tool I found after two minutes of Googling (you may need to change the hashbang line of remccoms3.sed to point to your sed):

$ wget http://sed.sourceforge.net/grabbag/scripts/remccoms3.sed
$ chmod +x remccoms3.sed
$ ./remccoms3.sed Abstract.php > Abstract-no-comments.php
$ wc -c Abstract-no-comments.php
21022 Abstract-no-comments.php

That’s about a 50% reduction. If disk storage is really a concern, we’d be much better off to remove comments than to convert spaces to tabs. Of course, we could do both.

This example makes me believe that the “file size” argument, while factually correct, is a case of “optimizing on the wrong resource.” That is, the argument gives strong consideration to a low-value item. Disk space is pretty cheap, after all.

A followup argument about this is usually, “Even so, it’s less for the PHP interpreter to deal with. Fewer characters means faster code.” Well, not exactly. Whitespace is tokenized, so the parser sees it all the same.

Developer Tab Stop Preferences

This, to me, seems to be the primary argument for preferring tabs over spaces for indenting. Essentially, the idea is to allow each individual developer on a project to make the code look the way that individual developer prefers.

This is a non-trivial argument. It’s very appealing for the individual developers to be able to work on a project where Developer A sees a tab stop every 4 characters, and Developer B sees a tab stop every 2 or 8 or whatever characters, without changing the actual bytes on disk.

I have two arguments against this; they seem to be minor, until we examine them in practice:

  • It becomes difficult to recognize line-length violations with over-wide tab stop settings.

  • Under sophisticated style guides, inter-line alignment for readability becomes inconsistent between developers using different tab stops.

These arguments require a little exposition.

Line Length Recognition

Because of limitations of this blog, let’s say that our coding style guide has a line length limit of 40 characters. (I know, that’s half or less of what it should be, but it serves as an easy illustration.)

The following code, with 4-character tab stops, shows what that line length limit looks like:

         1         2         3         4
1234567890123456789012345678901234567890
function funcFoo()
{
    $varname = '12' . funcBar() . '34';
}

It’s clearly within the line length limit. But it looks like this under an 8-character tab stop:

         1         2         3         4
1234567890123456789012345678901234567890123
function funcFoo()
{
        $varname = '12' . funcBar() . '34';
}

A developer who sees this code under 8-character stops will think the line is past the limit, and attempt to reformat it in some way. After that reformatting, the developer working with 4-character tab stops will think the line is too short, and reformat it back to being longer. This is not particularly productive.

Some will say this just shows that line length limits are dumb. I disagree.

Inter-Line Alignment

By “inter-line alignment” I mean the practice where, if we have several lines of code that are similar, we align the corresponding parts of each line in columns. To be clear, it’s not that unaligned code is impossible to read; it’s just noticeably easier to read when it’s aligned.

Typically, inter-line alignment is applied to variable assignment. For example, the following unaligned code …

$foo = 'bar';
$bazdib = 'gir';
$zim = 'irk';

… is easier to scan in columns aligned on the = sign:

$foo    = 'bar';
$bazdib = 'gir';
$zim    = 'irk';

We can see clearly what the variables are in the one column, and what the assigned values are in the next column.

Alternatively, we may need to break an over-long line across several lines, and make it glaringly obvious during even a cursory scan that it’s all one statement.

Now, let’s say we have a bit of code that should be aligned across two or more lines, whether for readability or to adhere to a line length limit. We begin with this contrived example using 4-space indents (the spaces are indicated by • characters):

function funcName()
{
••••$varname = '1234' . aVeryLongFunctionName() . 'foo' . otherFunction();
}

Under a style guide where we align on = to keep within a line length limit, we can do so regardless of tab stops:

function funcName()
{
••••$varname = '1234' . aVeryLongFunctionName()
•••••••••••• . 'foo' . otherFunction();
}

Under a guide where we use tabs, and Developer A uses 4-character tab stops, we need to push the alignment out to the tab stops to line things up (tabs are indicated by → characters):

function funcName()
{
→   $varname→   = '1234' . aVeryLongFunctionName()
→   →   →   →   . 'foo' . otherFunction();
}

However, if a Developer B uses an 8-character tab stop, the same code looks like this on Developer B’s terminal:

function funcName()
{
→       $varname→       = '1234' . aVeryLongFunctionName()
→       →       →       →       . 'foo' . otherFunction();
}

The second example has the same tabbing as in the first example, but the alignment looks broken under 8-character tab stops. Developers who prefer the 8-character stop are likely to try to reformat that code to make it look right on their terminal. That, in turn, will make it look broken for those developers who prefer a 4-character stop.

Thus, the argument that “each developer can set tab stops wherever he likes” is fine in theory, but is flawed in practice.

The first response to alignment arguments is generally: “Use tabs for indenting and spaces for alignment.” Let’s try that.

First, a 4-character tab stop indent, followed by spaces for alignment:

function funcName()
{
→   $varname = '1234' . aVeryLongFunctionName()
→   •••••••• . 'foo' . otherFunction();
}

Now, an 8-character tab stop indent, followed by spaces for alignment:

function funcName()
{
→       $varname = '1234' . aVeryLongFunctionName()
→       •••••••• . 'foo' . otherFunction();
}

That looks OK, right? Sure … until a developer, through habit (and we are creatures of habit) hits the tab key for alignment when he should have used spaces. They are both invisible, so the developer won’t notice on his own terminal — it will only be noticed by developers with other tab stop preferences. It is the same problem as before: misalignment under the different tab stop preferences of different developers.

The general response at this point is to modify the tab-oriented style guide to disallow that kind of inter-line alignment. I suppose that is reasonable if we are committed to using tabs, but I find code of that sort to be less readable overall.

Solution: Use Spaces Instead

The solution to these subtle and sophisticated issues, for me and for lots of other PHP developers, is to use spaces for indentation and alignment. All professional text editor software allows what are called “soft tabs” where pressing the tab key inserts a user-defined number of spaces. When using spaces for indentation and alignment, all code looks the same everywhere, and does not mess up alignment under different tab stop preferences of different developers.

Conclusion

I realize this is a point of religious fervor among developers. Even though I have a preference for spaces, I am not a spaces zealot. This post is not evangelism; it is a dissection of the subtle and long-term issues related to tabs-vs-spaces discovered only after years of professional collaboration.

Please feel free to leave comments, criticism, etc. Because this is such a touchy subject, please be especially careful to be civil and maintain a respectful tone in the comments. If you have a very long comment, please consider pinging/tracking this post with a blog entry of your own, instead of commenting directly. I reserve the right to do as I wish with uncivil commentary.

Thanks for reading, all!


Newt Gingrich, How Will You Lead The Nation Back To God?

Gingrich did *not* say the following:

... it is not the job of the President of the United States or in in the skill set of the President of the United States to lead the nation back to or toward God. For starters, a lot of Americans don’t believe in God and don’t want to hear about God. I don’t want a President to lead the nation toward meat-eating or vegetarianism or any of the myriad of other choices we make privately in our day-to-day lives.

More importantly, the President doesn’t know how to lead the nation back to God. He is just as likely to lead the nation away from God. There are people who specialize in Godliness–they are called “the clergy.” Having the President get involved in religion or belief in God inevitably crowds out private efforts or has unintended consequences.

In other words, the right answer is that the President of the United States is not the Messiah or a prophet or even a member of the clergy. Leading the nation back to God is the job of private voluntary acts. The President’s job is to leave those alone.

Via Not the Messiah.