Reply to Re: Will php ever do strong typing?

Your name:

Reply:


Posted by Colin McKinnon on 05/24/05 14:51

Oli Filth wrote:

> dterrors@hotmail.com wrote:
>> Will php 6 do strong typing and/or namespaces?
>>
>> I was shocked to find out today that there are some people who
> actually
>> argue that weak typing is somehow better.
>
> I completely agree. Strong typing makes far more sense due to the
> compile-time constraints it enforces. Anyone who thinks otherwise is
> lazy, quite frankly, and isn't thinking in terms of long-term
> maintainability and debugging.

"We will encourage you to develop the three great virtues of a programmer:
laziness, impatience, and hubris."

-- LarryWall, ProgrammingPerl (1st edition), O'Reilly & Associates

Sorry, but I just don't get it. Why is enforced strong typing a benefit?

I like the way PHP works. I freely admit there are times when I want to make
sure of the type of a variable but in PHP I can *choose* to do that by
various mechanisms ('===', if ($test==(integer)$test), ...) and if I want
to record the type of a variable I use comments(1).

IMHO Hungarian notation and SOAP do major damage to the readability of code.


> It also buggers up the fundamental point of OOP, i.e. polymorphism.
>
Nope. I don't see that either. If the base types are (to most intents and
purposes) polymorphic, how does that undermine polyorphism in user classes?

IMHO the only design issues with PHP in its current form are:

- namespace collisions - implementing seperate namespaces is one solution to
this

- erm, that's about it really.

> Also, I think languages like PHP are designed for people who don't know
> much about "proper" programming. It's designed for people who just want
> to throw something together that does the job. No need to worry about
> algorithm optimisation, memory allocation or deallocation, hash-table
> searching, string handling, type-casting, or indeed typing in general.
>
( not to mention null pointer dereferencing, buffer overflows, failed build
cycles...)

There are no BAD programming languages(2) - just bad programmers ;)

Certainly I want to get things done with a minimum of effort however I have
written network protocol stacks and AI engines in PHP (and no, not because
it was the only programming language I know).

The most expensive component in most computer systems is programmer time.
Have a look at the Great Computer Language Shootout. PHP consistently
scores well in requiring fewer lines of code. It's not the most
minimalistic, but OTOH, I've yet to find someone that thinks PHP is not a
VERY easy language to learn. Add to this the flexibility of what can be
acheived with PHP and it starts to look like a language which excels at
being understood. This kind of transparency (despite my comments below - 1)
is therefore the most valuable asset of any programming language - want to
talk about maintainability and debugging?

But I am more than happy to be educated / proved wrong.

C.

1 - don't even think about posting a reply containing the string
'self-documenting code'
2 - except maybe brainf**k - but it's meant to be bad

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация