Code analogy

In a Skype conversation with me and a few colleagues today, my colleague Ivo Jansch explained to us the difference between meta() and postMeta() in the atkMetaNode. He used for this the analogy of pregnancy. The analogy was too good to leave for the few that attended the skype chat, so I am publishing it here - with permission of Ivo - for everyone's education. ;)

anything you want to change can be done in postMeta
only rarely you need to manually add stuff in the meta function
the policy is named policy because it enforces a standard on how to map database stuff to the application
in the meta function, this policy can be influenced
compare it to pregnancy
meta() is what happens inside the female
based on dna, policies, whatever food she happens to be eating etc, the baby is constructed
once it's born, you give it clothing etc.
sometimes however, you need to do surgery on the pre-born
if you wait until postmeta, it is either too late, or inefficient
which is why some stuff is done in meta()
e.g. if the womb is constructing a boy but you want a girl, you could let it be born first and then do a gender change
but that's a lot of overhead
so for performance reasons, you might change the gender before the utensils are appended to the unborn
(which is basically what things like $policy->setTypeAndParams do
(to make it a little more complete, even metanodes have a constructor, but that would then be comparable to conception, and you don't want to fiddle with stuff there yet)
also published on the ATK wiki .
Add comment

Comments

gravatar Klemen Slavič: Nice. ;)
July 21, 2008
gravatar Paul M: Yeah. It's good :)
July 23, 2008

Php5_zce_logo

not tested in IE


Upcoming events

I will be speaking 04-09-2009: Symfony Day 2009

Tags

1337 2008 4developers accessibility AdaLovelaceDay09 agavi agile amsterdam apache apple article articles atk atkMetaNode audioscrobbler backwards compatibility bbc beatstad best practices bittorrent book books bughuntday caching cake cal evans cat cerf certificate cfp clear cms community conference conferences continuous integration crisis css custom DbFinderPlugin decorator decorators deployment devdays development directoryindex documentation download dpc dpc09 DPC2008 dreamhost eclipse ed efficiency enterprise event events expertise flickr frameworks freeze frontend fun games germany getting real google googletalk graceful degradation hack hackers howto html http ibuildings icann ide imovie indy internet IPC ipc ipc08 javascript jobeet john peel joomla left on the web lime linux live london loudblog m2ts mac malware mambo marjolein meme meta methodology microsoft movie music mysql namespace namespaces nllgg odmarco open source ORM osx paradiso pear personal pfcongrez photo php phpabstract phpBB phpbb phpbelgium phpbenelux phpgg phpitalia phpnw phpnw08 phptek phptek09 phpuk2009 phpUnderControl phpunit php|architect php|tek podcast politics portability postcrossing presentation presentations public qa recruiting refactoring review rewrite ruby on rails schedule script security seven things simplexml slides software sogeti solar standard standards static steer subversion symfony symfonycamp symfonyUnderControlPlugin talk technology techportal tek09 terratec terrorism testfest testing textpattern tips tld tomas usability usergroup vhost video vinyl virus warp weblogging wiki women world world of warcraft writing xml xpath yara year youtube ZCE zemanta zend zend framework zend server zend studio Zend_Form
© 2004 - 2009 Stefan Koopmanschap + Powered by Symfony, photos powered by Flickr, links powered by Delicious, Shanghai smilies by Iconbuffet. Feeds: rss / atom. Left on the Web v4.4.0