News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

Typical Programmer Blog:
Doing it wrong getters and setters
June 16, 2008 @ 11:19:17

According to this new post on the Typical Programmer blog, using getters and setters in your scripts only adds in a bit of unnecessary coupling and complexity to your scripts that you just don't need.

Today most of the popular programming languages support objects, limiting scope, modularity, passing by value, and sophisticated built-in types. There should be no reason to deliberately expose an object's data to the rest of the code because the language can enforce encapsulation and data hiding.

While not specific to PHP, the post does recommend against them because of one simple reason common to all languages that make them possible - they "break the encapsulation OOP offers". For them, they're like a cheat to get around bad coding practices and are not needed to make a successful application work.

0 comments voice your opinion now!
getter setter break object oriented encapsulation scope bad



Rails for PHP Developers:
Three New Articles Posted (Scope, Variables & RegEx)
February 19, 2008 @ 08:44:00

Mike Naberezny has posted a few more articles to the "Rails for PHP Developers" website (based on this book) covering some more of the basics.

There's three new tutorials posted:

  • Ruby Block Scope - the basics of Ruby block scope, a common point of confusion for PHP developers new to Ruby.
  • Variable Arguments - an article that shows two common API patterns found in Rails, variable arguments and option hashes, and how to implement them both in PHP.
  • Regular Expressions in Ruby - a useful reference that maps all of the common PHP regular expression functions to the equivalents in Ruby.

Check out the rest of the site for even more great content.

0 comments voice your opinion now!
rails development regularexpression variable argument scope ruby


SitePoint PHP Blog:
Lexical scope to appear in PHP?
December 25, 2007 @ 09:46:00

<> In this new post to the SitePoint PHP blog, Troels Knak-Nielsen talks about some of the advancements (and diagreements) that have happened around adding lexical scope to the create_function functionality.

The main argument against approving the patch, seems to be, that one would expect static scoping rules to apply to the anonymous function. After all, this is the case in similar languages, which support anonymous functions. One could only assume, that changing PHP to support this, would be a major undertaking.

One would be wrong, it seems.

A patch has been made to add the functionality (from Christian Seller) adding a new keyword, lexical, to make it all work.

0 comments voice your opinion now!
lexical patch scope parse christianseller lexical patch scope parse christianseller


Arnold Daniels' Blog:
Perl like temporary variables in PHP
November 02, 2007 @ 09:38:00

Arnold Daniels points out a quick method for creating what he calls "perl-like temporary variables" in the global scope of a script:

When writing code in the global scope, I often have a problem where I'm overwriting a variable. This happens even more often when I work on code of somebody else. Usually has the variable which does the overwriting is usually just a temporary variable.

His code is a simple few lines that shows how it could be used when trying to write information out to a file handle. Some of the comments on the post criticize his use of the global scope but Arnold comes back with his reasoning - mostly that there is already code in the global scope and that adding something else is only adding to it, not making things worse.

0 comments voice your opinion now!
temporary variable perl global scope temporary variable perl global scope


I/O Reader:
15 Cool Things & 12 Things to Dislike About PHP
August 20, 2007 @ 08:32:00

On the I/O Reader blog, there's two different posts that take two sides of the spectrum when it comes to what to like and dislike about PHP, both lists of features of the the language:

Both have their valid points and it's interesting to see how many of the points made in the first article he goes back on and mentions specific instances where it doesn't work as expected. Some of the comparisons seem a bit like he's comparing PHP to his experience in another language and not objectively on PHP's features alone.

0 comments voice your opinion now!
list like dislike autoload magic function scope list like dislike autoload magic function scope


PHP 10.0 Blog:
More inlining
November 20, 2006 @ 08:10:00

On the PHP 10.0 Blog, Stas talks more about inlining in PHP functions - some of the bad things this time (see here and here for other comments), including things that could break an application if not handled correctly.

Performance benefits from inlining simple functions might be significant, since function call in PHP is not cheap. We'd have some potential problems there.

Included in the list are things like:

  • Variable scoping - we don't want function variables to mess with our scope, so we'd probably rename them or something.
  • Then we might get a problem if function messing with current scope is called indirectly so we can't really know.
  • And then some may use end-of-scope for destruction of variables that have dtors, so when we'd clean up these variables?

1 comment voice your opinion now!
inlining function performance benefit problem scope variable inlining function performance benefit problem scope variable


Jonnay's Blog:
PHP vs. Javascript A shit vs. poo fight.
October 13, 2006 @ 07:38:00

Responding to this commentary from the SitePoint PHP Blog the other day, Jonnay has come up with some of his own thoughts on each of the topics mentioned.

Apparently there was some kind of PHP vs. Javascript fight, to see which language sucked the most. The results? Amazingly Banal, if not downright wrong.

Topics in each round of the fight included:

  • Syntax
  • Standard Libraries
  • Meta Programming
  • Error Handling
  • Garbage Collection
Jonnay comes back with his (differing) perspectives on a few of the items - syntax, scope/namespaces/packaging, meta programming, AOP, and an overall commentary in which he reminds readers that defending either side isn't easy when the voting audience might not fully understand one language or the other.

0 comments voice your opinion now!
javascript versus fight comments problems syntax scope meta javascript versus fight comments problems syntax scope meta


Tnx.nl:
PHP in Contrast to Perl
May 22, 2006 @ 06:21:33

As long as people "choose sides" when it comes to programming languages, there will always be articles like this to compare them. This time, it's a look at PHP versus another much-loved language, Perl.

The article takes a look at several different topics under this one umbrella, including:

  • Arguments and return values are extremely inconsistent
  • PHP has inconsistent function naming
  • PHP has no lexical scope
  • PHP has too many functions in the core

Obviously, they all seem to take a negative slant on PHP, but they do provide some content under each of the headings to back up their claims. They break out the contents of each of these examples to make comparison of Perl's and PHP's similar functionality easier. At the end, they also provide links to other resources and other posters illustrating some of the points they've shown.

0 comments voice your opinion now!
php contrast perl arguments function naming scope php contrast perl arguments function naming scope


Mike Naberenzy's Blog:
Symfony Templates and Ruby's ERb
February 20, 2006 @ 07:12:44

In his latest blog entry, Mike Naberenzy takes a look at the Symfony framework and shares some of his opinions on it.

One thing that I think Symfony gets right is that it appears to use partitioned PHP code for its templates, in the spirit of Paul's Savant system.

I noticed in the Symfony demo that there is no separation of scope between variables passed to the template from the controller and local variables in the template. I'd like to see them scoped properly ("$this->products") but I can certainly understand why they did it this way. Using "$this->" in the template everywhere quickly gets messy.

He mentions a few other items he saw as well, including a way to correct the above mentioned problem (two ways - one more single-instance, the other more global).

0 comments voice your opinion now!
php symfony template ruby ERb scope short_open_tags php symfony template ruby ERb scope short_open_tags



Community Events











Don't see your event here?
Let us know!


database PEAR package zend code framework book releases developer zendframework release ajax job mysql security cakephp PHP5 application example conference

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework