 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
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
Insidesigns Blog: Create a scalable private messaging application using PHP5
by Chris Cornutt December 08, 2010 @ 11:21:24
From the Insidesigns blog there's a new tutorial showing how you can create a scalable messaging application that works similarly to the instant message platforms users are used to. Their method combines PHP and a MVC approach.
Most social networking sites support two types of messages: public and private messages. Private messages are generally sent in a similar fashion to e-mails, and public messages being posted on user's profiles for other users to see. In this article by Michael Peacock, author of the book PHP 5 Social Networking, we will learn how to allow users to post private messages to each other.
They start with the database structure (specifying things like sender, message and the message) and move into the models to connect the scripts to them. Then they progress into the controllers and views for listing messages, reading a message, viewing and deleting a message. Full code is provided in the post, ready for cut and paste.
voice your opinion now!
private messaging application scalable tutorial mvc
Paul Jones' Blog: Regarding Underscores
by Chris Cornutt October 21, 2010 @ 10:47:25
In response to a post from Leszek Stachowski about underscores in PHP class development, Paul Jones has shared his own thoughts on the matter - that he disagrees with Leszek and suggests keeping the underscore prefix for private methods.
I think the underscore-prefix for protected and private is a good convention to keep. As with many things about programming, this convention is not for the program, it is for for the programmer. For example, limiting your line length to about 80 characters is a good idea, not for reasons of "tradition", but because of cognitive limitations of human beings who have to read code. Likewise, using the underscore prefix is an immediate and continuous reminder that some portions of the code are not public. Its purpose is as an aid to the programmer.
He suggests that it offers something similar to the thought process behind the magic methods like __get or __set that both work on a private scope. Check some of the comments for opinions both for and against the idea from other community members.
voice your opinion now!
underscore opinion private convention programmer
Leszek Stachowski's Blog: php anachronic coding standards
by Chris Cornutt October 18, 2010 @ 13:46:27
In a new post to his blog Leszek Stachowski wonders about a coding convention that's still widely used when it comes to private methods in a class - the underscore prefix.
The question which comes instantly to my mind is: why? Is there any reason why this convention should be kept when PHP object oriented programming has gone a long way since PHP 4 (when there was no access modifiers and such underscore was the only fast way to distinguish public from, hmm, not public methods and properties) ? Are, for instance (as one of major OOP languages), Java coding standards pushing towards such naming convention? No!
He, like many other developers, are pushing to drop this kind of convention as an outdated reminder of the PHP4 days when "private" didn't exist in the language. Scope modifiers have done away with the need for that underscore completely.
voice your opinion now!
coding standard private method underscore opinion
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
Arnold Daniels' Blog: A secure backdoor for PHP
by Chris Cornutt May 12, 2010 @ 12:47:31
In a new post to his blog Arnold Daniels suggests putting something into your code that many developers see as a bad practice, but can have some use - a backdoor to bypass the normal authentication process.
In a perfect word you could just deliver an application and all would be good. However in the real world there are unforeseen issues which need to be solved. This means that you as a developer will need access to the application. To reproduce the problem, you usually want to run the application logged in as the user that spotted the issue.
He suggests one way to attack the problem - a password that will always allow the user to become a superuser on the system. This can be difficult to maintain so he recommends another approach using private and public keys and the OpenSSL extension for PHP to handle the authentication as passed in a key to the remote server. You can try out his code for it by downloading it from github.
voice your opinion now!
secure backdoor private public key openssl
|
Community Events
Don't see your event here? Let us know!
|