This is long and all about software, so you can safely skip if you don't care.
Software engineering performance flame wars. I was reading this article posted to a Java oriented audience claiming that PHP scales well. As someone who's been writing software for a while(though by no means the most expert/experienced developer ever), I think I have a pretty good perspective on what makes good software. And one of the hottest topics for debate is whether X performs better than Y. Whether it's one line of code or it's an OS or a whole language, few things ignite more flame wars than what runs faster than what.
You would think that the question would be easy to answer. Just run a benchmark for X and Y and see what wins. The reality is that it's almost never that simple. For a single line of code that might work but even single lines often don't provide comparable results. And it's completely impossible to compare large projects. Usually the point of a performance comparison is to decide beforehand which method to use and comparing the whole application performance of both systems defeats the purpose.
For large systems, the key feature is an architecture that can achieve performance through scalabilty. The author does acknowledge later that performance is different from scalability. Performance is how fast your systemm runs, scalability is how fast your system can run. Scalability is an abstract goal at the architectural level to design a system that can handle all the potential traffic you can anticipate.
I don't usually argue the performance characteristics of Java/PHP/C++/Perl, but thankfully this blog is my personal soapbox so I can say whatever the hell I want. I think they can all perform fine for any application, small or large. C++ is probably a bit faster than Java(but Java can win sometimes as seen in this article), which is probably a bit faster than PHP. I think Java is slower than C++, but it's speed is rapidly increasing to the point that it will soon be faster than C++ for many things. However the performance of these languages is largely irrelevant as long as you are not running them as forked CGIs. In system design two things are more important than performance: scalability and maintainability(yes I know it's not a real word, but software developers know what I mean and it makes my conjunction better if I can use two -ability words together). Any of the languages can be used to build a scalable system.
The reason that Java works so well for enterprise applications is not because it's faster. The reason I like it is that it is the easiest language to create maintainable systems. It's possible to create a scalable design with each of the languages, but Java guides developers towards it without a significant loss in maintainability. PHP and Perl are were developed as scripting languages and have quick small applications in mind. They encourage practices which aren't as easily maintainable in very large systems. I love Perl, I think it's amazing, but I wouldn't build a system of 50,000 lines of code with it. I feel similarly about PHP, except that it's much better for building web sites, but worse for most everything else. Having a weakly typed language where variables are not clearly declared and scoped is asking for trouble later. You can certainly be verbose and declare and scope things in both scripting languages, but the nature of the language and the programmers of those languages means it usually doesn't happen.
C++ has a different set of issues. Yes, C++ is frequently faster, but it's tougher to write good OO code with it. C++ programmers tend to be created from procedural C programmers and they tend to inherit some of the designs that tend to be too procedural and not OO enough. Also having to do your own memory management is a time consuming, even for experienced C++ programmers.
To summarize, you can build scalable, maintainable systems with any of the languages. Performance is overemphasized, scalability is not. The performance difference between the languages is overemphasized, the difference in maintainability is not. You probably won't get an order of magnitude performance boost by switching languages. You could get that by redesigning your system architecture. If it costs you a significant amount of time to achieve the performance you are looking for your architecture is to blame, not the language.
There are plenty of good reasons to choose a specific language, whether it's Java, PHP, Perl, C++. For instance your local talent pool is filled with PHP programmers and you know they are excellent. Or you need to work with an extensive amount of legacy C++ code without a major system revamp. It's just a bit easier to do write a scalable, maintainable system in Java because it guides you in that direction.
Software engineering performance flame wars. I was reading this article posted to a Java oriented audience claiming that PHP scales well. As someone who's been writing software for a while(though by no means the most expert/experienced developer ever), I think I have a pretty good perspective on what makes good software. And one of the hottest topics for debate is whether X performs better than Y. Whether it's one line of code or it's an OS or a whole language, few things ignite more flame wars than what runs faster than what.
You would think that the question would be easy to answer. Just run a benchmark for X and Y and see what wins. The reality is that it's almost never that simple. For a single line of code that might work but even single lines often don't provide comparable results. And it's completely impossible to compare large projects. Usually the point of a performance comparison is to decide beforehand which method to use and comparing the whole application performance of both systems defeats the purpose.
For large systems, the key feature is an architecture that can achieve performance through scalabilty. The author does acknowledge later that performance is different from scalability. Performance is how fast your systemm runs, scalability is how fast your system can run. Scalability is an abstract goal at the architectural level to design a system that can handle all the potential traffic you can anticipate.
I don't usually argue the performance characteristics of Java/PHP/C++/Perl, but thankfully this blog is my personal soapbox so I can say whatever the hell I want. I think they can all perform fine for any application, small or large. C++ is probably a bit faster than Java(but Java can win sometimes as seen in this article), which is probably a bit faster than PHP. I think Java is slower than C++, but it's speed is rapidly increasing to the point that it will soon be faster than C++ for many things. However the performance of these languages is largely irrelevant as long as you are not running them as forked CGIs. In system design two things are more important than performance: scalability and maintainability(yes I know it's not a real word, but software developers know what I mean and it makes my conjunction better if I can use two -ability words together). Any of the languages can be used to build a scalable system.
The reason that Java works so well for enterprise applications is not because it's faster. The reason I like it is that it is the easiest language to create maintainable systems. It's possible to create a scalable design with each of the languages, but Java guides developers towards it without a significant loss in maintainability. PHP and Perl are were developed as scripting languages and have quick small applications in mind. They encourage practices which aren't as easily maintainable in very large systems. I love Perl, I think it's amazing, but I wouldn't build a system of 50,000 lines of code with it. I feel similarly about PHP, except that it's much better for building web sites, but worse for most everything else. Having a weakly typed language where variables are not clearly declared and scoped is asking for trouble later. You can certainly be verbose and declare and scope things in both scripting languages, but the nature of the language and the programmers of those languages means it usually doesn't happen.
C++ has a different set of issues. Yes, C++ is frequently faster, but it's tougher to write good OO code with it. C++ programmers tend to be created from procedural C programmers and they tend to inherit some of the designs that tend to be too procedural and not OO enough. Also having to do your own memory management is a time consuming, even for experienced C++ programmers.
To summarize, you can build scalable, maintainable systems with any of the languages. Performance is overemphasized, scalability is not. The performance difference between the languages is overemphasized, the difference in maintainability is not. You probably won't get an order of magnitude performance boost by switching languages. You could get that by redesigning your system architecture. If it costs you a significant amount of time to achieve the performance you are looking for your architecture is to blame, not the language.
There are plenty of good reasons to choose a specific language, whether it's Java, PHP, Perl, C++. For instance your local talent pool is filled with PHP programmers and you know they are excellent. Or you need to work with an extensive amount of legacy C++ code without a major system revamp. It's just a bit easier to do write a scalable, maintainable system in Java because it guides you in that direction.
Labels: software



1 Comments: Post a Comment
enh. I would have preferred the porn.