Kelly Cookson wrote:
A nice feature of running PHP as an interpreted language is the flexibility in variable typing. Variable type in PHP depends on context. You don't get that when you compile a program. Compiled programs require that you define variable types in advance and they can't change.
I'm staying out of this from a pure "Why use PHP?" standpoint, because everybody knows my opinion. But this is an excellent observation and one which really touches the core of my beliefs in programming.

Dynamic typing is the nuclear medicine of programming. In very specific situations under rigorously controlled conditions it can do a couple of things that no other technique can do. It is, however, extremely dangerous and should be used only by highly trained professionals.

Unfortunately, the folks who most want to use it are often the ones least qualified. And that's when you get into incredible pain and suffering. In Java, I know that a field of type Customer contains a Customer object. And even in RPG, I know that a 6.0 field is not going to contain an email address. In dynamically typed languages, all bets are off. And when you combine that with ADGA (Agile Development Gone Awry), you end up with code where it's nearly impossible to tell what is in a variable at any given time.

Careful, careful attention paid to variable naming and strict coding standards can ameliorate some or even most of the problems, but very few shops have such standards, and RPG shops in particular tend to have nothing in place for their PHP development. And the time it bites you is when you find yourself with an unexpected error in a not-particularly well commented program where you're not even sure what's supposed to be in the variable that's causing the error. Add to that the fact that most scripting languages have very little in the way of solid impact analysis and that's why they fare much better in prototyping and proof of concept than in production development.

Dynamic typing makes it easy to throw together stuff quickly, but it doesn't really get aroudn the maxim that you can have something done fast or well, but not both. That's why static typing is 60% of programming today and gaining share.

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.