Paul M. Jones

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

Grandpa With A Gun Defends 19-Year-Old From Gang Rape

Two of the suspects reportedly knocked on the grandfather’s door at around 10 p.m. Monday and then stormed in and demanded money when he answered. All three of the men were armed and wearing black cloths, ski masks and gloves, according to police.

The 67-year-old grandfather and his wife were reportedly taken to the back of the house and ordered to open a safe. But the trio of thugs crossed the line when they attempted to gang rape the man’s granddaughter, officials said.

It wasn’t clear if the grandpa kept a gun in the safe or how exactly he got his hands on his firearm -- but he did. He reportedly shot all three of the suspects, though he was also shot while rescuing his granddaughter.

The suspects eventually fled and drove away in the grandfather’s Cadillac.

The world needs more dangerous old men. Via Police Say Three Armed Men Invaded Home and Attempted to Gang Rape 19-Year-Old -- but They Didn’t Come Prepared for Grandpa | TheBlaze.com.


How Ayn Rand Captured The Magic Of American Life

Rand expressed the glory of human achievement. She tapped into the delight a human being ought to feel at watching another member of our species doing things superbly well. The scenes in “The Fountainhead” in which the hero, Howard Roark, realizes his visions of architectural truth are brilliant evocations of human creativity at work. But I also loved scenes like the one in “Atlas Shrugged” when protagonist Dagny Taggart is in the cab of the locomotive on the first run on the John Galt line, going at record speed, and glances at the engineer:

He sat slumped forward a little, relaxed, one hand resting lightly on the throttle as if by chance; but his eyes were fixed on the track ahead. He had the ease of an expert, so confident that it seemed casual, but it was the ease of a tremendous concentration, the concentration on one’s task that has the ruthlessness of an absolute.

That’s a heroic vision of a blue-collar worker doing his job. There are many others. Critics often accuse Rand of portraying a few geniuses as the only people worth valuing. That’s not what I took away from her. I saw her celebrating people who did their work well and condemning people who settled for less, in great endeavors or small; celebrating those who took responsibility for their lives, and condemning those who did not. That sounded right to me in 1960 and still sounds right in 2010.

Second, Ayn Rand portrayed a world I wanted to live in, not because I would be rich or powerful in it, but because it consisted of people I wanted to be around. As conditions deteriorate in “Atlas Shrugged,” the first person to quit in disgust at Hank Rearden’s steel mill is Tom Colby, head of the company union:

For ten years, he had heard himself denounced throughout the country, because his was a ‘company union’ and because he had never engaged in a violent conflict with the management. This was true; no conflict had ever been necessary; Rearden paid a higher wage scale than any union scale in the country, for which he demanded--and got--the best labor force to be found anywhere.

That’s not a world of selfishness or greed. It’s a world of cooperation and mutual benefit through the pursuit of self-interest, enabling satisfying lives not only for the Hank Reardens of the world but for factory workers. I still want to live there.

via How Ayn Rand Captured The Magic Of American Life.


In 5/7 Categories, Men Harassed Online More Than Women

Just in case you’ve forgotten how the media works: a new study by Pew comes out showing that although all genders suffer online harassment, in five of seven categories on average men get harassed more than women.

The media reports the study as Pew: Women Suffering Online Harassment Worse Than Men and this is no doubt the lesson every casual reader takes away from it (“Can you believe there are neckbeards who still don’t acknowledge the SCIENTIFICALLY PROVEN truth that women always have it worse than men??!”).

When challenged on it, the article says that by their definition, only “sexual harassment” and “stalking” count as ‘serious” online harassment, since those are the two categories in which women have it worse.

Meanwhile, the five categories in which men have it worse include things like “threats of physical violence”, but all of a sudden this is “not serious” because caring about it doesn’t fit the prevailing narrative.

Remember that this same process produces a lot of the other “facts” that drive political debate.

Via Links For November 2014 | Slate Star Codex.


The Secret U.S. Casualties of Iraq’s Abandoned Chemical Weapons

American troops secretly reported finding roughly 5,000 chemical warheads, shells or aviation bombs, according to interviews with dozens of participants, Iraqi and American officials, and heavily redacted intelligence documents obtained under the Freedom of Information Act.

So it looks like Iraq had chemical weapons after all. Via The Secret U.S. Casualties of Iraq’s Abandoned Chemical Weapons - NYTimes.com.


Jean Tirole and Josh Lerner on Open Source

Tirole and Lerner noted, with a bit of puzzlement that, compared with open-source software writers, academics were less likely to make their data sources public and more likely to allow their work to be hidden behind publishers’ paywalls. I think that in those ten years there has been a shift, at least in economics, more in the direction of the open-source model.

(I had a hard time deciding if this was a "professional" post or an "general interest" post. "General interest" won out.)

Via Jean Tirole and Josh Lerner on Open Source | askblog.


Over-Sensitive, Over-Reacting, Passive-Aggressive Positivity, Unable To Deal With Criticism

Does this sound like anyone you know?

I’m charmed and sometimes I’m exasperated by how [Millennials] deal with the world. My huge generalities touch on their over-sensitivity, their insistence that they are right despite the overwhelming proof that suggests they are not, their lack of placing things within context, the overreacting, the passive-aggressive positivity.

I am looking at Millenials from the POV of a member of one of the most pessimistic and ironic generations that has ever roamed the earth. -- Generation X . Even my boyfriend agrees that [Millenials are] overly sensitive, especially when dealing with criticism. When [a Millenial] creates something they have so many outlets to display it that it often goes out into the world unfettered, unedited, posted everywhere … but when criticized for this content they seem to collapse into a shame spiral and the person criticizing them is automatically labeled a hater, a contrarian, a troll.

Anxiety and neediness are the defining aspects of [Millenials] and when you don’t have the cushion of rising through the world economically then what do you rely on? Well, your social media presence: maintaining it, keeping the brand in play, striving to be liked, to be liked, to be liked. And this creates its own kind of ceaseless anxiety. This is why if anyone has a snarky opinion of [Millenials] then that person is labeled by them as a “douche”--case closed. No negativity -- we just want to be admired. This is problematic because it limits discourse: if we all just like everything--the Millennial dream--then what are we going to be talking about?

Millennials can’t deal with that kind of cold-eye reality. This is why [they] only ask right now : please, please, please, only give positive feedback please.

Edited for compactness, from Generation Wuss.


This is why you should always use braces on conditionals

In issue 65 on Aura.Router, Optional parameters not working as expected?, we can see that the problem was this piece of code from the issue reporter:

if(isset($this->route->params["id"]))
    echo "id = " . $this->route->params["id"] . "<br><br>";
if(isset($this->route->params["function"]))
    echo "function = " . $this->route->params["function"] . "<br><br>";
if(isset($this->route->params["third"]));
    echo "third = " . $this->route->params["third"] . "<br><br>";

Look at that last if statement: it ends in a semicolon. Although the line beneath it that is *intended* to be the body of the if statement, as indicated by the indentation, it is *not* the body of the if statement. It gets executed no matter the outcome of the if condition.

That kind of thing is really tough to debug.

Instead, if we use braces on all conditionals, regardless of how short or long the body is, we get this:

if(isset($this->route->params["id"])) {
    echo "id = " . $this->route->params["id"] . "<br><br>";
}

if(isset($this->route->params["function"])) {
    echo "function = " . $this->route->params["function"] . "<br><br>";
}

if(isset($this->route->params["third"])) {
}

echo "third = " . $this->route->params["third"] . "<br><br>";

Then it's very easy to see what's going wrong.

That is one reason Aura adheres to PSR-2; it incorporates that rule, along with many others, that makes it easier to know what to expect when reading code. Anything unexpected becomes a signal that something may be wrong.



What's The Difference Between A "Pivot Table" And An "Association Table"?

An “association table” is a table that joins other tables in a many-to-many relationship. For example, if an Article can have more than one Tag, and each Tag can be placed on one or more Articles, then they are in a many-to-many relationship. To associate them to each other, we need a third table through which we can join them.

-- one end of a many-to-many relationship
CREATE TABLE article (
    article_id INT,
    title VARCHAR(255),
    body TEXT
);

-- the other end of a many-to-many relationship
CREATE TABLE tag (
    tag_id INT,
    name VARCHAR(255)
);

-- an association table mapping articles and tags to each other
CREATE TABLE article_tag (
    article_tag_id INT,
    article_id INT,
    tag_id INT
);

In ORM terms, we might say each Article “has many” Tags “through” the ArticleTag association, that each Tag also “has many” Articles “through” the ArticleTag, and finally that each ArticleTag “belongs to” an Article and that it “belongs to” a Tag.

When writing SQL to find the Tags for an Article, or to find all the Articles that use a specific Tag, we join the ArticlesTags table to get the associated entity IDs. The SQL looks something like the following:

-- select all the tags for an article
SELECT tag.*
FROM tag
JOIN article_tag ON article_tag.tag_id = tag.tag_id
WHERE article_tag.article_id = ?

-- select all the articles that use a tag
SELECT article.*
FROM article
JOIN article_tag ON article_tag.article_id = article.article_id
WHERE article_tag.tag_id = ?

This pattern is called an association table mapping.

On the other hand, a “pivot table” is a cross-tabulation query, frequently used in spreadsheets. You can see more about pivot tables through Google. In short, the idea is to build a query, and convert the rows into columns by grouping the rows in a particular way. These kinds of queries generally involve some conditionals and calculations to group the query results; you can see some examples here.

In summary: if you are joining tables to each other in a many-to-many relationship, the table that maps the relationship is an association table. If you are doing a cross-tabulation to convert rows into columns, you are working with pivot table.


UPDATE: Apparently "pivot" is also a keyword in SQL Server to help generate true pivot tables; see here. See also Associative Entity.



What's The Difference Between Tightly-, Loosely-, and De-Coupled ?

In a tweetstorm that spun up late last week, Taylor Otwell produced the following commentary:

look guys I’m “decoupled” because this package doesn’t have composer dependencies!!! HAHAHAHA LOL

how many composer packages a given package has does NOT affect YOUR code’s decoupling.

that is a matter of programming to an interface, etc.

you people seriously do not understand decoupling. at all.

if you type hint AuraAnything that is a HARD, CONCRETE dependency. THAT is coupling.

IlluminateContracts are all interfaces. abstractions. not concretions. THAT’s decoupling.

IlluminateContractsViewFactory could be a Laravel view factory, could be an Aura one. That’s decoupling.

how many composer pkgs the IMPLEMENTOR needs is an implementation detail my consuming code need not care about

consuming code ONLY cares about programming to an interface for decoupling.

you [@philsturgeon] and brandon [savage] and paul [jones] don’t understand basic programming concepts like coupling

and think somehow coupling is tied to composer

Aura ships hard concretions = you are tightly coupled to Aura.

which should my consuming code give a shit if Aura is decoupled AMONGST ITSELF. Nobody gives a shit.

i only care if MY code is coupled to Aura.

and since Aura makes you depends on hard concretions, it promotes hard couplings.

I’m saying if you type-hint a class dependency, you are coupled to that implementation (cont)

regardless of that package’s internal dependencies

While some of Taylor’s rant is correct for as far as it goes, much of it glosses over important distinctions in subtle misdirection, and the remainder displays some misunderstandings. He is also flat wrong in his assertions of other peoples’ understanding of “basic programming terminology.” As such, I think his words demand a careful response for future reference.

First, I’m glad to see Taylor paying attention to the proper use of terminology in a software context. This is something he’s not always been great at in the past, and I encourage him here.

But I can’t quite tell if Taylor thinks the developers who use Aura believe their code is decoupled by virtue of using Aura. Or maybe it’s that the Aura marketing phrase “fully decoupled libraries” is the target of his ire. I infer allusions to both from his tweets, so I’ll attempt to address both possibilities. (Perhaps there is some other interpretation I have missed.)

It should be so obvious as to not require stating, but for the sake of explicitness: If your code has a dependency on classes in a particular thrid-party package, your code is tightly coupled to the code in that package. This is true for any classes in any library, framework, or other package code. So, if you believe that depending on an Aura library in your code makes your code “decoupled” then you are mistaken. As far as I know, I have never attempted to state or imply otherwise. I don’t think any Aura users have this misperception, but if so, consider this a corrective.

The fact that your code could be tightly coupled to another package does not mean that the other package is coupled to anything else. That is to say, the other package might have no couplings of any sort to any other code outside itself. The other package in that case is de-coupled.

The Aura library packages are designed with that kind of decoupling in mind. That is, no Aura library package depends on anything at all in any other Aura package. Each of the Aura libraries is thus fully decoupled from the others, and incidentally from any framework that is composed of them. (Note that the *_Kernel and *_Project packages are coupled to other packages; the decoupling principle applies only to the Aura library packages.)

But why would you care if a particular library package is itself decoupled from other packages? I assert that one reason (of many) you want libraries that are themselves decoupled is so that, if you have to swap one out in your own code, you only have to worry about the one library, not about all the dependent libraries that it is coupled to (and all the dependent libraries they are coupled to). Swapping out is still tedious: you will need to work through your code, change all the typehints from that library’s classes to those in another, and change all the injections that specify classes from the library. But at least it’s only the one library; the fact that the library is itself decoupled reduces the swapping-out work.

Taylor points out another level of coupling called “loose” coupling. This means that, instead of your code depending on a particular class, you instead depend on an interface. This couples you to the interface, but not to any particular implementation. If your code depends on interfaces, your code is loosely coupled to the implementations of those interfaces (although I don’t think this means you are de-coupled – there’s still some knowledge necessary for interactions).

Being loosely coupled is a good situation to be in compared to being tightly coupled. If you need to swap out an implementation of an interface, you won’t need to change your typehints (unless you swap to another set of interfaces). However, you will still need to change all your injections to the new implementation. Overall, being loosely coupled makes for less work when swapping out libraries.

How can you tell if a package is coupled to another package? Provided that composer.json is not lying, it’s easy enough to examine the “require” element to see if there are other packages listed there. If there are, then it seems likely that the package is coupled to whatever is required. You need to exercise a little judgment, though. If the required package contains only interfaces, then the coupling is “loose”. Otherwise, it is “tight”. If there are no other required packages at all, then the package has no coupling of any sort; it is fully decoupled from anything outside of it.

However, that’s only if you assume composer.json is not lying. To really discover the coupling of a particular package, you would need to examine its code. Any uses of interfaces defined outside the package indicates loose coupling, uses of classes defined outside the package indicates tight coupling, and no uses of interfaces or classes outside the package indicates full decoupling.

(Note that this discussion is of inter-package coupling. Even if the classes inside a package may still be coupled to each other, the package as a whole may still be decoupled from any other package.)

Having said all this, Taylor is trying out a “contracts” package that exposes the Laravel interfaces independently of the implementations. I think this is a neat idea. It’s the only truly new thing I’ve seen introduced to the PHP community by the Laravel codebase, and I think it is worthy of emulation.

Even so, if the “contracts” include anything besides interfaces, I think coupling to them might be defined as “tight”. I am thinking specifically of the Exception classes included in the “contracts” package. Although it may be fair to think that Exceptions are exempt from coupling rules, perhaps they would be better provided as interfaces to Exceptions, instead of classes proper. I will reserve my judgment on that for a later time.



First Aura 2.0 Stable Project Releases!

Exciting news! After a little over a year in the making, the Aura web and CLI project packages saw their first stable 2.0 releases this weekend. This is a major milestone for Aura, as it means not just the core libraries but also the frameworks built from them are now complete.

Because Aura takes a “libraries first, framework second” approach, the project packages had to wait for the following 2.0 stable releases of these core libraries yesterday:

  • Aura.Di (a dependency injection container)
  • Aura.Web (web request/response objects, and a response sender)

Once those were stable, it was not much trouble to promote the various kernels and project skeletons to stable as well:

(Unlike Aura library packages, which have no dependencies because they are completely decoupled from each other, the *_Kernel and *_Project packages do have dependencies, as they are compositions of library and other packages.)

Read more on the Aura blog, including other library releases: First 2.0 Stable Project Releases!.