 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Vance Lucas: Introducing Bullet The Functional PHP Micro-Framework
by Chris Cornutt December 21, 2012 @ 09:02:00
Vance Lucas has a new post to his site sharing at a project he's been working on, a micro-framework for PHP that takes a functional approach to its structure (and the structure of the apps you can make with it), Bullet.
Bullet is a new PHP micro-framework with a unique functional approach to URL routing that allows for more flexibility and requires less verbosity than the more typical full route+callback approach found in other micro-frameworks. The main problem with most micro-frameworks and even full-stack MVC frameworks that leads to code duplication is that the callback or method executed to perform the action and respond to the URL route lives fully within its own scope. This means that you are forced to repeat a lot of setup code across URL route handlers that load the same resource, authorize it, etc.
He illustrates with an example of a GET/DELETE to the same routes and having to create multiple handlers for each. He restructures this with Bullet and shows how it can nest callbacks inside of handlers to make for simpler routing. It also scopes down requests and gets more fine grained as you nest, making it easier to create reusable handlers (like in other files). If you're interested in finding out more about Bullet and its structure, you can find it in the project's main site.
voice your opinion now!
bullet microframework nested functional scope routing
Community News: Privates - Harmful or Useful? (Discussion)
by Chris Cornutt December 12, 2012 @ 09:53:57
There's been a few articles posted on various blogs in the PHP community recently about the "most correct" usage of the "private" scope in your PHP applications. As with any feature of just about any language out there, there's people on both sides of the fence. Here's the ones that have weighed in so far:
- Brandon Savage's initial post (an excerpt from his upcoming "Do This, Not That" book)
- A response to this from Anthony Ferrara
- Brandon's own response to comments on his previous article
- This new post from Larry Garfield and some of his experience from the Drupal world
Various topics come up during these posts including static coupling, using interfaces versus inheritance, wrapper classes and developer intent.
voice your opinion now!
private scope visibility harmful blog
Rob Allen's Blog: Access view variables in another view model
by Chris Cornutt April 03, 2012 @ 12:53:37
In this new post to his blog Rob Allen shows you how to access the view variables from another ViewModel.
Unlike Zend Framework 1, the view layer in Zend Framework 2 separates the variables assigned to each view model. This means that when you are in the layout view script, you don't automatically have access to variables that were assigned the the action's view model and vice versa.
He includes snippets of code with an example controller and a sample view that fetches a value from a child ViewModel instance. He also shows how to access layout and configuration values in the view.
voice your opinion now!
view model variables other scope child viewmodel zendframework2
Vance Lucas' Blog: Protected vs Private Scope Arrogance, Fear and Handcuffs
by Chris Cornutt April 05, 2011 @ 10:45:53
Vance Lucas has tossed his hat into the ring in the debate about private versus protected scope in PHP projects with this new post to his blog.
The age old private vs protected debate has been re-ignited in the PHP community recently following the decision of Doctrine2 and Symfony2 to make all class methods private until there is a very clear and proven reason to change them to protected or public. The intention is a good one - to ensure they are providing a clear and stable API through intentional and known extension points that they can better test and support. [...] The problem is that this kind of thinking is a slippery slope that kills the spirit of programming.
He suggests that, by limiting the scoping down to private, you're taking away the very thing that gets most people excited about third-party tools - the extensibility. In his opinion, it sends a strong message to other developers that they're "not welcome" to make suggestions or updates to the application/tool.
voice your opinion now!
opinion private protected scope application thirdparty
Community News: Dutch PHP Conference - Updates to the site and the schedule
by Chris Cornutt February 24, 2011 @ 13:49:39
The Dutch PHP Conference has posted an update about the conference today including changes to the schedule and how its represented on the site.
t has been about two weeks since the schedule was published and ticket sales started, but that doesn't mean we haven't done anything in the meantime! There have been a number of updates on both the site and the schedule.
There's five new talks that've been added to the schedule including Paul Matthews' presentation on Solr, Chris Jones talking about high performance PHP apps and David Soria Parra on git. The site updates mainly revolve around the classification of the different sessions - icons added to show skill level and scope of the presentation. There's also an update about the unconfernece and official conference social.
voice your opinion now!
dutch conference dpc11 speaker classification skill scope unconference social
Stefan Koopmanschap's Blog: My privates are not public, they are protected
by Chris Cornutt July 19, 2010 @ 13:58:12
Stefan Koopmanschap has spoken up in response to some of the comments about OOP design, specifically in using the private scope in your applications. Overall, Stefan agrees and thinks that this access prevents possible extension which goes against the whole point of writing open source software.
I agree with pro-private people that it is important to have a good API design and to use that to protect less experienced developers from making mistakes, however one should never assume that the developers using your libraries, especially Open Source libraries, are less than yourself. [...] I definitely am not in favor of simply opening up the complete library to every developer though. By making a clear decision on which methods are public and which methods are protected you will ensure that people simply implementing your library will use the API that you have taken the time designing.
His does note, however, that there are cases when a private scope is valid - usually when it involves a planned, architected product where it is someone's responsibility to have that access controlled.
voice your opinion now!
private protected scope access modifier opinion
DevShed: PHP 5 Helpers Calling Methods Out of Object Scope
by Chris Cornutt July 27, 2009 @ 12:38:17
In this new tutorial from DevShed today they continue their series looking at making helper classes for your applications. This time they're focusing on using methods without needing to create an object first - static methods.
The methods of the class that I [just] mentioned were declared implicitly dynamic, even though it's perfectly possible to call them statically, and the PHP engine won't raise any errors about this process. However, it would be much better to declare these methods explicitly static, thus taking advantage of the functionality offered by the text helper class without having to spawn an instance of it.
They show how to define the methods with the "static" keyword so they can be called outside of the class' scope. Code for the helper class and the code to put it to use.
voice your opinion now!
method class object scope tutorial
Leonid Mamchenkov's Blog: Perl vs. PHP variable scoping
by Chris Cornutt December 12, 2008 @ 08:49:14
Leonid Mamchenkov has compared Perl versus PHP in this new blog post - specifically how they handle variable scoping.
I've mentioned quite a few times that I am a big fan of Perl programming language. However, most of my programming time these days is spent in PHP. The languages are often similar, with PHP having its roots in Perl, and Perl being such a influence in the world of programming languages. This similarity is often very helpful. However there are a few difference, some of which are obvious and others are not.
His example compares looping (a foreach in both) and how, after the Perl loop the $value variable is no longer accessible. In PHP, however, it's passed back out into the current scope and can be read just like any other variable. While this can be useful, it can also cause headaches when trying to track down elusive bugs.
voice your opinion now!
variable scope foreach loop local outside compare
|
Community Events
Don't see your event here? Let us know!
|