You are here: Re: Strict types « PHP Programming Language « IT news, forums, messages
Re: Strict types

Posted by David Haynes on 03/30/06 15:09

Treefrog wrote:
> David Haynes wrote:
>> Well, you could do it in PHP5 by wrapping all the basic types in classes
>> like java does for a lot of things. Then each type class would have its
>> own toXXX converters to handle the casts.
>
> Cute. I might spend some time playing with that idea. but I'd prefer if
> PHP had built in support...
>
>
>> This is an example of 'fixed with another level of abstraction' and I
>> wonder at the utility of it all. PHP - like shell - is often attractive
>> to coders *because* it is loosely typed.
>>
>> I'm not sure how many coders would find PHP as attractive if they had to
>> follow stricter object type coding.
>
> Hmm, I agree I think, hence wanting the option to use strict types. The
> problem is, from my experience, people initially use PHP because it's
> easy and they can get their idea realised in a short time with a
> minimal leanring curve/expense. Unfortunately, soem of these ideas
> actually work and start making money, sometimes BIG money, and they are
> left with poorley coded legacy crap that everybody firefights to keep
> working... and any improvments are complete kluges.
>
> I'm not sure what can be done to change that, but I want to stay with
> PHP, it can be used for huge scalable systems, but only if coded
> properly. I suppose I'm clutching at straws to make it harder to write
> bad code.
>

I think it ends up being more organic. You start to develop a set of
libraries and practices that protect you from a lot of coding goofs and
continue to build/refine.

One of the more humbling things I think any good coder can do is look at
their code from a year or two before. I know I usually end up wondering
what I was thinking in some places ;-)

With the stronger object support in PHP5, a lot of things can be coded
to be protected well and, as with all programming languages, it is
possible to write good and bad code regardless of the protection the
language offers.

One other way people have handled the 'type' issue is to use a strong
naming convention - e.g. Hungarian notation. Personally, I can't stand
using it but others find it helpful.

-david-

 

Navigation:

[Reply to this 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

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