<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1043099" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1043099</link>
    <description></description>
    <language>en</language>
          <item>
    <title>It depends on what I&#039;m</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/config-array#comment-1238600</link>
    <description> &lt;p&gt;It depends on what I&#039;m doing, but UltraEdit Studio, Visual Studio, Eclipse, and Dreamweaver. All of them have some form of intellitips.&lt;/p&gt;
 </description>
     <pubDate>Sun, 22 Feb 2009 00:15:36 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1238600 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>CakePHP also uses the array</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/config-array#comment-1238575</link>
    <description> &lt;p&gt;CakePHP also uses the array style.&lt;/p&gt;
&lt;p&gt;In my opinion, you&#039;re choosing between a rock and a hard place.  On the basis of flexibility, I&#039;d go with the former.  If your entities are small, well-specified and not likely to change, then I&#039;d go with the latter.&lt;/p&gt;
&lt;p&gt;Semantically, the array style is better because you&#039;re essentially creating and passing a hash table of properties.  That&#039;s usually a good thing to do for at least three reasons.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Naming values with keys, and grouping properties together adds to readability and clarity.  In your latter User() call, it&#039;s not at all obvious which of the second and third arguments are the first or last names.&lt;/li&gt;
&lt;li&gt;The contents of the table can be handled specially by the receiver -- i.e. optional or variadic values, precedence, validation, etc.  You can set default values with an array_merge() idiom; easily iterate over variadic arguments, and so on.&lt;/li&gt;
&lt;li&gt;Grouped properties can easily be passed down the call chain using the same protocol, rather than retyping each value.  For example, your User constructor might call some other function foo() with the passed properties as input.  You could call foo($config), or you could call foo($username, $first_name, $last_name).  If you have a deep call chain or big property lists (like most frameworks do), you don&#039;t want to express your properties in every call.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Basically, you get a great deal more flexibility using arrays.  Especially over time, when your architecture changes.  Imagine you have a deep chain of calls as in the third point above, whose calling convention you want to update, say by inserting a new property.  It would take plenty more refactoring to fix every call, than to simply update the hash table.&lt;/p&gt;
&lt;p&gt;That said, neither approach is pretty, compared to other languages.  Common Lisp, for instance, provides a number of &lt;a href=&quot;http://abhishek.geek.nz/docs/features-of-common-lisp#Lambda_lists&quot;&gt;argument-handling facilities&lt;/a&gt; to accept named (keyword) arguments, variadic (rest/whole) arguments, destructuring arguments, macros to manipulate them, and plenty more.  Many of those features are also &lt;a href=&quot;http://blog.thinkrelevance.com/2008/9/16/pcl-clojure-chapter-5&quot;&gt;in Clojure&lt;/a&gt;, with even more powerful destructuring, and a nice &lt;a href=&quot;http://clojure.org/data_structures#toc17&quot;&gt;hash table syntax&lt;/a&gt;.  Fragments of those can be found in &lt;a href=&quot;http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls#Default_Values&quot;&gt;Ruby&lt;/a&gt; or &lt;a href=&quot;http://docs.python.org/tutorial/controlflow.html#more-on-defining-functions&quot;&gt;Python&lt;/a&gt;, if you prefer.&lt;/p&gt;
&lt;p&gt;Good luck.&lt;/p&gt;
 </description>
     <pubDate>Sat, 21 Feb 2009 10:02:00 +0000</pubDate>
 <dc:creator>Abhishek Reddy</dc:creator>
 <guid isPermaLink="false">comment 1238575 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>But a good IDE would remind</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/config-array#comment-1238563</link>
    <description> &lt;blockquote&gt;&lt;p&gt;But a good IDE would remind you with intellitips.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What IDE do you use?  I just use a config array most of the time, unless there are roughly 4 or less parameters.&lt;/p&gt;
 </description>
     <pubDate>Sat, 21 Feb 2009 05:47:19 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1238563 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Do you like those ways of</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/config-array#comment-1238559</link>
    <description> &lt;p&gt;Do you like those ways of passing parameters? What&#039;s the main advantage to that?&lt;/p&gt;
&lt;p&gt;I can see a few disadvantages to the array/query string passing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You must know the exact name of the key&lt;/li&gt;
&lt;li&gt;Intellitips don&#039;t work (they are those little hints that appear when you start typing the parameters to a function)&lt;/li&gt;
&lt;li&gt;It just looks messy and there is a lot more typing&lt;/li&gt;
&lt;p&gt;The only advantage I can think of is that you don&#039;t have to remember the order of the parameters. But a good IDE would remind you with intellitips.&lt;/p&gt;
 &lt;/ul&gt;</description>
     <pubDate>Sat, 21 Feb 2009 03:04:58 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1238559 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>That&#039;s how Codeigniter loads</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/config-array#comment-1238505</link>
    <description> &lt;p&gt;That&#039;s how &lt;a href=&quot;http://codeigniter.com/user_guide/libraries/pagination.html&quot;&gt;Codeigniter&lt;/a&gt; loads config settings for a class.&lt;/p&gt;
&lt;p&gt;Wordpress takes parameters in a format like this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$user = new User(&amp;#039;username=whatever&amp;amp;first_name=john&amp;amp;last_name=Doe&amp;#039;);&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 20 Feb 2009 05:05:21 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1238505 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
