 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Devis Lucato's Blog: Anonymous objects in PHP - Composition, Mocks, Refactoring
by Chris Cornutt November 23, 2010 @ 13:17:53
In a new post to his blog Devis Lucato points out something he noticed when working with objects and anonymous functions/closures - they're not all as they seem.
Both solutions allow to instantiate an anonymous object with properties. They are used as value objects and have no other purpose than storing values, so no logic can be included and they don't come with methods. They can be used as function parameters instead of arrays, for instance. PHP 5.3.0 introduced anonymous functions and closures, so it is now possible to attach functions to these VOs (*). [...] The first thing to notice is that these properties are not methods but callable functions:
In his example, an anonymous function dynamically appended to an object doesn't have access to a property set on the object just one line before. There's a way around it with call_user_func, but it's not practical. His proposed solution is to create a type of Anonymous class that uses the __call method to catch the methods and translate them into calls to call_user_func_array automatically.
voice your opinion now!
anonymous objects composition mocking refactoring
Zend Developer Zone: Book Review Learning PHP Data Objects
by Chris Cornutt December 28, 2007 @ 07:58:00
The Zend Developer Zone has posted a review of Packt Publishing's "Learning PHP Data Objects" book writen up by Akash Mehta.
In Learning PHP Data Objects, the author Dennis Popel examines this new [database access] system and explains how to begin using PDO in development as a replacement for typical database drivers. The book is an excellent introduction to the data abstraction layer and also provides essential insight into the inner workings of database interaction with PHP.
Akash talks briefly about the history of PDO and what it can be used for first, then gets into the contents of the book (things like the intro chapters and the quality of the writing). The thing he thinks makes the bok stand out, though, is the examples and sample code that reflect both simple methods and more complex issues PDO developers might run into.
voice your opinion now!
book review learning data objects pdo dennispopel packt book review learning data objects pdo dennispopel packt
Jacob Santos' Blog: Why SDO Doesn't Take Off
by Chris Cornutt August 24, 2006 @ 08:47:09
In his latest, Jacob Santos asks the question more and more people are wanting to know - why hasn't SDO really taken off?
Developers will eventually start using it, it will take some time to go from the PHP way to SDO way. It would be easier to jump into SDO once better, more easily interpreted and simple to understand tutorials, code samples, and support is available. IBM tutorials are a little bit technical, with words and complex pictures (UML). Just give me code and explain how it works and let me run with the SDO scissors in my hand.
He talks about the contributions that both Zend and IBM have made to the effort and the lack of features (well, the duplication of current PHP features - XML and database functionality). He has a positive outlook for the overall future of the project, stating that:
I'm quite sure that enough PHP developers are going to embrace SDO in the coming years depending on the coverage it gets that IBM and Zend's investment will pay off in the end.
voice your opinion now!
sdo service data objects xml database support future positive sdo service data objects xml database support future positive
Wez Furlong's Blog: SDO, SOA, TLA?
by Chris Cornutt August 15, 2006 @ 07:24:40
Wez Furlong asks today for any kind of feedback he can get from readers about the Service Data Objects functionality in PHP, specifically questions you might have about them.
One of the things that was apparent was that this SDO stuff has quite a high barrier to entry--too many three letter acronyms for starters, and its origins in the C++ and Java world don't help make it very accessible to the typical PHP developer.
Wez references two articles over on the Zend Developer Zone as great places to get started. He also mentions giving some feedback to the IBM folks about the SDO extension:
If you've wondered what this SDO stuff is all about, please read through those articles. After having done that, if theres something you're not clear on, or if everything is clear, or if you have some other thoughts on the matter, then please take a moment to send your feedback to Graham Charters (you'll find his email address on the top of the articles).
voice your opinion now!
service data objects article ibm extension feedback question service data objects article ibm extension feedback question
Zend Developer Zone: Streamline Working with XML in PHP Using Service Data Objects (Part 1 & 2)
by Chris Cornutt August 09, 2006 @ 07:34:48
The Zend Developer Zone has posted both Part 1 and Part 2 of a series from IBM today, a look at using XML in PHP with the help of the Service Data Objects.
Looking at SDOs and their associated interface, you should get a clear idea of the API the SDO extension provides. We then move on to show a working example of using SDOs in a two-part application comprising a small PHP application to implement a simple Web log (blog) and a part that displays that blog as an RSS feed. Both parts use SDOs as a way of working with XML. We hope you will agree that SDO is an attractive option for working with XML data in PHP.
In part one, they get down to basics and introduce what the service data objects are, how they work, what they look like, and what kind of options they offer. Near the end, they start talking some about the XML structure in preparation for the next part.
Part two picks up right where the previous part left off, taking the basic knowledge and building on it, showing how to create an SDO, and add the namespaces needed. From there, for the sake of time, they give a simple blogging application for download to illustrate how the pieces fit together. They break apart the pieces, showing what each part does and demonstrate how to add entries to the blogging application.
voice your opinion now!
service data objects part1 part2 working xml service data objects part1 part2 working xml
|
Community Events
Don't see your event here? Let us know!
|