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

Rob Allen:
Throw an exception when simplexml_load_string fails
Sep 09, 2014 @ 09:27:13

In a quick post to his site Rob Allen shares a class that he's created to handle and throw an exception any time that the load from a SimpleXML parsing fails.

I keep having to look up how to stop the warning that are emitted when simplexml_load_string & simplexml_load_file fail, so this time I've written the world's simplest little class to take care of it for me from now on.

His "Xml" class wraps around the SimpleXML functionality and checks to see if the resulting object is false. If it is, it uses some internal error handling to fetch the error message result and throws it as a "RuntimeException". This error string comes from a "getXMLErrorString" function that uses the libxml_get_errors function to get the resulting error list.

tagged: simplexml load string file fail exception error handling

Link: http://akrabat.com/php/throw-an-exception-when-simplexml_load_string-fails/

7 Reasons Why TDD Failed to become Mainstream
Jun 11, 2014 @ 09:44:39

In the latest PHPClasses.org post Manuel Lemos suggests severn reasons why TDD failed to become mainstream in most development communities. This is related to comments from an leader in another community about his perspective on the "TDD movement".

Recently the creator of Ruby On Rails declared that TDD (Test Driven Development) is dead. Despite he used to be a supporter of TDD as the right way to do software development, he finally decided to announce that he really does not agree that TDD is really the right way. Read this article to learn more about what happened and what does this mean for developers that support TDD or not.

He starts with a brief look at what TDD (test-driven development) is and a link to a ThoughtWorks video of DHH talking about his new stance. Among his reasons are things like:

  • TDD is Expensive
  • You Will Change Your Projects and Old Tests Become Waste
  • Extensive Testing is Boring
  • Many TDD Preachers Do Not Use it Most of the Time But Do Not Admit it

Manuel shares some of his own opinions on the matter, though, pointing out that he doesn't think TDD is dead. He suggests that it helps to "make you rethink" when developing and that your (and your development group's) practices shouldn't be influenced by outside opinions - use what works.

tagged: tdd fail mainstream opinion dhh video introduction

Link: http://www.phpclasses.org/blog/post/237-7-Reasons-Why-TDD-Failed-to-become-Mainstream.html

Federico Cargnelutti:
API Development Tips
Jul 17, 2013 @ 13:50:45

Federico Cargnelutti has a quick post to his site today sharing some general API tips you could follow when creating your backend application.

Organizations who are paying attention already know they need to have an open web API, and many already have under development or in the wild. Make sure you haven’t been caught by the pitfalls of many early API releases.

He briefly mentions the idea of having multiple points of failure and includes five more general tips based on information from this video:

  • Test it all
  • Plan for future versions
  • Embrace standards
  • Monitor everything & be honest
  • Fail well
tagged: api development tips list video test version standards monitoring fail

Link: http://blog.fedecarg.com/2013/07/17/api-development-tips

Maarten Balliauw:
Running unit tests when deploying to Windows Azure Web Sites
Jan 30, 2013 @ 10:25:20

Maarten Balliauw has a new post to his site showing you how to execute your unit tests (in this case PHPUnit) when you deploy your instance out to the Windows Azure platform.

When deploying an application to Windows Azure Web Sites, a number of deployment steps are executed. For .NET projects, msbuild is triggered. For node.js applications, a list of dependencies is restored. For PHP applications, files are copied from source control to the actual web root which is served publicly. Wouldn’t it be cool if Windows Azure Web Sites refused to deploy fresh source code whenever unit tests fail? In this post, I’ll show you how.

He creates a super basic script using Silex and writes up a test with some dummy assertions, checking if true equals true. He then steps you through updating the current "deploy.sh" script to add in a call to execute PHPUnit and an "exitWithMessageOnError" statement. This statement kicks it back and causes the deployment to fail when tests don't pass (as seen here).

tagged: windows azure phpunit unittest execute deploy fail


Court Ewing's Blog:
Follow-up: How PHP is Broken and How It Can Be Fixed
Nov 15, 2011 @ 10:18:45

In a follow up to his previous post about how PHP is broken (and what can be done to fix it), Court Ewing has this new post with a few suggestions on how PHP development could be better, but admits that PHP itself is not broken.

It is no secret that the PHP development process has never been a shining example of project organization or quality assurance. Until recently, some of the most important aspects of any project's development cycle were either entirely lacking or were ill-defined. Worse, there was little in the form of systemic quality assurance. Fortunately, the core devs did not ignore these issues, and they've been pushing really hard to improve on these areas over the past few years.

He points out two things that he sees as things that could be improved in the overall process of developing the language - noting that failing automated tests are ineffective and that communication is a key factor in the trust developers have in PHP.

The core PHP developers have long been a key component of [the amazing things the language can do], and none of progress that modern PHP applications have made would be possible without their ongoing efforts. As a result of those efforts, PHP is a stable, secure, and beautifully-practical language that is both easy for novices to wrap their heads around and experts to build the most-used web applications the world has ever seen.
tagged: broken opinion fixed communication automated test fail


Keith Casey's Blog:
Where Open Source Fails
Sep 30, 2010 @ 12:12:01

In a new post to his blog today Keith Casey has voiced some of his opinions on where he thinks most Open Source software efforts fail in their goals of making good, quality software that's well-developed and useful.

Earlier this week, I unsubscribed from the mailing lists of a pair of Open Source projects. About two years ago when I found the projects, they involved fascinating topics in under served niches. One of those niches - the one customer/user-facing - is still there and under served, but that's not relevant in the current discussion. In reviewing the activity on the mailing list, I noticed some interesting things: activity was very high, there were some smart people involved in the discussions and there was a lot of discussion on what should be done but nothing actually getting done.

He notes that without a codebase to work from, there can't be any direction because no one knows where things are headed or what can be done to improve it. Writing up a spec to guide the development can help, but then you still have the pitfall of who should write that spec.

tagged: opensource software fail opinion specification


Paul Jones' Blog:
How Complex Systems Fail
May 13, 2010 @ 14:27:53

Paul Jones points out a paper from Richard Cook, How Complex Systems Fail [pdf], and mentions how a lot of the points can directly correlate with programming in general.

The paper How Complex Systems Fail by Richard Cook should be required reading for anyone in programming or operations. Hell, it should be required reading for most everyone. You should read the whole paper (it’s very short at under five pages).

He lists out some of the key points made in the paper including that complex systems can both be helped and harmed by the inclusion of humans in the mix and that, when things change, it opens the door for a whole new kind of failure.

tagged: complex system fail opinion


Do Frameworks Fail? When?
Dec 29, 2009 @ 11:27:35

With all of the good things that frameworks can provide, there's still some bad that can come with them. In this recent post from Developr.com Jayesh Kitukale mentions a few of these downfalls.

Before reading this post, please note that the author of this blog is an entrepreneur who has turned to business from the technical background. The views and opinions have strong relevance to this fact. Anyone who is purely technical or managerial may not agree with some or all points noted in the article.

He touches on three problem areas - the learning curve, how efficient the code can be and the total cost of ownership that can come with it. He also points out some of the things that a good framework should strive for including that it be cost effective and make is faster for you to deliver your product to market.

tagged: framework fail opinion


Jordi Boggiano's Blog:
Major glob() fail
Dec 07, 2009 @ 13:50:54

Jordi Boggiano had the "pleasure" of discovering a small quirk with PHP's glob function in an application he was working on - watch out for directories that contain square braces, they won't return in the results!

Working on some personal project that lists a bunch of stuff on my hard drive, I found out that directories that contain square brackets (those []) don't return any results for the simple reason that glob reads [stuff] as a character class, just like in regular expressions. When you know it it makes perfect sense, but when you don't, the documentation is really not so helpful. Of course it mentions libc's glob() and unix shells, but not everyone knows what that implies at first glance.

He tried a few things to get around the bug (including escaping the brackets in the directories) but ended up writing a function (glob_quote) to handle the escaping of all of the meta-characters glob might need to escape to return all of the files and folders correctly.

tagged: glob fail regularexpression match


Christian Stocker's Blog:
Upload Progress Meter for Windows - The next take
Mar 13, 2009 @ 09:38:35

Christian Stocker has posted about "the next take" on the PHP upload progress meter extension - a new version that plays a bit nicer on Windows than before.

The uploadprogress extension for PHP never really worked on Windows and since I don't have a Windows development environment I could never do a proper analysis of the problem. Until this week, when Tomas Holusa sent me an email telling me about some VCWD_RENAME problems on Windows.

A patch that was submitted a while back confirmed the issue and a new patch was written and submitted to take care of the problem. You can try out the new extension on Windows with either the normal Wind32 build or Win32 nts build.

tagged: upload progress meter windows patch vcwdrename fail extension