News Feed
Sections

News Archive
feed this:

Bill Karwin's Blog:
ActiveRecord does not suck
May 29, 2008 @ 17:07:50

Bill Karwin (formerly of Zend and the Zend Framework project) has a new post to his blog defending one of the more abused (both in code and in opinions) design patterns, ActiveRecord:

ActiveRecord is fine. It is a tool that does just what it's designed to do. What sucks is when developers try to make it do other things than what it's intended to do.

He cites his work with the Zend_Db component and how Mike Seth gets it right when he says that the pattern shouldn't be "ActiveRecord-View-Controller". He compares the ideas of a true Model in an MVC application with the incorrect ideas that many developers seem to hold.

A Model is a class that provides a logical component of your application domain. Models are products of OO design, which is a development activity I see get very little attention in the developer blogosphere or the developer tools market.

Models can reference one or many (or no) database tables and are not where the hard work is being done. That's saved for the ORM (or ActiveRecord) to do.

0 comments voice your opinion now!
activerecord designpattern modelviewcontroller mvc model orm



Gergely Hodicska's Blog:
What is new in PHP 5.3 - part 2 late static binding
November 15, 2007 @ 07:57:00

Gergely Hodicska has posted part two of his look at the upcoming PHP 5.3 release. In his previous post, he looked at namespacing, but in this new one he covers late static binding (mor einfo here).

In the second part we will deal with static late binding, which is a very exciting new feature in PHP 5.3 and which promise some really nifty code. :) This topic attracted attention after Zend Framework. There was a little outcry in the PHP blogosphere, that the ActiveRecord examples presented in this webcast can't work in PHP even with the version 5.2. Now with late static binding it is possible to implement this style of ActiveRecord almost correctly.

His post is an example of implementing the ActiveRecord (sort of) pattern, complete with code examples.

0 comments voice your opinion now!
php5 latestaticbinding activerecord implement php5 latestaticbinding activerecord implement


ActsAsFlinn Blog:
PHP and ActiveRecord (continued)
August 13, 2007 @ 15:35:00

In a response to a response (from Arnold Daniels) on his article on the ActiveRecord pattern in PHP, Flinn Mueller has come back once again with more comments, both in response and to share some more opinion on the matter.

Today I saw a big traffic increase from my PHP and ActiveRecord post. It looks like PHPDeveloper posted a link to the article and response, so I've written a response to the Arnold's wor(l)ds response post. Arnold's post is insightful, references runkit and has a good implementation of a Sortable tasklist example in PHP.

Flinn breaks it out into a few different topics - things like:

  • Ruby objects are (native) Ruby objects
  • a brief look at "lineage" for both PHP and Ruby
  • The usefulness of Ruby mix-ins
  • Issues with static inheritance in PHP
  • and some of his suggestions on what PHP6 really needs

1 comment voice your opinion now!
activerecord ruby object lineage mixin php6 activerecord ruby object lineage mixin php6


Arnold Daniels' Blog:
PHP != Ruby (and why PHP needs more advanced OO stuff)
August 10, 2007 @ 10:22:00

In response to this post on the ActsAsFlinn blog's comments on ActiveRecord in PHP, Arnold Daniels has some comments of his own on the subject - specifically about the need for more work on the object oriented side of things in PHP natively.

Today I read an article about how Active Record is implemented in Ruby. In this article he lays down how things are done in Ruby and how that is not possible on PHP. Though I agree with him on a large part, there are a few site notes to make here.

Arnold talks about a solution to an issue mentioned in the ActsAsFlinn blog - the addition of methods to a preexisting class - via the runkit extension. He gives a PHP translation of the Ruby code from the other post and includes a few proof of concepts to show it in action. You can download the code if you'd like to try it out yourself.

0 comments voice your opinion now!
ruby oop advanced runkit method activerecord ruby oop advanced runkit method activerecord


ActsAsFlinn Blog:
PHP and ActiveRecord
August 09, 2007 @ 10:12:00

On the ActsAsFlinn blog, a new article's been posted talking about ActiveRecord and some of the problems with implementing it in PHP.

I'm starting a new job soon and I'll be working primarily with PHP. Since I've been a rubyist for the last 2 years I'm looking at PHP from a Rails development perspective. Before working exclusively with Ruby I hung onto to PHP (because of the project I was working on) by porting Rails bits to PHP. I eventually gave up on porting Rails to PHP after my project's funding was cut.

His experience found that there were a few things that caused the problem in the transition between Ruby and PHP like "in Ruby everything is an object" and some Reflection differences between the two languages. He has a little sample object he's created the code for, but it still doesn't work quite right.

In the end, he points out that the Row Data Gateway is a much easier method to get working in PHP (complete with sample code).

2 comments voice your opinion now!
activerecord designpattern ruby port database activerecord designpattern ruby port database


Hasin Hayder's Blog:
Using ActiveRecord Library Separately from CodeIgniter
June 13, 2007 @ 11:53:13

On his blog today, Hasin Hayder has a quick tutorial on using one of the features of the CodeIgniter framework outside of it - the ActiveRecord library.

CodeIgniters ActiveRecord library is a nice implementation (though modified) of ActiveRecord design pattern. It comes bundled with CodeIgniter. So if you want to use Just this library in your application individually instead of using full CodeIgniter framework, what to do?

His solution uses an abstraction layer (ActiveRecordFactory) to handle any issues with interfacing to CodeIgniter's class. He's also included the code (and a download

0 comments voice your opinion now!
codeigniter activerecord library factory designpattern codeigniter activerecord library factory designpattern


Chris Shiflett's Blog:
CakePHP Visits New York
September 27, 2006 @ 16:09:54

In his latest blog post, Chris Shiflett talks about CakePHP "visiting" New York at this month's NYPHP meeting as well of some of his impressions on the framework.

Last night at the monthly NYPHP meeting, Nate Abele presented an introduction to CakePHP, a web application framework. The New York subway wasn't cooperating with my schedule, and due to a problem affecting all uptown 4/5 trains, I was 30 minutes late to the talk.

Here are some of my notes from the talk as well as the conversation we had over dinner and drinks later.

He wonders about if the fact that Cake supports PHP4 hinders it, the scaffolding available, Ajax functionality, and, of course, some of the security features of the framework. He notes that "as long as you stick to the Cake way of generating output, it handles the escaping for you" - definitely a plus.

1 comment voice your opinion now!
cakephp framework php4 support activerecord ajax scaffolding security cakephp framework php4 support activerecord ajax scaffolding security


Markus Wolff's Blog:
ActiveRecord enhancements
September 11, 2006 @ 08:16:27

Markus Wolff finally got the time to work on a project he's developed but hasn't had the time to enhance - CWAC_ActiveRecord.

After two weeks I finally managed to find a bit of time to continue working on CWAC_ActiveRecord. Requested by my friend Arnaud was the setConnection() method, that allows to reuse existing PDO objects with CWAC_ActiveRecord. Before this, you could only pass a DSN with the config array and a new connection would always be created.

He also added limit() and orderby() methods to help narrow down your queries.

0 comments voice your opinion now!
activerecord ehancements cwac project setconnection limit orderby pdo activerecord ehancements cwac project setconnection limit orderby pdo


PHPEveryhwere:
ADOdb Implementation of Active Record - cloning Zend_Db_DataObject
May 08, 2006 @ 05:49:16

John Lim has posted an example of using the ADOdb software he's a developer on to clone the functionality of Zend's Zend_Db_DataObject.

The Zend Framework Preview edition is out. I had look this morning at Zend_Db_DataObject, which is an implementation of the Active Record pattern. After reading the tutorial, decided to implement something similar for ADOdb. After a couple of hours coding, I had an implementation that works with both PHP4 and PHP5, and provides a superset of the functionality described in the above link.

ActiveRecord, a method of database usage where the tables can "self-define" in your script (and you work with objects instead of messing with columns) is cropping up more and more, and John gives a code example of how it can be used inside ADOdb as well. He also mentions some of the advantages to using this kind of code/library, including the fact that it will work with both PHP4 and PHP5.

0 comments voice your opinion now!
php adodb framework activerecord zend_db_dataobject cloning php adodb framework activerecord zend_db_dataobject cloning


Matthijs Tempels' Blog:
ActiveRecord Bugfix and Hooktable Support
January 24, 2006 @ 15:00:51

Matthijs Tempels wrote in to tell us about an update that's been made to the ActiveRecord functionality that he's been working on.

Hello boys and girls :)

Again, a small fix in ActiveRecord on HookTable Support.

He sets up some classes, creating items with a second parameter - the hooktable name for the item. Each item has a corresponding class, and, with the help of some sample code and database query results, you can see how the data is connected.

The updated source code can be found here...

0 comments voice your opinion now!
php activerecord bugfix hooktable support php activerecord bugfix hooktable support



Community Events











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


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

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