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 08-10-2010: Symfony Day Cologne 2010
I will be speaking 09-10-2010: Symfony workshop

Tags

1337 2008 2010 4developers access modifiers accessibility AdaLovelaceDay09 advent agavi agile amsterdam apache apple article articles atk atkMetaNode audioscrobbler azure backwards compatibility barcelona bbc bbq beatstad belgium best practices bittorrent boards of canada book books bughuntday caching cake cal evans career cat cerf certificate cfp clear cms cologne common sense communities community conference conferences continuous integration contribute crisis css custom datetime DbFinderPlugin decorator decorators deployment devdays development directoryindex documentation download dpc dpc09 dpc10 DPC2008 dreamhost dv7 eclipse ed efficiency enterprise errors event events expertise ezcomponents facebook flickr framework frameworks freelance freeze frontend fun games germany getting real google googletalk graceful degradation hack hackers hidden gem hiphop howto hp html http ibuildings icann ide idm imovie indy ingewikkeld internet IPC ipc ipc08 javascript job jobeet john peel joomla kubuntu left on the web lighttpd lime linux live london loudblog m2ts mac malware mambo marjolein mediterra meeting meme meta methodology microsoft movie music mysql namespace namespaces netbeans netherlands nllgg odmarco open source opinion ORM osx paradiso pavilion pear performance personal pfc10 pfcongres pfcongrez photo php phpabstract phpazure phpBB phpbb phpbelgium phpbenelux phpbnl10 phpgg phpitalia phpnw phpnw08 phptek phptek09 phpuk2009 phpUnderControl phpunit php|architect php|tek podcast politics portability postcrossing presentation presentations private projects protected public qa recruiting refactoring review rewrite ruby on rails schedule scifi script security seven things sfdaycgn simplexml slides smfony software sogeti solar sound standard standards star trek static steer strings subversion symfony Symfony2 symfonycamp symfonyday symfonyUnderControlPlugin talk talks technology techportal tek09 telecommuting terratec terrorism testfest testing textpattern tips tld tomas training twig uncon unet usability usergroup validation vhost video vinyl virus warp weblogging wiki windows winphp women work workshop world world of warcraft wpi writing xml xpath xsd yara year youtube ZCE zemanta zend zend framework zend server zend studio Zend_Form
© 2004 - 2010 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.1