Rants
Questions
Soapbox
Best Practices
Apply today for a FREE subscription to CIO Magazine!
Fri, Nov 21, 2008 15:45 EST

|
Posted by: Esther Schindler in Questions Topic: DevelopmentBlog: Developer Wisdom
Current Rating: |
If your software development experience comes from the old-style world of compiled languages, such as C++ or COBOL, you may be a little mystified by the new generations of scripting or dynamic languages. Now you have "modeling" languages to worry about, too. Do any of these names matter, when it comes down to choosing the best language to solve the programming problem? Probably not.
I'm not saying that there is no technical difference between the various language types. Absolutely, there is. It's just that, when push comes to shove—that is, when you need to answer, "Which is the right tool to solve this problem?"—the distinction is largely academic.
It used to mean a lot more. If you're an old fogey (as I am) you may need to revisit your assumptions. "Regular" programming languages were for "real" applications that would go into production. Scripting languages (starting with EXEC on the mainframe, which later became REXX) were about creating an automation process and running system commands. These evolved into shell scripts and batch languages. You could do a lot more than system commands with scripting languages, of course (Teach Yourself REXX in 21 Days, which I cowrote, included a checkers program), but writing applications wasn't their primary role. These scripting languages were (and are) dynamically typed, but that wasn't a big deal; it just contributed to their usefulness as "quick and dirty" tools.
Another side issue in the acceptance of interpreted languages may have been that they were inherently "open source." Anything you wrote was human readable rather than turned into executable code by a compiler. That openness is part of what inspired the early PC industry; you could download a BASIC program from a BBS or type in the code from a computer magazine and do something useful. But any "enterprise" application needed to be written in a compiled language to protect the company's intellectual property. (Or so the boss believed.)
As software development moved to the Internet generally and the Web specifically, it became more important for software to respond dynamically. The disadvantages of interpreted languages became irrelevant; an application server spends more time waiting for user input than responding to it. And these languages (back when we'd have said they were "emerging"—I've think they've now emerged) were all consciously open-source, with the geekiest developers quietly doing their Web-thing without the attention of anyone in the CXO hallway noticing if the software was written in company-approved .NET or Java.
Meanwhile, somewhere in there, "scripting languages" turned into "dynamic languages;" if anybody makes a technical distinction between "scripting" and "dynamic," I don't know what it is.
And then there's the question of whether a language ought to be classified as dynamic at all; that issue was raised after I wrongly called Scala a dynamic language in 6 Scripting Languages Your Developers Wish You'd Let Them Use (you can see my non-technical explanation in its comments). For Scala user Ricky Clarkson, writing in a discussion list, the distinction isn't necessarily whether the language has a type system, but if it is "an essence or a ceremony language." Apparently that mainly means whether the language requires explicit type annotations throughout; if it does, it's a ceremonious language. (Who comes up with these terms?!)
Clarkson added, "I expect that most people who say scripting language as a positive thing won't be able to define
Well... I believe that there is definate proven truth to the fact that scripting languages are just as useful as compiled - however I'd argue that compiled makes more sense.
With virtualization, risc processor technology, multicore systems, and everyone wanting faster and faster performance (and not usually getting it due to software bloat or whatever) ...
It seems to me - lean and mean processor command sets would make actual "processors" really shine! Think about it: If you want virtualization and have a fairly small command set on a processor, and that processor hosting an operating system that then can run "Virtual Machines" on it in such a way that the binary code in the virtual machine can be made to literally execute natively on the host processor - WOW - that would be some VERY SLICK utilization of current technology if you ask me.
Now... instead, the scripting trends, compile on demand, blah blah... trends turn this same scenario into a text parsing nightmare, waste of CPU time, and don't get me started on the the whole XML "revolution".
Sure... they say with todays fast computers you don't need to have tight code... or compiled code... so our collective advancements are - bloated code, more IP exposure risks, faster machines with 4 CPU's run as fast as a 386 with Windows for Work Groups ....
Sure... Compiled versus Scripted might not matter to you... I think we all suffer one way or another. Like everything these days, more products, faster turn around... less quality.. all to get it out there faster and get paid. Hmm.
--Jason
Jason - a few points of correction.
Firstly, many of these scripting languages can be compiled, just as you can run a traditional language in an interpreter. Look at the way JavaScript performance has been massively accelerated in Firefox, Safari and Chrome by converting it into byte code on a VM rather than interpreting.
Secondly - the likes of C++, Java, Obj-C, and all other object oriented programs are already taking place in a dynamic object runtime anyway - generally speaking most of us are coding at a high level of abstraction.
Thirdly - there's been some amazing progress in the area of low-level virtual machines, particularly in the area of converting the byte-code into native code by JIT compilation. LLVM has in some cases proven itself to beat C code compiled by gcc, because it's JIT compiler can make better optimizations - because it can make optimizations based on the real current running state of the system, which you simply can't do when compiling on a different machine.
For what it's worth, there is a machine out there with a CPU where the instruction set is basically the Java byte code - i.e. it is a hardware implementation of the JVM. Which is great until the JVM hits it's next version . . .
I think most of the things you identify (bloat, poor performance) actually relate to poor quality, rather than theoretical issues.
I would not use a weakly typed or fully interpreted language (e.g. PHP) for a large project. Compilers and type checking find a lot of bugs before the code is even run. Likewise, I would not write a batch file to copy a dozen files in C#, and interpreted langauages are great for quick 'n dirty programs that you write in 10 minutes, use and then forget about. For example, I analyse my web server log files using AWK.
In the end, it's horses for courses. Always has been, always will be.
I wouldn't tell anyone to take his favorite pick from any scripting or 'regular' language for any application. Instead I would tell him to consider th 'big picture', i. e. who is going to use this application, in terms of number of users, possibly concurrently, and maybe including other applications! Also it is important to see where the application is going to run, and what the rstrictions on this machine are, what other applications it is competing with for ressources, etc..
When you look at a single-user application that is strongly interactive, then just about anyone would tell you: response time is not an issue, use a dynamic language - because it is fast to write and test. But if that application is linked to some kind of online service, together with thousands of like applications at the same time, suddenly there may be a bottleneck at this other interface: The online server will set up a ommunication with your application and it's own responsiveness will be tied to how fast your own application can react, on top of the load the other applications put on it. And here is where it still might be better to use a compiled language.
So, this is my Checklist:
1. Look at the interfaces. If there's just one interface that might connect to another application, then don't use scripting.
2. Look at concurrency. If you don't have any handle on the uppermost limit of users that might use your application at the same time on the same machine, then don't use scripting.
3. Look at ressources. If your application might run on machines that tend to run lots of other applications as well, and who it needs to compete for ressources with, then don't use scripting.
I might be overcautios. But if you ignore any of the above, you run the risk of clogging down a machine. Maybe not your's, maybe not any of your friends'. But quite possibly someone's.
What about PHP vs JSP? Seems like this is getting decided more and more everyday. What compile and deploy, when you can just deploy.
Isn't facebook run on PHP?