On PHPMaster.com today there's a new design pattern-focused that introduces you to using the Factory method to create new objects on the fly.The Factory Method pattern is a design pattern used to define a runtime interface for creating an object. It's called a factory because it creates various types of objects without necessarily knowing what kind of object it creates or how to create it.Code is included showing how to make creating "Product_*" classes as simple as calling a "build()" method with the...
In this recent post to his blog Brian Smithwick talks about the "locked box" that developers can sometimes restrict themselves to - getting to comfortable in the tech they already know and not branching out.Jason Austin gave a great presentation at CodeWorks Raleigh recently about cultivating one's passion for software development through side projects -- safe spaces where we can play with new technologies and techniques. The point's well taken: as developers, we're probably putting most of our energy...
In this recent blog post nikic takes an in-depth look at how large PHP arrays really are - how memory is used in the creation and management of these handy PHP variable types.In this post I want to investigate the memory usage of PHP arrays (and values in general) using the following script as an example, which creates 100000 unique integer array elements and measures the resulting memory usage. [...] How much would you expect it to be? [...] Now try and run the above code. You can do it online if you...
The error suppression operator in PHP ("@") is often seen as a
necessary evil. Many, many low-level function will return a value
indicating an error, but also raise an E_NOTICE or
E_WARNING -- things you might be able to recover from,
or conditions where you may want to raise an exception.
So, at times, you find yourself writing code like this:
if (false === ($fh = @fopen($filename, 'r'))) {
throw new RuntimeException(sprintf('Could not open file "%s" to read', $filename));
}
Seems straight-forward...
The error suppression operator in PHP ("@") is often seen as a
necessary evil. Many, many low-level function will return a value
indicating an error, but also raise an E_NOTICE or
E_WARNING -- things you might be able to recover from,
or conditions where you may want to raise an exception.
So, at times, you find yourself writing code like this:
if (false === ($fh = @fopen($filename, 'r'))) {
throw new RuntimeException(sprintf('Could not open file "%s" to read', $filename));
}
Seems straight-forward...
In a new post to his blog Sebastian Bergmann takes a quick look at using a static analyzer, clang and scan-build, to analyze the PHP interpreter (specifically during the compile process).I have been tinkering with CLANG's static analyzer lately. This post summarizes how I installed LLVM and CLANG and performed the analysis of a build of the PHP interpreter.He includes all the commands (unix-based) to get the clang tools/libraries installed in the correct places as well as what to add to your $PATH to get...
On the php|architect site today Keith Casey has written up a summary of the eastern leg of the CodeWorks conference tour that just wrapped up in Orlando, Florida.While it will still be a few days weeks until I'm finally recovered, I wanted to share a recap of CodeWorks East 2011 while it was still fresh. If you're looking for the core presenters' slides, attendees will receive them via email but they will not be published publicly until after the West Coast Tour is complete in January 2012.He mentions...
Popular posts from PHPDeveloper.org for the past week:Nelm.io Blog: Composer: Part 1 - What & Why
PHPBuilder.com: PHP Arrays: Advanced Iteration and Manipulation
CodeIgniter.com: PHP Framework Usage Survey
Devshed: Building a PHP ORM: Deploying a Blog
WorkingSoftware Blog: Your templating engine sucks & everything you've written is spaghetti code
Watts Martin's Blog: PHP is not an acceptable COBOL
DZone.com: Writing Better PHP: Three Guides
Michaelangelo van Dam' Blog: Windows Azure for PHP developers...
I have been tinkering with CLANG's static analyzer lately. This post summarizes how I installed LLVM and CLANG and performed the analysis of a build of the PHP interpreter.
First, we need to obtain the CLANG and LLVM source trees and build CLANG:
cd /usr/local/src
mkdir clang
cd clang
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../../
mkdir build
cd build
../llvm/configure --enable-optimized --disable-assertions
make...
PHP has been around for a long time, and it's starting to show its age. From top to bottom, the language has creaky joints. I've decided to take a look at how things got to this point, and what can be (and is being) done about it. I start out pretty gloomy, but bear with me; I promise it gets better.
In the Beginning, There Was Apache and CGIAnd there was much rejoicing.In 1994, Rasmus Lerdorf created the a€oPersonal Home Page Tools,a€¯ a set of CGI binaries written in C. These tools looked...
Henrik BjĆørnskov has posted a bit of an in-depth look at Stampie, an abstraction library for sending emails from PHP applications via various service providers (like SendGrid and Mailchimp).So what is Stampie. Stampie is a API wrapper for the most common email sending services. It provides a standard PHP Api to send emails. But mostly it is a project to test TDD and experiment with a couple of different things. Stampie is developed with Dependency Injection and therefore there is a lot of objects. At...
As mentioned on the main PHP.net site, the latest Release Candidate in the PHP 5.4.x series has been released - PHP 5.4.0RC3:The PHP development team is proud to announce the third release candidate of PHP 5.4. PHP 5.4 includes new language features and removes several legacy (deprecated) behaviours. Windows binaries can be downloaded from the Windows QA site. THIS IS A RELEASE CANDIDATE - DO NOT USE IT IN PRODUCTION!. This is the third release candidate. The release candidate phase is intended as a...
PHPmaster.com has a new introductory tutorial for those just starting out with PHP (or with programming really) talking about using looping structures for sets of data - for, while/do-while and foreach.A significant advantage of computers is that they can perform repetitive tasks easily and efficiently. Instead of writing repetitive code you can write a set of statements that processes some data and then have the computer execute them repeatedly by using a construct known as a loop. Loops come in several...
On the PHPClasses blog today the question is posed "can .NET make PHP run faster than the official PHP implementation?" (relating to the use of the Phalanger tool to compile PHP down to .NET assemblies.Recently Phalanger 3.0 was released introducing numerous improvements in terms of compatibility with the PHP 5.3, interoperability with .NET platform implementations including Mono on Linux, and probably most importantly performance improvements. [...] What motivated this article was that a PHP developer...
Lineke Kerckhoffs-Willems has a new post to her blog today with an update about their in-progress site that wants to share tech knowledge through video, ProTalk:A lot has happened since my October post announcing ProTalk, the secret project I am working on with my friend, Kim Rowan. So much in fact that now seems the ideal time to update you on our progress! Now, down to business! Since announcing the project in early October we have achieved the [several] project milestones.The milestones include...
Here's what was popular in the PHP community one year ago today:Ibuildings techPortal: lessphp: PHP implementation of Less CSS
Webgeekly.com: 20 Tips you need to learn to become a better PHP Programmer
SitePoint.com: Introduction to Unit Testing in PHP with PHPUnit
PHPBuilder.com: 10 PHP Tricks for Associative Array Manipulation
iFadey.com: Get Flickr Images Using SimpleXML
Francesco Montefoschi's Blog: PHPADD: abandoned docblocks detector
Chris Hartjes' Blog: Fun with API's - FRAPI and django-tastypie...
Testdriven Development, also das Schreiben eines oder mehrerer Tests bevor der eigentliche Code entsteht, ist inzwischen ein alter Hut.
Ein groAYer Nachteil dieses Verfahrens ist, dass im agilen Umfeld die User Stories erst verstanden werden mA¼ssen.
Wenn die Story aber falsch verstanden wurde, dann wird auch der Test falsch implementiert.
Knackpunkt ist also immer noch der Abgrund zwischen Analyse und Verdeutlichung der GeschA¤ftsprozesse sowie dem korrekten Erfassen und testen eben jener.
Eine...
Can .NET make PHP run faster than the official PHP implementation?
By Manuel Lemos
Phalanger is compiler that generates .NET assemblies from PHP code, so it runs in a .NET virtual machine.
The latest benchmarks seem to indicate that PHP applications compiled by Phalanger execute noticeably faster than when they are executed by the official PHP implementation based on Zend engine, even when a caching extension is used.
Read this article to learn how Phalanger works and what lessons can be learned to...
When developing enterprise software one should always keep an eye on writing code that is easily maintainable, testable and extendable. Design patterns already propose a way to implement a loosely coupled architecture. With annotations you can take a step forward to make your code look even more expressive, focusing on the primary problem instead of writing a lot of boilerplate code. A single comment line can save you many more lines of code but as it is written in the project's domain language it will...
There's no doubt that Ajax is one of the most exciting, useful, and necessary web technologies available to front-end developers. Unfortunately, it's also one of the most restrictivea€‰-a€‰especially when it comes to gathering content from other domains. Web developers are nothing if not persistent, so we've come up with a variety of ways to get around cross-origin restrictions, including JSONP, server-side proxies made with PHP, ProxyPass proxying, Flash transports, creative iFrame uses, and more. What...
|
Latest PHP Tweets
|