To comment or not to comment? (not even a question...)

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Ok, I think you just need to lock this topic since it's not going in the route I wanted it to go at all - just lock this topic.
onion2k wrote:The biggest problem I can see with this discussion, especially the SitePoint thread, is that a newbie coming to it may think "My script is slow, I'll delete all my comments!".
The T&D forum is not for newbies :D
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

8. Learn a good built tool, like Phing.
Number 8 works for me though I use Perl.
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

Post by serfczar_ »

I think everyone should go by coding standards, it saves someone else time if you comment and indent correctly. It's just common courtesy.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Unfortunately everyone has their own conventions. Great for some, bane for others.
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

Post by serfczar_ »

feyd wrote:Unfortunately everyone has their own conventions. Great for some, bane for others.
I hear you load and clear on that bane for others aspect.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

feyd wrote:Unfortunately everyone has their own conventions. Great for some, bane for others.
I often comment that the variations in conventions are actually very trivial. The truth is that small percentage of programmers are what might be kindly called the biggest control freaks in the universe. I think that percentage is around 90%. ;)
Last edited by Christopher on Tue Apr 03, 2007 12:15 am, edited 1 time in total.
(#10850)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I would certainly agree that the conventions chosen by many, through whatever means, are quite similar and as such shouldn't be too difficult to adapt to for anyone. It's the ones that are more unique that are troubling however.
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

Post by serfczar_ »

arborint wrote:
feyd wrote:Unfortunately everyone has their own conventions. Great for some, bane for others.
I often comment that the variations in conventions are actually very trivial. The truth is that small percentage of programmers are what might be kindly called the biggest control freaks in the universe. I think that percentage is around 90%. ;)
90% or more maybe :P. Why do you think anyone ever programs a database driven game? Well, they can of course play god.
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

Can you explain me this: "anyone ever programs a database driven game" i didn't understood the idea (perhaps my english knowledge leaks sometimes).
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

He was referring to how programmers a are typically control freaks, hence wanting to play god in making a game.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Comments are a necessary part of the code unless you plan to maintain it daily yourself. Have you ever gone into an app, even your own, and see something in there that had no comments, that, even though the logic screamed out to you, it still did not quite look like it should but you didn't know why?

I thought that thread was about shortening code by not assigning variables?!?!?! :!::?::?
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

It was about the whole thread and the posts in this thread.

P.S In this context, thread = the thread on SitePoint which I linked to.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

I find it interesting watching the evolution of comments.

When programming assembler it is absolutely nessecary as the machine code mnuemonics are nothing in terms of explaining what is going to be done. Commetning each line, step by step was essential...

Years later, we have almost self documenting code (at the comment level anyways) in that using a strict, logical convention is almost as good as comments. I still use comments, mostly for API documentation (phpDocumentor) and I leave little caveat notes, but I can't stand when people comment for the sake of commenting...

Still in PHP I see

// Initialize variables

Likely guilty of this myself...but honestly thats about the most worthless comment on the planet. I'm trying to get into the habit of making proper comments, but instead of every second line or so, every logical section of code. That helps in keeping code clean from comments...

There is truely an art to commenting I believe, but as an art it's subjective, so I guess were all free to form our own opinions...

PHP is high level enough you could probably get away without commenting much, you almost have to step through the code first anyways...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Odd, I rarely commented in my Assembler code.

:twisted:
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

feyd wrote:Odd, I rarely commented in my Assembler code.

:twisted:
I didn't even know I could comment my Assembler code :P
Post Reply