Development Blog With Code Updates : Developercast.com

November 30, 2010

Label Media Blog: Design Patterns in PHP – Strategy Pattern

Filed under: Development — @ 1:48 pm

On the Label Media blog today Tom Rawcliffe continues his series looking at design patterns (see here for his look at the Factory pattern) with this new post focusing in on the Strategy pattern.

The Strategy Pattern is used to decouple an algorithm from the context in which it is used. I’m going to equate this example to a real world scenario starring a man, I’ll call him Bob.

In his example Bob heads to work and takes whatever way he wants to get there. His boss only cares that he makes it there, not the path he takes. Bob can take many different ways (“strategies”) to get there, but how is up to him. Tom illustrates this with a bit of sample code with a “bob.php” that can use any number of other classes/methods to get to work (like commute, the train or a car).

OpenSky Blog: Inheritance in PHP, or why you want to use an Interface or an Abstract class…

Filed under: Development — @ 12:09 pm

On the OpenSky blog today there’s a new post about object oriented development and class structure. More specifically about how you should use interfaces and abstract classes if you want to truly lock down the methods of your classes.

Every class has an interface, every class can be typehinted as a method argument, typehint lets you specify the collaborator requirements. Not every typehint is the same.

He includes an example of how, despite a “BankAccount” type hint, classes for different types of accounts can be created and methods from the parent can be overwritten. To help remedy the situation, he shows a more structured example that uses interfaces/an abstract class to define the BankAccount structure, setting requirements on the child class functionality.

Community News: PHP Unconference Europe 2011

Filed under: Development — @ 11:05 am

If you’re around the Manchester area (or will be in February) you should consider attending the PHP Unconference Europe 2011 happening February 19th and 20th.

For the past four years, a group of enthusiasts have been organizing an unconference about PHP and related web technologies in Hamburg, Germany. What started off as a gathering of only fifty people, has grown over the course of three years into an event, which has received much following and attention within the German speaking PHP community. [...] The mission of PHP Unconference Europe is to bring together an international group of around 200 people, who have detailed knowledge of PHP and related web technologies.

For 2011, they’ve set up the European unconference to provide a whole new group of those with tech-related interests to come together and present the topics they want to hear about. Contribution ideas can be made via their Contribution System. Topics already suggested cover topics like Phing, document generation with the Zend Framework, project management and working with spreadsheets in PHP.

The tickets are already on sale, so if you’d like to attend, pick yours up and reserve your spot today! The cost is £40/46 Euro for the two day event.

Ibuildings techPortal: Using MongoDb in PHP Applications

Filed under: Development — @ 10:52 am

New from the Ibuildings techPortal there’s this article from Paul Matthews about using MongoDB in PHP applications. It’s an introductory level tutorial that uses the MongoDB extension for PHP to interface with a local database.

This tutorial will show you how to incorporate MongoDB into new or existing object-oriented applications, by showing how to interact and integrate with applications and how to deploy applications using MongoDB. [...] If you’ve implemented MongoDB into many of your systems, then maybe this tutorial will, open your eyes on a new way of integrating it. Whatever your background, if you understand object-orientation and want to start using MongoDB, then this tutorial is for you.

He links you to the resources you’ll need to get things set up – the extension and a MongoDB – as well as some “first steps” creating a sample Link and LinkPeer objects. There’s code examples of how to pull in collections, insert data back into the database and update/delete too. You can grab the full source of his examples from his github account.

Christoph Dorn’s Blog: FirePHP 1.0 in 5 Steps

Filed under: Development — @ 9:23 am

Christoph Dorn, author of the FirePHP tool for interfacing your PHP applications directly with Firebug, has written up a guide to help you get started using the latest version in five easy steps.

Get started with FirePHP 1.0 in 5 steps. Why upgrade? Check out the new features.

The steps are simple (it’s a pretty easy tool to use):

  • Install the FirePHP Companion
  • Install FirePHP
  • Use the sample code to include in an application
  • Authorize the client
  • Log a test message (code snippet included)

You can find out more about the FirePHP project on the project’s site.

Community News: Latest PECL Releases for 11.30.2010

Filed under: Development — @ 8:02 am

Latest PECL Releases:

Community News: Call for Papers for PHP UK Conference Ends Tonight at Midnight (GMT)!

Filed under: Development — @ 7:45 am

As a reminder to all of those out there wanting to submit their presentation ideas for consideration in this year’s PHP UK Conference 2011, the deadline is tonight!

The main attraction of any conference is the talks that are given and we aim to attract the best PHP speakers from around the world. We solicit talks through a call for papers so you, the community, can tell us what kinds of things everyone should be hearing about.

Be sure to get those submissions in before midnight GMT tonight or they won’t be considered! To submit your ideas, go over to the Call for Papers form and fill in your information as well as the talk information including length, a summary and, if you want to help make your point, extra reasons why the submission should be accepted. The conference will be in London on Friday, February 25th.

Hurry and submit! Time’s running out!

Martin Woodward Brings Team Foundation Server to Everyone!

Filed under: Development — @ 12:00 am

Carl and Richard talk to Martin Woodward about Team Foundation Server being used for more than just .NET development. Martin used to work for Teamprise, which was acquired by Microsoft in 2009. The conversation ranges over the new features of TFS 2010, how Java developers can also use TFS, the effects of different process templates in TFS, and more!

November 29, 2010

Till Klampaeckel’s Blog: Tracking PHP errors

Filed under: Development — @ 2:20 pm

Till Klampaeckel has put together this new post looking at the track_errors ini option (that will always put the latest error message in $phperrormsg) and how it can help you more efficiently handle the errors your application throws.

track_errors provides the means to catch an error message emitted from PHP. It’s something I like to use during the development of various applications, or to get a handle on legacy code. Here are a few examples why!

He gives the example of a failed file_get_contents that results in a warning. He suggests that, instead of suppressing the error, you set display_errors to “off” and throw an exception when on the failure. There’s trade-offs though including the fact that it’s in the global scope and additional work would have to be done to handle problems inside other scopes.

Lorna Mitchell’s Blog: 3 Ways to Access a Namespaced PHP Class

Filed under: Development — @ 1:49 pm

Lorna Mitchell has posted three different ways you can use to get access to a namespaced class in a PHP 5.3 application, all useful depending on where you are in the application and your needs.

After what felt like years of debate over the notation to use for PHP’s namespaces, it seems like the feature itself has had relatively little use or attention since it was actually implemented in PHP 5.3. We’re all used to working without it but using it does make code neater.

Her three options are:

  • Refer Namespace and Class Name
  • Import the Namespace
  • Alias the Namespace and/or Class

You can find out more about namespaces in PHP applications on the PHP manual.

Next Page »

Powered by WordPress