Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Full Stack Radio:
52: Taylor Otwell - Patterns for Simplifying Laravel Applications
Oct 18, 2016 @ 09:38:05

The Full Stack Radio podcast, hosted by Adam Wathan, has posted their latest episode - an interview with Taylor Otwell, creator and lead developer on the Laravel (and most of the projects in its ecosystem).

In this episode, Adam and Taylor Otwell have a discussion about strategies they use to write cleaner, simpler code when working with the Laravel framework.

They talk about several of the other packages/products in the Laravel ecosystem (like Valet, Spark and Passport) as well as some of Taylor's thoughts on simplifying code including a few other links to presentations and tutorials on the same topics. You can listen to this latest episode either using the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for updates on when new episodes are released.

tagged: fullstackradio taylorotwell laravel simplify patterns development podcast ep52

Link: http://www.fullstackradio.com/52

Jesse Schutt:
Simplifying Conditional Expressions
Apr 04, 2016 @ 14:47:43

Jesse Schutt has posted a set of helpful hints around simplifying conditional expressions in your PHP code. This can not only make them more readable but also easier to maintain in the future.

As I’ve been reading through Refactoring by Martin Fowler, I’ve found it helpful to rewrite some of the examples from the book in PHP in order to cement the concepts into my mind. While Martin’s examples are primarily in Java, I’ve found an overwhelming majority of the concepts apply to PHP, which is where I spend most of my programming time.

In today’s article, I will attempt to rework the Simplifying Conditional Expressions (pp. 237-270) section into a handful of PHP-based examples.

He touches n a few different types of conditional refactoring and provides examples for each:

  • Decomposing the Conditional
  • Consolidate Conditional Expression
  • Consolidate Duplicate Conditional Fragment
  • Replace Nested Conditional with Guard Clause

He ends the post with a reminder about why refactoring like this is important to both you and your code:

Computers excel at taking sets of instructions and stepping through them systematically. They don’t need code to have informative method or variable names. They don’t even need the code to be formatted in a specific pattern (aside for the syntactical requirements). Our goal in simplifying conditional expressions should be to make the code read easier for humans, not for computers.
tagged: simplify conditional expression example refactor tutorial

Link: http://zaengle.com/blog/simplifying-conditional-expressions

Master Zend Framework:
Simplifying Unit Testing (and asking for help when needed)
Mar 20, 2014 @ 11:54:16

On Matthew Ssetter's "Master Zend Framework" blog today he talks about simplifying unit testing and some of his experience with getting too complicated in his own testing practices.

Recently I was a bit stuck, trying to figure out how to test a section of an application I’ve been developing. Specifically, I was trying to mock a HydratingResultSet in a controller test, so it could be the return value of a method call on a datasource, my controller needed. I was sure it was the right approach to help ensure the functionality in question was working properly. But no matter what I tried, my tests didn’t work, because I wasn’t mocking it correctly. [...] I asked for help [on IRC], laying out the problem as I saw it. The first response which came back, from Ocramius, stopped me dead in my tracks: "Why are you trying to do that?"

He includes a bit of background on what he was trying to test and the functionality around it and how, when he stopped to think about it, wondered why he was testing it too. He talks about the refactor he made to his code with a positive end result - the tests now passed. He suggests a few questions to ask yourself when writing your tests such as "am I doing too much?" or "am I testing code in the right place?" Chances are, if you step back and really look at what you're testing, you might realize that the answer to these questions is just to simplify.

He finishes the post with a few suggestions, some of his own personal favorites, of places you can go for help when questions do pop up. He points out that the usual excuses shouldn't be a blocker on asking for help. He is "encouraging you to set your pride, ego and excuses aside and when you’re stuck: ask for help."

tagged: testing simplify unittest zftalk help question

Link: http://www.masterzendframework.com/people/right-approach-unit-testing-asking-help

Simplify Form Handling in a Big Way
Feb 02, 2011 @ 12:16:54

On NetTuts.com today there's a new tutorial that wants to help you simplify your form handling in your PHP application with a few advanced tips.

Save time, reduce maintenance pains, simplify your code, and do it all while feeling like a freakin’ genius! In this tutorial, learn how to use variable variables, lookup arrays, and a bit of clever programming to simplify form handling in a big way.

They show how to use variable variables in some practical examples of filtering posted information and an alternative to creating multiple form handling scripts that all do (virtually) the same thing. They've created an alternative - a single script that uses a large switch to filter through each posted element.

tagged: simplify form handling tutorial


RIA Development Center:
Expression Web 2 for PHP Developers - Simplifying Your PHP Applications
Sep 30, 2008 @ 09:38:53

On the RIA Development Center website, there's this recent post showing off the Expression Web 2 software and how PHP developers could use it in their coding work.

Some of the most important new features in Microsoft's recently released Expression Web 2 involve enhanced support for PHP. Don't think this is just a half hearted effort to appeal to the Open Source web development crowd. Expression Web 2 supports PHP developers with a carefully constructed, feature full treatment which you should seriously consider for your PHP applications.

These new features include a built-in development server with integrated browser support, include and design view integration, IntelliSense (code completion) and support for XHTML syntax and syntax highlighting.

tagged: microsoft expresssionweb2 simplify development application