<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: A modular design for a webpage</title>
	<link>http://ask.metafilter.com/65786/A-modular-design-for-a-webpage/</link>
	<description>Comments on Ask MetaFilter post A modular design for a webpage</description>
	<pubDate>Thu, 28 Jun 2007 03:58:11 -0800</pubDate>
	<lastBuildDate>Thu, 28 Jun 2007 03:58:11 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: A modular design for a webpage</title>
		<link>http://ask.metafilter.com/65786/A-modular-design-for-a-webpage</link>	
		<description>What&apos;s the best way of designing a modular webpage that is intended to be used by plugins? &lt;br /&gt;&lt;br /&gt; I want to design a simple page which calls different plugins one after the other to display data. For example, I&apos;m designing a general knowledge Exam.  The exam framework is what I want to design. The actual questions are the plugins, and they can be designed independently of the framework, and then plugged in.&lt;br&gt;
&lt;br&gt;
What would be a good design pattern to go about this?&lt;br&gt;
&lt;br&gt;
How do I deal with the issue of access to the database by the plugins without breaking the independence of the plugins? How do I design a mode where I know which plugin wants to be displayed when?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.65786</guid>
		<pubDate>Thu, 28 Jun 2007 03:39:52 -0800</pubDate>
		<dc:creator>markovich</dc:creator>
		
			<category>programming</category>
		
	</item> <item>
		<title>By: Leon</title>
		<link>http://ask.metafilter.com/65786/A-modular-design-for-a-webpage#988500</link>	
		<description>I don&apos;t know what the design pattern would be, bit you basically need to do discovery of what plugins are available to you, and have each plugin expose a standard interface.&lt;br&gt;
&lt;br&gt;
Your core application iterates over the plugins, setting/getting data in them via this standard interface.&lt;br&gt;
&lt;br&gt;
PHP-leaning example:&lt;br&gt;
&lt;br&gt;
Plugins are stored in /plugins&lt;br&gt;
&lt;br&gt;
Each plugin must be named PluginName.php&lt;br&gt;
&lt;br&gt;
Each plugin must contain a class PluginName&lt;br&gt;
&lt;br&gt;
The constructor of each class must be in the form PluginName ($dbconn) (passing the DB connection into the class)&lt;br&gt;
&lt;br&gt;
Each plugin must expose a public method iWantToTalk() which returns true when the plugin is ready to spit out data&lt;br&gt;
&lt;br&gt;
I&apos;m sure you get the idea. Create an abstract class for each plugin to inherit, so it&apos;s fulfilling some kind of contract. Iterate over /plugins to get a list of filenames, require() each filename in turn and instantiate its class.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65786-988500</guid>
		<pubDate>Thu, 28 Jun 2007 03:58:11 -0800</pubDate>
		<dc:creator>Leon</dc:creator>
	</item><item>
		<title>By: miniape</title>
		<link>http://ask.metafilter.com/65786/A-modular-design-for-a-webpage#988530</link>	
		<description>You should look into &lt;a href=&quot;http://djangoproject.com&quot;&gt;Django&lt;/a&gt;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65786-988530</guid>
		<pubDate>Thu, 28 Jun 2007 05:17:22 -0800</pubDate>
		<dc:creator>miniape</dc:creator>
	</item><item>
		<title>By: tmcw</title>
		<link>http://ask.metafilter.com/65786/A-modular-design-for-a-webpage#990107</link>	
		<description>The real answer to this is to put the &quot;plugins&quot; (questions) in the database. There isn&apos;t any need for them to be hardcoded and modular.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65786-990107</guid>
		<pubDate>Fri, 29 Jun 2007 10:43:18 -0800</pubDate>
		<dc:creator>tmcw</dc:creator>
	</item>
	</channel>
</rss>
