 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Explore Aspect Oriented Programming with CodeIgniter, Part 2
by Chris Cornutt August 20, 2012 @ 09:13:36
In this new post to PHPMaster.com they continue their look at aspect-oriented programming with CodeIgniter. In part one they introduced some of the fundamentals of AOP and in this new article, they dig deeper with more practical examples.
In the previous part of this series we learned what Aspect Oriented Programming (AOP) is and the meaning of important AOP terminology. In this part I'll explain why we need AOP using practical examples and how to add AOP behavior to your PHP application using the CodeIgniter framework.
They start with a look at a few pieces of functionality that could cut across multiple parts of the application like logging or authentication/authorization. They show how to use the "hooks" feature of CodeIgniter to implement the AOP proxy class generation, executing pre- and post-controller.
voice your opinion now!
aspectoriented programming tutorial codeigniter framework practical
DZone.com: Practical Testing Patterns - Redux
by Chris Cornutt June 02, 2011 @ 12:12:25
A while back we posted about a series of articles Giorgio Sironi was doing about some of the more practical applications of testing patterns in PHP unit testing. He' been building on the series ever since and has lots of great patterns you can use to more correctly structure your testing practices.
The current list includes:
There's lots more where these came from, all divided into sections like "Fixture Setup", "Test Double" and "Database Isolation" patterns. You can find the full list so far here.
voice your opinion now!
testing pattern unittest practical
Shameer's Blog: PHP 5.3 Practical look into Lambda functions and closures
by Chris Cornutt December 30, 2010 @ 11:11:26
For those out there still coming to grips with some of what PHP 5.3 has to offer, I'd suggest checking out this new article from Shameer about using lambdas and closures along with some examples putting them into action.
PHP 5.3 packaged the power of functional programming by adding support for lambda functions and closures. You will be familiar with them in javascript. In this article we will have a look into these features and its usages.
He starts with explanations of what they are with simple code examples showing their use - a lambda assigned to a variable and closures with the "use" keyword. He shows how they can be used in application prototyping, making handy callback functions and includes a practical example of finding the factorial of a number using a lambda.
voice your opinion now!
lambda closure tutorial practical example
Vance Lucas' Blog: Practical Uses for PHP 5.3 Closures
by Chris Cornutt October 20, 2010 @ 08:51:47
By now everyone's heard about one of the more powerful and major advancements made in the PHP 5.3.x series of the language - closures. You might have read a description of them and been left wondering what a practical application might be to help drive the point home. Vance Lucas has written up a post to help with just that.
If you're like me, you might be wondering what the practical uses for these new features are before you can rightly justify diving in and using them in new or existing projects. I experimented a lot with closures and possible uses over the past few weeks, and came up with some compelling reasons to start using them.
He's come up with five different examples of how you can use this handy feature:
- Templating
- Dynamic Code Extension
- Delayed Execution
- Caching
- Convenience (as in their role in one-off functions for callbacks)
Each of the tips comes with a bit of code (except delayed execution, that's a bit more involved) to help explain the point a bit more.
voice your opinion now!
closure practical example template dynamic delay cache
Cormac' PHP Blog: Practical example php implementation of the Observer pattern
by Chris Cornutt October 14, 2010 @ 08:36:35
New from Cormac's blog there's a post looking at an implementation of the Observer design pattern in a bit more practical scenario than some other examples out there.
Observer is a pattern where an object called the subject maintains a list of dependents (observers) and notifies them of any state changes. I implemented this recently to log changes to an Account object, and to notify the account holder if their account had expire - here's the basics of the code, hopefully it'll help someone else figure out how the pattern works
The basis of the Observer pattern is that you attach these "observer" objects to a main object. These watch the object and see if something changes (like a property value) and react accordingly. For their example, they create a setup that extends the main Observer class to have some or the detection functionality built-in.
voice your opinion now!
practical example observer pattern
php|architect: Programming you're doing it wrong
by Chris Cornutt March 11, 2010 @ 11:06:42
In an opinion piece posted to the php|architect site Marco Tabini suggests that we (as developers) are doing it wrong as we move further and further away from the pragmatic side of programming into the abstract.
No matter how advanced the techniques that we use, there is always something that we could be doing better. [...] Which one is right? The real problem is that the answer to that question is, "yes." That's because it lacks a specific context in which it can be inserted.
He suggests that, in our quest to figure out what the perfect case for any situation, we stop focusing on the practicality of writing applications to accomplish goals. Sometimes it's not about getting the right theory behind the code - sometimes it's just doing it.
voice your opinion now!
programming opinion theory practical focus
Jani Hartikainen's Blog: Practical uses for reflection
by Chris Cornutt February 17, 2009 @ 10:22:36
Reflection can be a handy tool when you need it, but how many times have you actually found a use for it in the past few applications you've written? Jani Hartikainen has one suggestion of a place it can be used - form generation.
Most web applications use forms. Forms often represent some model, such as a news post. If the model is simple, writing the form in HTML is not too bad, or we might be able to use a scaffolding feature in our framework. [...] Here's a good use for reflection! Since in models we often have a naming scheme for the data the users would be able to input, we can utilize this knowledge with reflection to generate a list of possible fields in the model, and then generate the form with less typing required from us.
His example looks into the model class and pulls out the "get" functions and, after pulling out the name, adds it to a fields array. This array is then passed out to the display part of the script and looped over to create a text field for each. He expands it a bit to also include checking for "@return" values in docblock comments for the type of form field that should be displayed.
voice your opinion now!
reflecton api form generation practical suggestion model view
Symfony Blog: The "Practical symfony" book is now on sale
by Chris Cornutt January 20, 2009 @ 12:07:08
On the Symfony blog today there's a new post from Fabien Potencier about a new book that's just been released and might be of interest to those wanting to get into the framework - Practical Symfony.
Two years after the publishing of "The Definitive Guide to symfony" book, I am happy to announce that the Jobeet tutorial is now available as a printed book: "Practical symfony". During the last two weeks, I have updated and enhanced the Jobeet tutorial based on the feedback from the community. I have also updated the screenshots to reflect the new Jobeet design. The "Practical symfony" book is the printed version of this tutorial and as such covers the symfony 1.2 version.
The Jobeet tutorial was their 2008 "advent" piece that created a job posting website from scratch with each day focusing on a different aspect of the application. There are two versions of the book (Propel and Doctrine) but for now, only the Propel version can be purchased over on lulu.com.
voice your opinion now!
practical symfony framework tutorial book propel doctrine
|
Community Events
Don't see your event here? Let us know!
|