NYCPHP Meetup

NYPHP.org

Position of variable definitions [was: Re: [nycphp-talk] php script]

tedd tedd at sperling.com
Sat Feb 23 10:01:35 EST 2008


At 7:49 PM -0500 2/22/08, David Krings wrote:
>This is from a different thread and it caught my attention. I spend 
>some considerable time in programming courses (not that it really 
>helped, but that is a different story) and each and every time the 
>instructors or authors drove home that one has to define and 
>initialize variables and that this has to be done before doing 
>anything else.

No disrespect meant, but instructors teach, not program, for a living.

My dentist used to say, "Floss only the teeth you want to keep."

I say, "Document the code you want to reuse." Simple enough concept.

Where and how you document is up to you -- whatever makes your work easier.

If you work for a team, then have a group-think and come up with a 
formula that best fits with everyone's habits.

As for defining/initialize variables before they are used, in some 
languages that's required and others it isn't. But in both cases, 
variables names mean more than where they appear, IMO.

But above everything else, program for yourself. Make your code a 
thing of beauty. Something that others (including teachers) can use 
as examples of what should be done.

Cheers,

tedd
-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the talk mailing list