<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pervasive Code &#187; php</title>
	<atom:link href="http://www.pervasivecode.com/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pervasivecode.com/blog</link>
	<description>Jamie Flournoy's Software Development Blog</description>
	<lastBuildDate>Wed, 01 Feb 2012 06:11:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Why mod_rails is great for light-duty Rails apps</title>
		<link>http://www.pervasivecode.com/blog/2008/04/14/why-mod_rails-is-a-really-good-thing-for-light-duty-ruby-on-rails/</link>
		<comments>http://www.pervasivecode.com/blog/2008/04/14/why-mod_rails-is-a-really-good-thing-for-light-duty-ruby-on-rails/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 20:30:25 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2008/04/14/why-mod_rails-is-a-really-good-thing-for-light-duty-ruby-on-rails/</guid>
		<description><![CDATA[The Ruby on Rails story is usually presented to the new developer as a wonderful break from tradition that makes a developer&#8217;s life so much better than the frameworks of the past. The clattering of skeletons in the closet you&#8217;re hearing? Well, that&#8217;s because it makes the sysadmin&#8217;s life much worse than PHP or Java. [...]]]></description>
			<content:encoded><![CDATA[<p>The Ruby on Rails story is usually presented to the new developer as a wonderful break from tradition that makes a developer&#8217;s life so much better than the frameworks of the past. The clattering of skeletons in the closet you&#8217;re hearing? Well, that&#8217;s because it makes the sysadmin&#8217;s life much worse than PHP or Java. That just improved on Friday, with the release of mod_rails. If you&#8217;re looking for a way to do shared (or low traffic) hosting of Rails applications, this is for you.<br />
<span id="more-67"></span><br />
With Java there&#8217;s this alien environment of CLASSPATHs and WARs and JARs and heap size limits, but once you get it up and running, developers can include libraries in with their application or the lib/ directory of the J2EE server, and the sysadmin doesn&#8217;t have to care. A Java developer is unlikely to ask you to build and install a pile of custom libraries.</p>
<p>With PHP it&#8217;s just another Apache module, but you might need to build a few extra libraries and maybe custom-compile Apache. Once you get it up and running, though, you don&#8217;t even need to restart the server when you deploy new code. It&#8217;s automatically updated.</p>
<p>With Ruby on Rails, it has been far uglier, especially as you go further back. The standard &#8220;Matz Ruby Interpreter&#8221; (MRI) doesn&#8217;t thread well and is quite remarkably slow, and Ruby + Rails in an MRI process use a lot lot lot of memory. So you don&#8217;t really want RoR running inside each Apache process. Folks used to use FastCGI (which should have died over a decade ago, but lingers on like a bad cold) but now use Mongrel, which is conceptually kind of like FastCGI, except that it actually works. Mongrel presents the application via HTTP, which is much easier to understand and integrate with other parts of your architecture (such as a load balancer) than FastCGI.</p>
<p>Whereas in J2EE you&#8217;d run one big honkin&#8217; JVM that used lots of memory to load up your code and data structures, but then ran many threads inside that one process, with the limitations of the MRI (green threads and many, many trips into non thread safe C code that requires the use of a &#8220;giant lock&#8221; that essentially makes it single-threaded), you run one process per thread. That&#8217;s like Apache+PHP or OpenSSH or many other unix programs that fork, right? Well, sort of. The issue is that your Ruby code is not seen by the kernel as something that all those forked processes can share; it sees the parsed Ruby code as data, and when the MRI&#8217;s garbage collector marks all those objects during garbage collection, it seems this data as being recently changed, differently for each forked process. So not only do you need 30-70MB or more per process, but very little of that is shared between processes. Ouch!</p>
<p>A second problem is that these processes take a while to start up and load the code, so it&#8217;s not reasonable to embed the Ruby interpreter in Apache when using Rails; the overhead is just too high. So the Mongrel solution is to pre-launch a bunch of interpreters, and have them just sit there until requests arrive. That&#8217;s pretty inefficient from a memory standpoint, but the latency when a request comes in is quite low since there is no initialization needed.</p>
<p>There have been a few interesting alternatives under development: JRuby is very promising, because it reuses all of the investment in VM development that Sun made over the last 10+ years for Java. At this point the JVM is pretty darn good at running many threads across multiple CPU cores, and at garbage collecting efficiently, among other things. These are key weaknesses of MRI, so running Rails on JRuby seems like a huge benefit. I haven&#8217;t tried it yet but I suspect that this will become one of the 2 or 3 most common ways to run Rails applications in the near future.</p>
<p>Another interesting alternative was <a href="http://izumi.plan99.net/blog/index.php/2007/07/29/making-ruby%E2%80%99s-garbage-collector-copy-on-write-friendly-part-3/">some experimental hacking to MRI&#8217;s garbage collector by Hongli Lai</a>, to store its working data separately from the objects being examined, so that preloaded Ruby code would remain shared by many forked interpreter processes over long periods of time. In other words, this is a potentially major memory use savings for Mongrel cluster users, which would in turn allow the sysadmin to run more Mongrels to service more simultaneous requests, or to bump up the database cache, or to increase the size of the running memcached instance. So, this would indirectly be a performance booster, and Ruby could really use that.</p>
<p>This experimentation apparently became <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>, which as of this writing is not available yet. But the other development coming from Hongli Lai&#8217;s new company, <a href="http://www.phusion.nl">Phusion</a>, is Passenger, a.k.a. <a href="http://www.modrails.com/">mod_rails</a>.</p>
<p>What&#8217;s interesting about mod_rails for the beginning Rails developer is that it is intended to make Rails hosting easier, particularly for shared hosting enviroments, which have been <a href="http://blog.dreamhost.com/2008/01/07/how-ruby-on-rails-could-be-much-better/">struggling</a> to offer Rails hosting in a uniform and cost-effective fashion. That means that in a short while (weeks?), shared hosting plans for fiddling around with Rails will become much cheaper and more widely available than they are now.</p>
<p>What&#8217;s interesting about mod_rails for the experienced sysadmin is that it mimics the min/max process pooling behavior of Apache, and addresses startup overhead in a clever way. It also serves static images via Apache automatically, eliminating the need for a separate block of mod_rewrite rules that must be crafted carefully so as to avoid conflicts with mod_proxy.</p>
<p>The <a href="http://www.modrails.com/documentation/Architectural%20overview.html">architectural overview</a> is comprehensive and well written, but here&#8217;s a summary: The Spawn Server makes a tree of child processes that preloads Ruby, Rails, and your application code for you, and then that is fork()ed to satisfy incoming requests. So the first request after startup incurs startup overhead (in my case, 5 seconds to load the Redmine login page) but subsequent requests get much better response time (.6s to reload that login page).</p>
<p>That seems like a lot of overhead in terms of big Ruby processes. Here&#8217;s what I measured just now: 97MB free with just Apache running (no spawn server yet). After the first page view, there was 36MB free, and four new processes: the Spawn Server taking a little over 6MB (rsize), the FrameworkSpawner taking 20MB (rsize), the ApplicationSpawner taking 34MB (rsize), and one Rails process taking 34MB (rsize).</p>
<p>The new &#8220;free&#8221; value is 36MB. The Buffers and used Swap values remained constant, with only 48KB of swap used. So that means that all four processes, which would seem to need 94MB to run (34+34+20+6), are actually overlapping enough that they are using only 61MB (97-36). And the ApplicationSpawner eventually terminates, leaving 36MB still free, which makes sense &#8211; it&#8217;s the process that fork()ed the Rails process, so they should ideally be overlapping nearly 100%. I&#8217;m surprised that this is so high; based on the GC experimentation that Hongli Lai did, I would have expected them not to overlap as much.</p>
<p>The idle Rails process exits eventually also, controlled by the <a href="http://www.modrails.com/documentation/Users%20guide.html#_configuring_passenger">RailsPoolIdleTime</a> setting. That saves memory but re-introduces the startup overhead. That leaves the FrameworkSpawner and the SpawnServer running, taking about 25MB of memory (quite close to the 20+6 shown by their rsize values).</p>
<p>Let&#8217;s compare this memory footprint to a Mongrel cluster. In a Mongrel cluster the processes start up and stay running forever, so the users are unlikely to incur much startup overhead at all, since it&#8217;s done long before they visit the application. Some amount of application-specific internal overhead is still an issue, though; that might include gradually filling an initially empty memcached, template compilation and/or caching, etc. As for memory, each Mongrel would need the same 34MB of memory, but there&#8217;s no SpawnServer, FrameworkServer, or ApplicationServer, so the extra 25MB of overhead would not be present with a Mongrel cluster.</p>
<p>That means that for a shared hosting setup where many low-traffic Rails sites may be used, or a multifunction server where serving one or more low-traffic Rails applications is just part of the job, mod_rails is a benefit. When the Rails app isn&#8217;t being used, it will exit and free up that memory for other processes. The starting and stopping of Rails with mod_rails is automatic and demand-based, so the sysadmin can tune it and forget about it.</p>
<p>On the other hand, a single dedicated server or VPS with a fixed amount of memory serving a single application would be better off with Mongrel, because of the lower memory overhead (25MB less), and the fact that the Mongrel processes start up before users need them and stay running indefinitely. Mongrel clusters could still potentially benefit from the Ruby Enterprise Edition&#8217;s garbage collector tweak if forking were used after preloading all of the code.</p>
<p>A single-purpose dedicated server running mod_rails could attain similar performance to a Mongrel cluster by simply setting the RailsPoolIdleTime value to a very high number. Then the Rails processes would hang around, and although you&#8217;d pay the price of a 25MB memory overhead, the startup overhead would only be paid by the very first visitor. However, you&#8217;d lose the main benefit of mod_rails, which is demand-based pool resizing, particularly if you&#8217;re running more than one application, Rails version, or Ruby interpreter version.</p>
<p>In short, I think mod_rails is very nice, and having actually used it I&#8217;m impressed with how polished it is for a 1.0 product. But if you&#8217;re already running a single application as a Mongrel cluster on a dedicated server, there&#8217;s no point in switching.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2008/04/14/why-mod_rails-is-a-really-good-thing-for-light-duty-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Ubuntu Linux 7.10 &#8220;Gutsy Gibbon&#8221; Upgrade Report</title>
		<link>http://www.pervasivecode.com/blog/2007/12/28/ubuntu-linux-710-gutsy-gibbon-upgrade-report/</link>
		<comments>http://www.pervasivecode.com/blog/2007/12/28/ubuntu-linux-710-gutsy-gibbon-upgrade-report/#comments</comments>
		<pubDate>Fri, 28 Dec 2007 19:37:13 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2007/12/28/ubuntu-linux-710-gutsy-gibbon-upgrade-report/</guid>
		<description><![CDATA[A few weeks ago I updated to the latest version of Ubuntu Linux. This is the 7.10 (meaning October 2007) release, called &#8220;Gutsy Gibbon&#8221;. I encountered a couple of serious issues early on, but now that these are resolved things are running well. I&#8217;ll describe the issues and solutions so that anyone else encountering them [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I updated to the latest version of Ubuntu Linux. This is the 7.10 (meaning October 2007) release, called &#8220;Gutsy Gibbon&#8221;. I encountered a couple of serious issues early on, but now that these are resolved things are running well. I&#8217;ll describe the issues and solutions so that anyone else encountering them can easily overcome them.<br />
<span id="more-54"></span></p>
<p>I used the instructions on the <a href="https://help.ubuntu.com/community/GutsyUpgrades?highlight=%28upgrade%29#head-f2435a45758bb5836f8e5b87e90045463f8c6ec7">GutsyUpgrades</a> page of the Ubuntu help wiki, under the heading &#8220;Network upgrade for Ubuntu servers (recommended)&#8221;. This is the command-line way of doing things, which is appropriate for administering a remote server via SSH. There are two steps: install the updater, and run the updater. That&#8217;s pretty slick.</p>
<p>Unfortunately as usual with Debian based releases there are many cases (a dozen or so) where the simple act of updating a package from an old version to a new version causes the installer to plead for human guidance. I find it irritating that if you change the default configuration at all, it cannot simply merge your changes into the new config file and continue. You have to do that manually. This is tedious, but not a really big issue.</p>
<p>In my case I had to manually merge apache2.conf, php.ini, and dovecot.conf because I had made a single line change in each file.</p>
<p>Upon reboot there were vast numbers of error messages, which I ultimately determined to have been caused by <a href="https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/115616">this issue</a>. Removing <code>evms</code> solved the problem, and now there&#8217;s a <a href="https://wiki.ubuntu.com/Evms">special page about <code>evms</code> and why it&#8217;s no longer supported</a>. Based on my reading of that page I suspect that there may be a new version of the Gutsy Gibbon updater that actually helps you by suggesting that you get rid of <code>evms</code> proactively to prevent this problem. Nice! Anyway my fix was simply to wait until the system had booted (slowly, with lots of error messages) and to carefully type in <code>apt-get remove evms</code> which I couldn&#8217;t even see as I typed because of the flood of error messages. Once that was done that problem went away completely.</p>
<p>I had a separate problem which was that the kernel has re-named the devices for my hard disks, which made a couple of my drives appear not to be recognized by the system. I use Linux Software RAID for a single mirrored volume, and for some reason it couldn&#8217;t use the volume UUID to figure out where the drives had gone. After recompiling a custom kernel using <a href="http://ubuntuforums.org/showthread.php?t=311158">these excellent instructions</a> to try and resolve <a href="https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/157909">this issue</a> (which turned out to be a red herring), I found out that I was on the wrong track. (But I also found out that it only takes 56 minutes to compile a kernel on my server, which isn&#8217;t too bad.) I read dmesg extremely carefully and figured out what had happened. Some work with mdadm told the software RAID manager how to find the components of my RAID mirror and all was well with that. My understanding is that since /etc/fstab includes UUIDs now, drives moving around shouldn&#8217;t cause problems like this, so maybe this is a problem specific to the Software RAID system. Other drives moved but were located and mounted properly, with no need for manual intervention.</p>
<p>Finally, I had to update to VMWare Server 1.0.4, which is the first version that supports the kernel included with Gutsy Gibbon (2.6.22-14-server).</p>
<p>Now that all this is behind me I can say that for servers it&#8217;s a decent update; I have no experience with it as a desktop. If you have any doubts you can probably skip this one and wait for the next <a href="https://wiki.ubuntu.com/LTS">LTS</a> release. But if you do plan to upgrade, just make sure to remove <code>evms</code> first and look in the /dev/sd_ range for any hard drives that seem to have disappeared.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2007/12/28/ubuntu-linux-710-gutsy-gibbon-upgrade-report/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Evaluating Future Web Application Technologies</title>
		<link>http://www.pervasivecode.com/blog/2007/11/12/evaluating-future-web-application-technologies/</link>
		<comments>http://www.pervasivecode.com/blog/2007/11/12/evaluating-future-web-application-technologies/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 23:22:30 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[outsourcing]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[strategy]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2007/11/12/evaluating-future-web-application-technologies/</guid>
		<description><![CDATA[Technical Architecture is a Form of Investing. I&#8217;m reminded of this sort of thinking because of recent news from RubyConf 2007.

First, IronRuby joins Ruby.NET in providing a Ruby runtime on .NET. They&#8217;re at different stages of completeness, and building on different .NET runtimes (DLR vs. the regular CLR), but the important point is that Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>Technical Architecture is a Form of Investing. I&#8217;m reminded of this sort of thinking because of recent news from <a href="http://www.rubyconf.org/">RubyConf</a> 2007.<br />
<span id="more-48"></span><br />
First, <a href="http://www.ironruby.net/">IronRuby</a> joins <a href="http://plas.fit.qut.edu.au/Ruby.NET/">Ruby.NET</a> in providing a Ruby runtime on .NET. They&#8217;re at different stages of completeness, and building on different .NET runtimes (<a href="http://blogs.msdn.com/hugunin/archive/2007/04/30/a-dynamic-language-runtime-dlr.aspx">DLR</a> vs. the regular CLR), but the important point is that Microsoft is investing in dynamic languages. Is it ready for production today? Probably not. But keep an eye on Ruby, Python, and JavaScript if you&#8217;re a .NET developer.</p>
<p>Second, <a href="http://docs.codehaus.org/display/JRUBY/2007/11/02/JRuby+1.1b1+Released">JRuby 1.1b1</a> has been released and as expected is considerably faster (see <a href="http://headius.blogspot.com/2007/11/top-five-questions-i-get-asked.html">item #5 in this link</a>) than the standard &#8220;MRI&#8221; runtime. JRuby joins <a href="http://www.jython.org/">Jython</a> and <a href="http://www.mozilla.org/rhino/">Rhino</a> in providing a JVM-based runtime for a dynamic language, with features designed to help developers mix and match the dynamic language code with Java code.</p>
<p>See the trend here? Python, Ruby, and JavaScript are emerging as the dynamic languages of the future for .NET and Java developers.</p>
<p>The hard work done by Sun and Microsoft to make their VMs work well is being leveraged by the next wave of languages. Threads, high performance I/O, memory management, and portability are all features that are quite expensive to get right, and the .NET and Java platforms have pretty much achieved that at this point. (Piggybacking newer, higher-level languages on these mature runtimes means that you get a mature new language runtime faster than if each language&#8217;s runtime were built from scratch and painstakingly debugged in isolation from the others.)</p>
<p>There are still some hurdles (performance, type safety fears, lack of mass market acceptance, ECMAScript 4 standardization and adoption, etc.), but in 2 or 3 years, things are going to change dramatically in the web application development world. The seeds of this change are already sown, and it&#8217;s just a matter of time. Threads, SQL, OOP, and garbage collection are all features of web application architectures that were initially controversial, but have now met with general acceptance. Dynamic languages are clearly the next step.</p>
<p>Obviously, Java and C# are far from dead, and in 10 years people will still be coding in Java and C#, because as with other languages like C and assembly, the newest and highest-level language isn&#8217;t automatically right for every project. But if you&#8217;re building web applications, most of what your code does falls into the categories of string manipulation, collection operations, or file and socket I/O. Image processing, crypto, full text search, and other CPU-heavy, byte-twiddling features may be part of your application, but you&#8217;re not writing the image scaler, RC4 cipher, or inverted index yourself; those are done in a library, probably written in C, and you&#8217;re just calling it. So your needs are likely to be similar to the sweet spot of dynamic languages: maximum expressivity and the fancy features to let you write clever code, making you productive and making the code as clean and elegant as possible. In other words, they put developer productivity first (lower labor cost and shorter development schedules) at the expense of runtime performance. Since hardware gets cheaper over time but <a href="http://www.laputan.org/mud/mud.html#Forces">code gets uglier over time</a>, this is probably the right choice to make for most web application projects.</p>
<p>Another interesting benefit of layering instead of starting over is that the integration between dynamic languages and Java or CLR languages is much nicer than managed vs. unmanaged code in .NET or, even worse, JNI in Java. That is, it won&#8217;t be a bloody mess to mix and match code, from a technical feasibility standpoint. This matters, because <a href="http://chadfowler.com/2006/12/27/the-big-rewrite">The Big Rewrite</a> is among the <a href="http://www.joelonsoftware.com/articles/fog0000000069.html">Things You Should Never Do</a>. But little bitty rewrites are fine, especially if you have a thorough test suite to help you avoid breaking things. (By the way, dynamic languages are <i>great</i> for writing automated tests.)</p>
<p>Which of these three (JavaScript, Python, or Ruby) is going to be dominant 5 years from now? I don&#8217;t think any of them will be. The dynamic language community is fragmented, and the various vendors and big sponsors of these three languages are fairly entrenched already. Microsoft is investing in all three; Google has standardized on Python and JavaScript to the exclusion of Ruby; Sun has hired the JRuby team; Mozilla is heavily invested in JavaScript; Adobe supports JavaScript in AIR but not Ruby or Python, etc. </p>
<p>In fact, if you encapsulated the glue code sufficiently well, you could mix and match JavaScript, Python, and Ruby in your application, and port your hideous hydra between the JVM and .NET. You would be wasting a lot of effort since the three languages are largely similar, but you could do it. Alternatively, you could create a portability layer between the DLR and the JVM a la WxWindows, and write-once-debug-everywhere in a more productive language than Java.</p>
<p>These are all repugnant ideas, but only because as I write this and as you read this, we probably realize that to attempt this today would be a huge task. But what about in 2010? Probably not so gross. What about an application that could be executed on Silverlight, AIR, Firefox, SWT, and Mono, unmodified? How about a mobile app that runs on smartphones regardless of the runtime (.NET vs. J2SE)? Not gross at all, and not unthinkable if your app is written in JavaScript using some kind of portability layer that doesn&#8217;t exist yet.</p>
<p>In the longer term, JavaScript (a.k.a. ECMAScript 4) is likely to become extremely popular. As far as I know it&#8217;s not quite a perfect fit for Steve Yegge&#8217;s <a href="http://steve-yegge.blogspot.com/2007/02/next-big-language.html">The Next Big Language</a>, but it&#8217;s the closest thing there is, and it has two critical advantages over Ruby and Python that will make it successful: C-family syntax (which makes development tools cheaper to build) and effectively unanimous buy-in from vendors and developers.</p>
<p>So, what about the other dynamic languages that people are using in large numbers today? What&#8217;s going to happen to ActionScript, CFScript, PHP, and VB?</p>
<p>ActionScript and CFScript are pretty close to JavaScript by design; I&#8217;ve read that ActionScript 3 is actually compliant with the ECMAScript 4 draft specfication. It&#8217;s pretty clear that Adobe is betting on JavaScript. In the near future (2 or 3 years) I predict that Adobe will rev its products and support ECMAScript 4 across the board.</p>
<p>PHP and VB.NET/VBScript will hang around for a long time because they&#8217;re approachable and already very popular, but they&#8217;ve already peaked, and will steadily decline as developers switch to C# (on the .NET side) and Rails (on the Linux side), and then JavaScript as soon as a serious web app framework and an ISP-friendly runtime exist. Microsoft will keep investing in VB to keep customers happy; Yahoo will keep investing in PHP because it is so heavily invested in PHP already; new developers will find PHP to be an easy starting point for light duty web development, with tons of documentation and free applications that they can download and hack. But PHP will not inherit the kingdom from C# or Java, and the languages which do achieve mainstream success after C# and Java will do everything that PHP does language-wise, and the market momentum around those languages will make them better than PHP at what PHP does. Developers will ask themselves why they would write the client side and server side in two different languages, especially when the server-side language is more expressive and has better portability and libraries. That&#8217;s not true yet, but it will be in a couple of years. In 5 years or so PHP and VBScript will go the way of Perl CGIs: still used, but by a community a tenth of the size it is today.</p>
<p>What about the new Java-based dynamic language, Groovy? Groovy is interesting, but it&#8217;s too late. The Java mainstream of vendors and developers only recently managed to convince the world of &#8220;serious&#8221; C++ developers that automatic garbage collection and JIT compiled bytecodes can actually work in a high traffic context. The next battle, to promote the dynamic language features that Java lacks but which Groovy brings, will take years to fight. Once a developer makes a decision to not use standard Java, Groovy is on a more or less level playing field with the JVM-hosted versions of Python, JavaScript, and Ruby, but each of those languages has far greater adoption than Groovy, and each of them has greater opportunity for leverage on other runtimes than Groovy. For a Java developer, once the door is opened to other languages, the only advantage Groovy has is that its syntax is familiar. Compare this to JavaScript which web developers also need to know how to use; why learn a third language (Groovy) in addition to Java and JavaScript? Over time the simplicity of coding and debugging in JavaScript on client and server, together with dynamic-language productivity, will overcome the momentum of the Java standard, and web developers using server-side Java now will gradually replace it with JavaScript on the JVM. Conservative attitudes in the mainstream Java community (including Fortune 500 companies and the many offshore development firms that write code for them) will make this take quite a while &#8211; probably 5 years before JavaScript becomes a common part of the architectures that currently use J2EE, and 10 years before Java goes the way of COBOL (maintained forever but not used for new projects).</p>
<p>So in conclusion, keeping an eye on the future value of a technology, including who&#8217;s investing in it and who&#8217;s talking about investing in it, is critical to making your own investments today. In five years you&#8217;re not going to be using the same technology stack that you are today, and your project&#8217;s success and your own salary will be tied in large part to how well you invested today.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2007/11/12/evaluating-future-web-application-technologies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Immature developer attitudes revealed in flames regarding CDBaby</title>
		<link>http://www.pervasivecode.com/blog/2007/09/23/immature-developer-attitudes-revealed-in-flames-regarding-cdbaby/</link>
		<comments>http://www.pervasivecode.com/blog/2007/09/23/immature-developer-attitudes-revealed-in-flames-regarding-cdbaby/#comments</comments>
		<pubDate>Sun, 23 Sep 2007 20:36:31 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2007/09/23/immature-developer-attitudes-revealed-in-flames-regarding-cdbaby/</guid>
		<description><![CDATA[Derek Sivers of CDBaby kicks ass. He got a sophisticated and very very user-friendly, efficient, straightforward e-commerce system (including the back-end systems) written in PHP. Based on what I&#8217;ve read, he&#8217;s up there with Phil Greenspun in my opinion; that is, he&#8217;s among those who understand strategy and customer service and low-level technology and are [...]]]></description>
			<content:encoded><![CDATA[<p>Derek Sivers of CDBaby kicks ass. He got a sophisticated and very very user-friendly, efficient, straightforward e-commerce system (including the back-end systems) written in PHP. Based on what I&#8217;ve read, he&#8217;s up there with <a href="http://philip.greenspun.com/panda/">Phil Greenspun</a> in my opinion; that is, he&#8217;s among those who understand strategy and customer service and low-level technology and are able to build systems that don&#8217;t suck, resisting the temptation to be distracted by technological panaceas and fads. I may disagree with their individual technology decisions, but their higher-level thinking is excellent, so they&#8217;re definitely in the class of people who I&#8217;ll give the benefit of the doubt.</p>
<p>So when I read <a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html">7 reasons I switched back to PHP after 2 years on Rails</a> I was a bit surprised, but not much. He&#8217;s experienced with PHP (he says he&#8217;s written 90,000 lines of code for CDBaby!), and has a huge installed base of code he wrote and understands intimately. He tried Rails, it didn&#8217;t work the way he wanted, and he went back to PHP. It was immediately obvious to him that this was what he should continue using.</p>
<p>The most shrill and arrogant among the Rails community have been rather unkind, partly due to <a href="http://developers.slashdot.org/developers/07/09/23/1249235.shtml">this rather poorly written Slashdot headline</a> that misrepresents what Derek says in his article.<br />
<span id="more-45"></span><br />
I&#8217;m using Rails and I&#8217;m generally happy with it, though I have had to do some customization of the framework (mostly with pre-existing Rails plugins from like-minded developers)  to suit my style. At this time I plan to continue using Rails for my project, and to keep using it in future projects.</p>
<p>But, I thought it would be instructive to summarize the arguments made by the folks slamming Derek in the comments to his article.</p>
<ul>
<li>Rails is the correct solution for CDBaby, regardless of what the founder//designer/lead programmer of CDBaby thinks.</li>
<li>If you don&#8217;t agree with Rails&#8217; design, you&#8217;re wrong, and you need to change your design if not your whole business to fit Rails.</li>
<li>PHP is bad and can never result in good code. Conversely, Ruby is good and is always better than PHP.</li>
<li>Objects are better than SQL and tables. Domain specific languages are great, as long as they&#8217;re written in Ruby; using SQL as a domain specific language for data manipulation and querying is not Ruby and therefore is a bad idea. Also, just because one person can code something in PHP in 2 months that runs on one server, instead of two people taking over two years to do it in Rails (which is notoriously hardware-hungry), doesn&#8217;t make PHP + SQL better. Because objects make you more productive.</li>
<li>Just because you wrote a successful online store yourself from scratch, have an O&#8217;Reilly column, and then hired a Rails core team member who now works for the same company as most of the rest of the Rails core team including DHH (37Signals), doesn&#8217;t mean that you actually had people smart enough to rewrite your app in Rails. You need to prove to the world that what you wanted to do was impossible in Rails before we&#8217;ll give you permission to make technical decisions for yourself.</li>
<li>If you don&#8217;t like Rails it must be because Rails is too good for you. Maybe instead of learning from years of real world experience running a business and writing the entire software suite for that business yourself, and hiring one of the best Rails developers in the world for your transition to a new architecture, you should have gone back and gotten a CS degree.</li>
</ul>
<p>Since this is such an active flamewar with such sloppy readers (responding to the Slashdot headline&#8217;s misapprehension of what Derek wrote, instead of what he actually wrote), let me say this clearly:</p>
<p><strong>The above listed points are not my opinions. They are summaries of opinions I find immature and silly.</strong></p>
<p>(I&#8217;m assuming someone somewhere will read this post in anger and make themselves look foolish by arguing against these points as if I believed them anyway. I tried to warn ya&#8230;)</p>
<p>We can learn something from this. This same flamewar keeps appearing over and over and over, all over the internet, and before that, on BBSs and in print.</p>
<p>The simple fact of human mortality means that most of us are going to be learning and making mistakes that we imagine a wise, seasoned developer wouldn&#8217;t make. But that guy retired and is fishing, so it&#8217;s up to us to screw up and learn and hopefully do better next time.</p>
<p>For the last few thousand years, we&#8217;ve had the advantage of being able to read books, and get wisdom that way. But there are fads, and hyped books that seem to know it all. So you have to read a lot of books, and try a lot of contradictory ways of doing things, to get a mature enough perspective to make wise choices on future projects.</p>
<p>The point that is generally missed by everyone trying to do anything new to them, is that there&#8217;s a lot more out there that you don&#8217;t understand, and a lot of what you think is your brilliant new invention has been done before. The more you learn, the more humble you become as you learn that there are people WAY smarter that you are, and that there are people who have come before you who you will never catch up to.</p>
<p>In the case of web development, that means that there are people out there who disagree with you, and you might not actually know everything about everything like you think you do. Local experience and immersion in the problem they&#8217;re trying to solve makes them much better suited to solving their problem than some armchair quarterback. It&#8217;s tempting to fold your arms and feel smug about your quick dismissal of someone else who clearly isn&#8217;t as big a genius as you are, but the more certain you are of your own brilliance, the more likely it is that you&#8217;re just ignorant. (See also: <a href="http://gagne.homedns.org/~tgagne/contrib/unskilled.html">Unskilled And Unaware Of It</a>.)</p>
<p>In Derek&#8217;s case, he clearly jumped feet first into Rails and hired a rockstar developer, and then made the decision given a uniquely advantageous perspective that it just wasn&#8217;t working, after giving it a hell of a lot more time to pay off than I would have. (I&#8217;m not exactly sitting here scratching my head wondering &#8220;how could Derek have been so wrong?&#8221;)</p>
<p>What matters a lot more than choice of programming language is the ability to get the project done, meaning tested and correct and launched. Apparently for Derek, PHP is the way to get that done, and Rails ain&#8217;t.</p>
<p>Finally, consider the parallels between Derek in this case, and Phil Greenspun in his book (late 90&#8217;s). They both use SQL more than the &#8220;Objectistas&#8221; would like, which is to say, they use it directly and like it. They both use languages that are not the most fancy high level languages available, but they do completely understand how their application works, from UI all the way down to hardware performance, and they make integrated decisions that take business strategy and technological factors into consideration.</p>
<p>This is really critical to understand about why both of these guys are so smart: both of these people put aside dogma and made decisions that were all over the map, sometimes pragmatic and hackish, sometimes very rigorous and disciplined, depending on their assessment of the particular micro-issue they were addressing at the moment. They weren&#8217;t subscribing to any particular software development philosophy (<a href="http://www.laputan.org/mud/">Big Ball of Mud</a>, XP, RUP, UML, Agile whatever, waterfall, etc.), nor did they just choose the most hyped architecture of the day and blindly stick with it, but freely mixed and matched whatever they thought was appropriate given their perspective on the situation.</p>
<p>In other words, they didn&#8217;t fall into the trap of thinking that there is One True Way to do everything. They improvised. They integrated their own experience and perspective with the wisdom of others, and made the decision that worked for them.</p>
<p>I hate to sound like a moral relativist, because I&#8217;m not. But as a practitioner, I&#8217;m definitely becoming more and more of a process relativist every day. One of the best ways to make a project fail is to try and force-fit an architecture and/or a methodology onto that project without customizing them to the particular details of the project. <strong>The best methodology is called &#8220;Roll Your Own.&#8221;</strong></p>
<p>And so I leave you with this question, in the hope that it will help you with your current and future projects: <strong>Have you made any dogmatic decisions about your process or technology that are hurting your project?</strong></p>
<p>Maybe it&#8217;s smarter at this point to keep doing what you&#8217;re already doing, but maybe there are some things that you could change. Try to keep your <a href="http://wiki.jeffsandquist.com/default.aspx/GTD/MindLikeWater.html">Mind Like Water</a>, strong enough to cut through mountains but flexible enough to flow around obstacles, and making the decisions of which one to do based on the information that you and only you have.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2007/09/23/immature-developer-attitudes-revealed-in-flames-regarding-cdbaby/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

