News Feed
Sections




News Archive
feed this:

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

Paul Jones:
Some Rules For Good Naming
April 30, 2014 @ 09:29:42

Paul Jones has a new post to his site today talking about the importance of naming when it comes to the use of different patterns in development. He also makes some recommendations to help clear up some of the confusion around different names for the same things.

[Thoughts in a] Grumpy Programmer mailing-list essay got me thinking. [...] I completely agree with the emphasis on using a common vocabulary. One issue here is that naming things properly is very, very hard. It is one of the only two hard problems in programming. Are there any rules (even rules-of-thumb) that can we use to make it easier to pick good names for the classes and concepts in our projects?

He reminds readers that code is no place for a "novel context", that is that it's not meant to be instructions for humans, but instructions for computers. He points out that patterns are more about behavior than the name you give them and that picking a name that's "close enough" isn't a good idea. He also recommends that you avoid picking a name for a special context the code might be involved in.

0 comments voice your opinion now!
naming rules opinion designpattern behavior context

Link: http://paul-m-jones.com/archives/5952

Reddit.com:
Attempting to understand Namespacing, and its benefits
January 02, 2014 @ 11:54:23

If you're relatively new to PHP, you may have read about something called "namespacing" but not fully understood it or the benefits it provides. Over on Reddit, there's a recent discussion where the poster asks about just that:

As I understand it, Namespacing provides a lot of useful context for developers, as well as making the autoloading of classes much easier (though I've never personally tried this). I can also see it being used in a large enough application where it might help keep things in scope, but this seems like a bit of a stretch to me. Apart from that, I'm not too clear on what namespacing actually does.

The comments to the thread including things like links to other resources and other suggestions like:

  • tools to try out
  • places to start using it in your own code
  • the difference between underscores and real namespacing
  • how they help avoid conflicts in naming and functionality
0 comments voice your opinion now!
namespace benefit context autoload opinion discussion

Link: http://www.reddit.com/r/PHP/comments/1u1ztr/attempting_to_understand_namespacing_and_its

Hannes Magnusson:
Query logging and profiling in MongoDB
September 18, 2013 @ 10:25:49

in a previous post Hannes Magnusson introduced the new stream handling notification feature in the MongoDB PHP extension. In his most recent post he elaborates on a subject mentioned in the previous post - query logging and profiling.

In my previous blog post I mentioned that the 1.5.0 release of the MongoDB driver for PHP has improved notification support using the PHP Notification API, and showed off a fairly useless (but fun) progress bar. Now its time for a little bit more practical examples using this system: Query logging and profiling.

He talks about some of the features in his pull request, including the new constants added to help make working with the logging on streams easier. He includes some sample code that handles the logging via an "update" callback function, parsing the log message type and save the related data to a class variable. An instance of this class is then assigned to the "notification" stream and passed in as an additional option when creating the MongoClient connection. He includes an example of querying a basic collection and how to extract the request information from the logging object instance.

0 comments voice your opinion now!
mongodb stream context tutorial log query profile notification api

Link: http://bjori.blogspot.com/2013/09/query-logging-and-profiling-in-mongodb.html

PHPClasses.org:
10 Steps to properly do PHP Bug Tracking and Fixing as Fast as possible
May 30, 2013 @ 11:49:27

On the PHPClasses.org blog today Manuel Lemos has shared some advice on tracking and fixing bugs and some strategies to help prevent them in the future.

No matter how hard you try to test your PHP applications before putting them in production, you will always ship code to your server that has bugs. Some of those bugs will be very serious and need to be fixed before they cause greater damages to your application data that may be too hard to recover. Read this article to learn about a several good practices that you can apply to track bugs in production code, so you can fix them before it is too late.

Suggestions included in his list are things like:

  • Test as Much as Possible Before in your Development Environment
  • Separate your Code from Environment Configuration files
  • Track PHP Errors with Assertion Condition Tests
  • Send PHP Errors to an Error Log File
  • Monitor the PHP Error Log File to Quickly Fix Serious Bugs
  • Fix Your Bugs but Never Edit Code on the Production Server

He also includes a brief look at some things to think about when considering "defensive coding practices" and links to other articles with more information.

0 comments voice your opinion now!
bugs advice fix track testing logging context monitoring

Link: http://www.phpclasses.org/blog/package/1351/post/1-10-Steps-to-properly-do-PHP-Bug-Tracking-and-Fixing-as-Fast-as-possible.html

Dzone.com:
Diving into Behat
April 09, 2013 @ 09:50:34

Giorgio Sironi has a new post to DZone.com today about some of his experiences with Behat, a behavior-driven development testing tool written in PHP. It uses the Gherkin language syntax to define its tests.

I had the occasion to try out and adopt Behat for a particular need in our projects at Onebip. Here is my recount of the experience from a PHPUnit contributor and invested person.

He starts off with a list of situations where he doesn't think that Behat is a good fit for testing including testing of a single object and acceptance tests where comparing the response from more than one test is needed. He suggests that it's more useful for verifying high level business rules than anything. He talks some about the shift they made to using Behat and some of the benefits they found in its use. He finishes up the post by looking at the technical side and includes a warning about letting the size of the FeatureContext file get too large.

0 comments voice your opinion now!
behat introduction context technical impact overview benefits

Link: http://css.dzone.com/articles/diving-behat

Web & PHP Magazine:
Issue #8 - The Power of Design
November 15, 2012 @ 13:55:06

The latest issue of the Web & PHP Magazine has been released - Issue 8 - The Power of Design. Articles in this latest issue include:

  • Todd Lombardo on user context
  • Stefan Priebsch on data and persistence
  • Patrick Allaert about data structures
  • June Henriksen on the human side of programming

You can find out more about this issue (and go download your free copy) on the Web & PHP site. There's also seven previous issues, all free for download (PDF format)!

0 comments voice your opinion now!
webandphpmagazine issue publish design context structure human pdf


Nikita Popov's Blog:
The true power of regular expressions
June 15, 2012 @ 08:42:57

Nikita Popov has a new (language agnostic) post to his blog today about one of the most powerful things you can use in your development - something that a lot of developers don't understand the true power of - regular expressions.

As someone who frequents the PHP tag on StackOverflow I pretty often see questions about how to parse some particular aspect of HTML using regular expressions. A common reply to such a question is: "You cannot parse HTML with regular expressions, because HTML isn't regular. Use an XML parser instead." This statement - in the context of the question - is somewhere between very misleading and outright wrong. What I'll try to demonstrate in this article is how powerful modern regular expressions really are.

He starts with the basics, defining the "regular" part of "regular expression" (hint: it has to do with predictability) and the grammar of the expressions. He talks about the Chomsky hierarchy and how it relates to the "regular" as well as a more complex mapping of expression to language rules. He talks about matching context-free and context-sensitive languages and unrestricted grammars as well.

0 comments voice your opinion now!
power regular expression define theory context


Lorna Mitchell's Blog:
Building A RESTful PHP Server Routing the Request
January 23, 2012 @ 11:14:11

Lorna Mitchell is back with a second installment in her "Building a RESTful PHP Server" series with this new post about handling and routing the incoming requests. (You can find the first part about working with the request here)

This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.

She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction" methods for responding to GET and POST requests.

0 comments voice your opinion now!
restful server tutorial request routing controller get post action


PHPBuilder.com:
Building RESTful APIs with the Slim Microframework
October 06, 2011 @ 10:12:07

On PHPBuilder.com today there's a new tutorial from Jason Gilmore about building a simple RESTful API with Slim, a microframework for PHP.

Although a relatively new entrant in the PHP framework sweepstakes, I've been lately quite intrigued by Slim, a slick RESTful microframework modeled after Ruby's Sinatra, which is coincidentally by far my favorite microframework available for any programming language. In this article I'll show you just how easy it is to get started building a powerful RESTful API using this streamlined framework.

Setup of the framework is as simple as downloading the latest copy from its github repository. It can then be included and used to make the simple routes in his examples. He uses a "games" request type to show how to handle GET, POST and PUT requests through Slim's simple interface.

1 comment voice your opinion now!
tutorial restful rest api slim microframework put get post


Web Developer Juice:
PHP Magic Functions Best Part of Object Oriented PHP - Part 2
May 19, 2011 @ 10:14:27

Web Developer Juice has posted the second part of their series looking at some of the "magic functions" that PHP has to offer - special functions that do automagic things in your scripts and classes. Part one can be found here.

In my previous post ( PHP Magic Functions ), I discussed about __construct, __destruct, __call and __callStatic. Lets explore a few more magic functions...

In this latest part of the series they look at three functions:

  • __set/__get
  • __invoke
1 comment voice your opinion now!
magic function method oop get set invoke



Community Events





Don't see your event here?
Let us know!


wordpress threedevsandamaybe bugfix series release community application configure api language project developer introduction interview podcast framework list library laravel code

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework