This is Part I of a series that I will be doing on factoring your software architecture for development agility, software performance, and total cost of ownership (TCO).
When object oriented programming first arrived on the scene (25 years ago!), it delivered important concepts: encapsulation, polymorphism, and inheritance. These concepts were designed to help the developer factor code. Proper factoring reduces complexity, redundancy and cohesion. One of the most powerful factoring techniques in programming is grouping for reuse. Functions, Objects, and Aspects are all code groupings that organize an area of concern for reuse.
Code reuse and other factoring techniques tend toward greater simplicity and development agility. These characteristics have an important and positive impact on cost and revenue. There is no doubt that software development can be an expensive undertaking and at the end of the day it’s always about the economics.
As we have observed, programming languages have been evolving to help manage complexity and make software development more efficient and effective. As computing power continues to improve, platforms are also evolving to improve development agility. For example JAVA introduced the JVM and the concept of “write once run anywhere.” It’s clear that the JAVA platform (as opposed to the JAVA language) provides clear agility over languages compiled to specific machine architectures because it removes the dependence on specific machine architectures by introducing an abstraction; the JVM. It has greatly simplified building, packaging and the distribution of software.
Today scripting languages are mainstream. Scripting languages are generally loosely typed and are interpreted rather than compiled. There are debates between what might be termed the “systems level programming languages” and “scripting languages.” Some in the traditional camp cite that scripting languages lack rigor, and claim that it won’t perform when compared to their compiled counterparts. Those in the scripting community point to “extra work for little value” and complex deployment environments as the other side of the coin. The communities around PHP, Ruby, Python, PERL, Groovy and others boast impressive development agility characteristics over JAVA, C++, etc.
It’s unlikely that there is anything inherent in the languages available today that drastically change the agility characteristics of development in those languages. Most of the mainstream languages have similar concepts and differ in terms of syntax. While some expressions may be quicker in one language over another, it’s unlikely that any of the mainstream language’s syntax will produce agility characteristics that are orders of magnitude above and beyond the others. That is to say, it is not the “PHP” in “PHP” or the “Ruby” in “Ruby on Rails” that makes them faster to develop in. It’s platform and architecture that accounts for the difference. PHP, Ruby and many other examples are interpreted rather than compiled and this means that when a change must be made to a program there is no need for a recompile and no need for a restart. Just change the code and (in the case of the web) hit refresh. In the same way JAVA cleaved an entire effort out of the development process (building for individual architectures), scripting languages have cleaved a massive time sync off the hands of developers by making it easy to modify code “on-the-fly.” I believe that scripting and compiled languages are not at odds but rather they are complimentary.
The strong typing, static analysis and offline assembly of byte code makes perfect sense for framework or systems oriented code. This code is not likely to change much in the course of an implementation but is executed frequently. Framework code often defines the performance profiles of a system. You always want to optimize when possible. Where there is no absolute requirement for interpretation and no strong value proposition it should be avoided. That is to say favor compilation over interpretation where interpretation does not deliver significant value. Don’t make the machine do the same work twice when it can be avoided.
Application level code (as opposed to framework code) changes often. Developers benefit from the ability to easily write and run code without having to restart servers and perform compilations and deployments. Application code has a lifecycle and release cycle that is much different from infrastructural / framework code. This becomes more and more apparent as the framework matures and changes less and less often. They are two different types of code with two different lifecycles. Businesses don’t want to spend more time on framework than is necessary. The value is in the applications and this is where agility matters most.
The optimal approach doesn’t have to be one or the other (although in some cases it is.) Each platform plays best to a different set of concerns. In software, a common approach for tackling separation of concerns is called layering. It is possible to layer a system by using a traditional, compiler based language and platform (such as JAVA) for infrastructure needs while leveraging scripting languages and template technologies (such as PHP, Ruby, Groovy and so on) for the application layer. By doing so, you combine the success characteristics of both platforms: compensating for weaknesses while playing to strengths. To understand the power and success of this approach, one needs to look no further than Excel; a truly killer application. Excel is a framework. You bring the application to it when you build your spreadsheet. Excel’s (a compiled, c++ based application) power is opened full bore with the VBA scripting environment.
PHP developers tend to be much more available and affordable than JAVA programmers. It’s simple economics.