Paul M. Jones

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

Why You Should Contain Your Envy

... average folks are constantly faced with images of people who seem to live lives that vastly surpass the quality of their own. These images are put in front of people in order to stoke the human being’s natural tendency to envy its fellow man, and it works. The goal is to get people to strive to meet the standards displayed in these images, and to spend accordingly to close the gap. The end result is a culture in which the image of an elite few has a tremendous impact on the way everyone else seeks to live their lives, as so many are willing to go to almost absurd lengths to close the perceived gap between themselves and the ideal individuals they see on television or on social media. Unfortunately, most fail to realize that the ideal lives they seek to mimic are mere facades, often generated at great personal cost to their owners. Too many are content with the mere appearance of success (tenuous as it may be) and too few are willing to take the time to ensure that solid, legitimate foundations underlie the image.

Emphasis mine. Via Why You Should Contain Your Envy.


It's Not "The 1%", It's The "0.1%", And They're Never Quite The Same People

It turns out that wealth inequality isn't about the 1 percent v. the 99 percent at all. It's about the 0.1 percent v. the 99.9 percent (or, really, the 0.01 percent vs. the 99.99 percent, if you like). Long-story-short is that this group, comprised mostly of bankers and CEOs, is riding the stock market to pick up extraordinary investment income. And it's this investment income, rather than ordinary earned income, that's creating this extraordinary wealth gap. 

The 0.1 percent isn't the same group of people every year. There's considerable churn at the tippy-top. For example, consider the "Fortunate 400," the IRS's annual list of the 400 richest tax returns in the country. Between 1992 and 2008, 3,672 different taxpayers appeared on the Fortunate 400 list. Just one percent of the Fortunate 400--four households--appeared on the list all 17 years.

via How You, I, and Everyone Got the Top 1 Percent All Wrong - Derek Thompson - The Atlantic.


How To Modernize Your Legacy PHP Application

It is accomplished: "Modernizing Legacy Applications in PHP", the book that will help you modernize your legacy PHP codebase, is complete. You can get it now it at https://leanpub.com/mlaphp.


Is your legacy PHP application composed of page scripts placed directly in the document root of the web server? Do your page scripts, along with any other classes and functions, combine the concerns of model, view, and controller into the same scope? Is the majority of the logical flow incorporated as include files and global functions rather than class methods?

If so, you already know that the wide use of global variables means that making a change in one place leads to unexpected consequences somewhere else. These and other factors make it overly difficult and expensive for you to add features and fix bugs. Working with your legacy application feels like dragging your feet through mud.

But it doesn't have to be that way! Modernizing Legacy Applications in PHP will show you how to modernize your application by extracting and replacing its legacy artifacts. We will use a step-by-step approach, moving slowly and methodically, to improve your application from the ground up.

Moreover, we will keep your application running the whole time. Each completed step in the process will keep your codebase fully operational with higher quality. When we are done, you will be able to breeze through your code like the wind. Your code will be autoloaded, dependency-injected, unit-tested, layer-separated, and front-controlled.


From the Foreword by Adam Culp:

Developing with PHP has really matured in recent years, but it's no secret that PHP's low level of entry for beginners helped create some nasty codebases. Companies who built applications in the dark times simply can't afford to put things on hold and rebuild a legacy application, especially with today's fast paced economy and higher developer salaries. To stay competitive, companies must continually push developers for new features and to increase application stability. This creates a hostile environment for developers working with a poorly written legacy application. Modernizing a legacy application is a necessity, and must happen. Yet knowing how to create clean code and comprehending how to modernize a legacy application are two entirely different things.

But understanding how to use these refactoring processes on a legacy codebase is not straight forward, and sometimes impossible. The book you're about to read bridges the gap, allowing developers to modernize a codebase so refactoring can be applied for continued enhancement.


Early reviews and testimonials from the feedback page:

  • "This is one of those books that PHP developers from all skill levels will be able to glean value from, and I know after just a single read-through that it will be an oft-referenced resource when I need to convert my old legacy-based procedural code into something cleaner, object-oriented, and testable." (J. Michael Ward)

  • "As I followed the exercises in the book, my questions almost seemed to be anticipated and answered before the chapter was over. Structurally the book is very well paced. Chapters that I breezed over tended to be more useful than I thought they would be. I’ve been testing for years and I still picked up some useful tidbits about structuring my tests. Just having the step-by-step advice of an expert really made a difference." (James Fuller)

  • "Reading through the book, it feels like you're pair programming with the author. I'm at the keyboard, driving, and the author is navigating, telling me where to go and what to do next. Each step is practical, self-contained and moves you closer to the end goal you seek: maintainable code." (Joel Clermont)

  • "This book helped me slay a 300k line of code giant and has allowed me to break out my shell. The refactored code has 15% code coverage for unit testing which grows every day." (Chris Smith)


If you feel overwhelmed by a legacy application, "Modernizing Legacy Applications in PHP" is the book for you. Purchase it today and get started making your own life easier!



Composer-Assisted Two-Stage Configuration in Aura

After a long period of consideration, research, and experiment, we have found a non-static solution for programmatic configuration through a DI container. It is part of a two-stage configuration process, implemented through a ContainerBuilder.

The two stages are “define” and “modify”:

  • In the “define” stage, the Config object defines constructor params, setter method values, and services. This is the equivalent of the previous single-stage Solar and Aura v1 configuration system.

  • The ContainerBuilder then locks the Container so that its definitions cannot be changed, and then begins the “modify” stage. In this second stage, we retrieve service objects from the Container and modify them programmatically.

...

So now, instead of each Aura package carrying a pair of define and modify includes in a subdirectory named for the config mode, we have a single class file for each config mode. The class file is in a subnamespace _Config under the package namespace. Here are two examples, one from the Aura.Web_Kernel package, and one from the Aura.Web_Project package.

Because they are classes, you can call other methods as needed, subclass or inherit, use traits, create instance properties and local variables for configuration logic, and so on. You could even call include in the methods if you wanted, keeping the class as a scaffold for much larger configuration files. This gives great flexibility to the confguration system.

...

To make sure the Aura project installation can find all the package config files, we use the {"extra": {"aura": { ... } } } elements of the composer.json in each package to provide a mapping from the config mode to the config class.

Read the whole article at Composer-Assisted Two-Stage Configuration.


"Modernizing Legacy Applications in PHP" Update: Schedule, and Reviews

Today was my scheduled date for publishing the final edited copy of Modernizing Legacy Applications in PHP. Although the writing itself is complete, it has yet to finish its final editing pass. As such, the final version of the book is going to be delayed by at least a week. My apologies for the delay.

Even so, we have new reviews of the completed book! Here is one from J. Michael Ward:

Superb. This is one of those books that PHP developers from all skill levels will be able to glean value from, and I know after just a single read-through that it will be an oft-referenced resource when I need to convert my old legacy-based procedural code into something cleaner, object-oriented, and testable.

...

This is a very thorough guide to understanding how to write object-oriented programming in PHP in 2014 and getting developers stuck with legacy codebases up to speed with the tools that are available to them. I will recommend this to anyone who will listen.

And another from James Fuller:

The book is full of opinions on how to structure an application, but it thankfully avoids the trap of coming off as over-zealous and judgemental. The people who need this book know that legacy code is not a black-and-white problem and the tone of the book is both sympathetic and prescriptive.

...

The book is by no means overly-verbose, as you can read through it in a few well-spaced hours. I think that’s a good thing and you will probably find yourself going back to the book for reference time-and-time again, as I have already done in the period since I bought the book in beta. Occasionally you will have the annoying task of flipping to an appendix to read a large block of code but that is really a problem with any book that discusses code in detail.

And yet another from Joel Clermont:

Reading through the book, it feels like you're pair programming with the author. I'm at the keyboard, driving, and the author is navigating, telling me where to go and what to do next. Each step is practical, self-contained and moves you closer to the end goal you seek: maintainable code.

I highly recommend this book. Even if you're a seasoned developer like me (I've been writing code professionally more than 20 years), you will benefit from Paul's approach and detailed documentation of the process.

If you feel overwhelmed by a legacy codebase, go out and buy Modernizing Legacy Applications in PHP today. (Updates are free for life.) The sooner you get started modernizing, the sooner you can start going home on time!


Michelangelo's David With A Rifle: A Right To Bear Arms

ArmaLite’s ads broke the unwritten rules. Instead of highlighting the hero’s body, they emphatically made him a warrior. Hence Franceschini’s objection to an “armed David,” even though every David is armed. “David famously used a slingshot to defeat the giant Goliath, making the gun imagery, thought up by the Illinois-based ArmaLite, even more inappropriate,” writes Emma Hall in Ad Age.

To the contrary, the gun imagery, while incongruously machine-age, was utterly appropriate. David did not use a “slingshot.” He used a sling. As historians of ancient warfare -- and readers of Malcolm Gladwell’s latest book, “David and Goliath” -- know, a sling was no child’s toy. It was a powerful projectile weapon, a biblical equivalent of ArmaLite’s wares.

Nor did Florentine patrons commission statues of David because he looked good without his clothes. They commissioned statues of David because he was a martial hero who had felled an intimidating foe. They made him a beautiful nude to emphasize his heroism, not to disguise his bloody deed. (Donatello’s David has his boot triumphantly on Goliath’s severed head.) Michelangelo’s giant was meant as an inspiration to locals and a warning to would-be invaders. He wasn’t an underwear model. He was a Minuteman. Putting a gun in his hand may look weird, but it’s a lot truer to his original meaning than a souvenir apron.

via Michelangelo's David Has a Right to Bear Arms - Bloomberg View.


Don't Confuse Money Flows With Real Resources

While it is true that we spend more than other countries [on medical care] in an accounting sense, we actually use fewer real resources: fewer doctors, fewer nurses, fewer hospital beds, shorter lengths of stay, etc. That means that from an economist’s point of view, we aren’t necessarily spending more than other countries.

Fuchs says that with an extra $1 trillion, we could have more bridges, more highways, more teachers, more R&D, etc. But once again, this confuses money flows with real resource use. We can’t devote more real resources to non-health care unless we use fewer real resources in health care. But if we copy other countries, the resource flow will go in the opposite direction. That is, in order to have more doctors, nurses, hospital beds, etc., we will have to have fewer teachers, fewer roads, less R&D!

via A Better Way to Save $1 Trillion | John Goodman's Health Policy Blog | NCPA.org.


Publishers withdraw more than 120 gibberish papers

The publishers Springer and IEEE are removing more than 120 papers from their subscription services after a French researcher discovered that the works were computer-generated nonsense.Over the past two years, computer scientist Cyril Labbé of Joseph Fourier University in Grenoble, France, has catalogued computer-generated papers that made it into more than 30 published conference proceedings between 2008 and 2013. Sixteen appeared in publications by Springer, which is headquartered in Heidelberg, Germany, and more than 100 were published by the Institute of Electrical and Electronic Engineers IEEE, based in New York. Both publishers, which were privately informed by Labbé, say that they are now removing the papers.

Just because something is published under the banner of "SCIENCE!" does not mean is it actually scientific. Via Publishers withdraw more than 120 gibberish papers : Nature News & Comment.


How To Convert Include Files To Classes

When working with legacy applications, there are two major problems tied for first place in causing frustration, pain, and overtime: globals, and includes. I talk about how to remove globals in "It Was Like That When I Got Here". But removing includes can be a much bigger challenge in many ways.

My new book, "Modernizing Legacy Applications in PHP", has an entire chapter on how to convert includes to independently testable classes. The chapter describes how to do this in a way that does not break the existing legacy code.

As a gift to PHP developers suffering under legacy applications, I have made that chapter part of the sample text for the book. You can read it here.

Afterword

Are you overwhelmed by a legacy PHP application? Have you inherited a spaghetti mess of code? Does it use globals everywhere, so that a fix in one place causes a bug somewhere else? Does every feature addition feel like slogging through a swamp of includes?

It doesn’t have to be that way. "Modernizing Legacy Applications in PHP" gives you step-by-step instructions on how to get your legacy code under control by eliminating globals and separating concerns. Each chapter shows you exactly one task and how to accomplish it, along with common questions related to that task.

When you are done, you will come and go through your code like the wind. Your application will have become autoloaded, dependency injected, unit tested, layer separated, and front controlled. And you will have kept it running the whole time.

Buy the book today, or sign up for notifications on the mailing list below!

[mc4wp_form id="5830"]


Laravel Keeps Using That Word -- I Do Not Think It Means What They Think It Means

One of the things that we do by defining design patterns is we create a common language that we can use to explain and express ourselves. When I say to you “I used an Adapter” or “I implemented the Factory pattern”, that should conjure up a specific image in your mind of object relationships and behaviors, even if you don’t know my specific use case or problem domain.

When we use these terms incorrectly, we not only devalue them, we confuse developers. For one of the most up-and-coming frameworks to use a technical term so incorrectly is disturbing. It breaks down the vocabulary that technical people use to communicate with each other, because there are now two very different definitions floating around with the same name.

Of course, Laravel’s Facades are in fact well-designed proxies implementing the Proxy Pattern. There’s nothing wrong with that: as a developer, it’s up to you to decide how and what patterns you’re willing to accept in your framework, and to write your application however you wish. All I ask is that we stop calling them Facades.

Hear hear. Via Let’s Talk About Facades | BrandonSavage.net.