|
I don't buy it. Here is why. You aren't going to be using PHP as a quick and dirty. Your application has to fit inside some pre-defined parameters to use PHP in the first place. It has to be a web app, the programming has to be done on the server side, and it isn't going to easily be called from Java or any other language unless you are just going out and getting a whole page. In that case the PHP script still isn't called from Java or RPG, it is called from the client. It is pretty clear cut whether or not PHP is going to be a good solution to your problem. Sure you are talking typing, and I am talking PHP, but I could make the same arguments about javascript. Static or dynamic typing is a property of the language, and you have to live with it. It isn't really a choice you make like whether to use the LDA in your RPG application. There are some parts of PHP such as certain global variables that you shouldn't use because they are a holdover from the early days of PHP, and I would not advocate using them either. There are better more secure ways now to do the same things within PHP.
Static typing at least helps prevents some of the more egregiousIt can, but some times it makes you jump through extra hoops. What if the value of that string is a number? Why not just let the language go about doing the appropriate casting to let me do arithmetic on it? I know the answer, always be explicit.
mistakes programmers make, such as passing a string where a number is
meant to go.
But, working in a dynamically typed language is a different culture, and the two may not always see eye to eye. You kind of discounted my point about Java collections by bringing up generics (I will have to educate myself about those) and by saying that the objects inside the collection are typed anyway. But the typing of an object in Java is no more static than the typing of an object in PHP. The PHP object knows what kind of object it is, and interfaces are available to say that the Copy function needs to be there. Yes, the compiler doesn't catch it, there is no compiler, the interpreter does catch it though and will report on it the same way that a compiler would.
I know you may not entirely agree with my opinion on typing, but IIn the end, I am ok with disagreeing on dynamic typing. In practice I don't see all the pitfalls that you do. I know what I can do, and what to look out for. I suppose just as you do with Java.
wasn't specifically trying to say that the LDA is the same as a dynamic
type. I was saying that someone who warns against the LDA as a
dangerous programming technique should also make a similar warning about
dynamic typing, which has at least as many potential pitfalls as the LDA.
As an Amazon Associate we earn from qualifying purchases.
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.