News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Qafoo Blog:
Utilize Dynamic Dispatch
October 16, 2014 @ 11:52:18

On the Qafoo blog today Tobias Schlitt talks about dynamic dispatch, what he calls a "fundamental concept of OOP" to help provide clean, clear interfaces in the code.

I want to use this blog post to illustrate the concept of dynamic dispatch which I use a lot recently to motivate creating clean OO structures in my trainings. In my experience, this helps people to understand why we want to write code in this way. After that I will show why traits are bad in this direction.

He explains the concept of "dynamic dispatch" by starting from the beginning...with procedural PHP code. He looks at the usual flow of this kind of application that call shared functions in a "top down" fashion. He looks at what would happen if new logging needs were introduced (use a new method? patch the current one?) and the dependencies that can be introduced because of it. With this in mind, he continues and talks about how the "dynamic dispatch" happens during the code execution, splitting the log request based on the information it's given instead of different implementations for each. He points out that using a trait doesn't allow for this abstraction and instead embeds the code into the class itself, re-introducing the original problem.

0 comments voice your opinion now!
dynamic dispatch oop concept example logger trait compare

Link: http://qafoo.com/blog/072_utilize_dynamic_dispatch.html

Adrian Schneider's Blog:
Zend Framework Models - Part 1 Concepts
February 22, 2010 @ 11:24:02

Adrian Schneider has started up a new series of posts on his blog today with part of of his look at models in the Zend Framework.

The power in Zend Framework lies in its uncompromising flexibility. However, evidently, this also means its very difficult for new ZF users to pick up the framework and hit the ground running. The most common question I see is usually "where is the model?". The goal of this post is to show some examples and hopefully some new ideas on how to tackle models. There is no one-size-fits-all solution folks. Let's look at some options and some background...

He starts off with the concept behind models, explaining how they're just a place to get your data from whether it be in a database or other resource. Processing that happens to your application's data belongs in a model. He illustrates a database model that uses the Zend_Db_Table component to connect to a backend database. There's only a bit of introductory code in this first post, so expect that to come in the parts to follow.

0 comments voice your opinion now!
zendframework model concept tutorial


DevX.com:
Base Concepts of Internationalization in PHP
August 13, 2008 @ 09:37:12

The DevX website has recently posted this tutorial - a look at simple internationalization for your website.

If you develop Web applications that have an international target audience, then you have to take internationalization into account'"a process that includes avoiding date/time or currency confusions and delivering all text pertinent to the user interface in the user's preferred language. Applications that can grow international traffic and improve revenue must respect their clients' needs.

They use the I18N PEAR package to handle most of the hard work and include the howto on grabbing the package, the structure and how to use it to get a country name from a code, work with the translation of numbers, currency and changing up date/time strings.

0 comments voice your opinion now!
i18n internationalization tutorial concept currency datetime countrycode


Debuggable Blog:
Programming Psychology II Private methods
July 08, 2008 @ 08:44:58

According to Felix Geisendorfer's newest post on the Debuggable blog, he thinks that "private and protected methods and properties are one of the most stupid concepts of OOP."

This is a thought I first shared at CakeFest Orlando this year, but could not explain properly at the time.

He illustrates with an example of a protected "balance" variable in a BankAccount class. Sure, it's marked as private but less skilled programmers might not use it that way. He recommends a method without the getters/setters to help make the usage of the variable a bit simpler. He also suggests that using protected/private scoping helps to promote "crappy code" - using them to provide a sort of protection for code that you either don't want getting used or hiding it away so the API can't get at it.

1 comment voice your opinion now!
private method protected bad concept stupid getter setter


Foobr.co.uk:
Focus Cloud [concept]
June 27, 2007 @ 11:12:00

Jonathan Snook points out a new take on working with tags on a site - a focus cloud.

With this fairly broad classification I set about working out exactly what a Focus Cloud should show. To me the name could only suggest one thing. It shows the area which currently is receiving the most Focus! [...] So a Focus Cloud should show not what has been the most popular tags overall, but what is the most popular tags at present. What is your current focus.

The post not only includes the theory behind these focus clouds but also has some PHP code to back it up (using the del.icio.us interface and tags as the foundation of the cloud's contents). The full code for the cloud can be grabbed here.

0 comments voice your opinion now!
focus cloud concept tag delicious focus cloud concept tag delicious


YoungCoders.com:
The PHP Construct You've Never Used
September 19, 2006 @ 07:38:14

As pointed out by the Zend Developer Zone today, there's a useful forum post over on the YoungCoders.com website that talks about very useful feature that some PHP developers just don't use - ticks.

You've probably never used it, never saw it, or never found a practical use for ticks, a underused and powerful feature of PHP that allows you to implement exceptions in PHP4, do intensive debugging and profiling, check database connections, turn PHP into an event driven language, or harness complex control over your code.

The post talks about what ticks are, how to enable them, and a few examples of how to use them. Check out more about them in this page on the PHP Manual.

0 comments voice your opinion now!
ticks construct tutorial concept example declare ticks construct tutorial concept example declare



Community Events





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


series framework community api symfony release interview introduction deployment install opinion laravel zendserver podcast library package list language tips update

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