Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
when your coding php... do you stick to strict coding styles and mark out all your sections of your code and what you want it to do before you start coding?

do you comment all your code? just to make it totally maintainable if someone else comes along and decides to make an open source project out of it...

or do you go the random way? just put in your <?php and then just start putting any old thing hoping that it comes out with something useful and do you forget to or refuse to comment your code as to make it totally unmaintainable and un useable for anyone else who wishes to use it.

i respect the fact that most programmers don't comment just to stop people knowing whats going on in their scripts.. but if i'm doing an open source project i comment like mad indent everything and space out everything so it looks neater readable and reuseable...

so how do you guys feel about this?


Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Well, if I was doing something that's open source and that's complex, I would comment.

If its fairly simple, I think descriptive variables is enough. :P

acoolie
Guest
First of all, I follow all PEAR coding standards, besides commenting. Codes should not need description. My code is self-explanatory.

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
show off! lol

i can't be bothered with PEAR standards ... if i did a major project then maybe i might look into it ... i comment sometimes and what do you mean by self-explanatory? i mean someone who knows nothing about php how would that be self explanatory? lol

acoolie
Guest
Someone who knows nothing about PHP should not have to open the code. Create an installer =P

A coder should be able to look at your code, variables, and statements and be able to tell what it does. That is one of the major advantages of OOP, you can name a set of 100 functions a single word.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
That's true, but there's sometimes when you can't describe it in a single word. Or sometimes you can't remember the exact use of a parameter. That's why I comment all of my functions.


function deleteThread(id,deleteUser,record){
    // @param Type Description
    // id Number ID of thread to delete
    // etc. except with tab spacing so its even. :P
}



Last Edit: Apr 15, 2006 20:14:51 GMT by Chris

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
maybe acoolie has a point there, if you was using classes then the vars in the class really should explain what the class does... but still comments don't go a miss :)

iDunk

iDunk Avatar

*
New Member

10


March 2007
Let's put it this way...if I put my cms that I am working on online right now....it would be WAY hard to understand. I pretty much just go random (and I only randomly throughout my script comment). ;D :P That is why it isn't out on the net yet. :P Partly, because it isn't done, but mostly because of no comments. :)

-Computerpros

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
This was a while back i posted this and i think my standards have changed.... i comment as much as i can now because the amount of times i've come to revise a script and end up having to re-write the whole thing because i just don't know what does what in my own scripts with it being so messy...

Tobias

Tobias Avatar

***
Dedicated Member

182


November 2006
I just try to see what works, I start with <?php and go from there, same way with all the other languages I know, only with their respective tags.
If someone looked at the code to my site at this point they'd think I was crazy. It's completely disorganized.
#intj (Mastermind)^

Llanilek

Llanilek Avatar
Former Elite Mod

****
Dedicated Studio Member

931


October 2005
you see tobias, thats how i used to be but you'll realise in time when you come to change something small in your script thats been a while since you first wrote it you will struggle to find it... so if you actually comment the script it will be alot easier to find.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
I learned that the hard way with SZ. :P Why do you think it's been recoded so much? (Or, at least v1.)

Tobias

Tobias Avatar

***
Dedicated Member

182


November 2006
bakura said:
you see tobias, thats how i used to be but you'll realise in time when you come to change something small in your script thats been a while since you first wrote it you will struggle to find it... so if you actually comment the script it will be alot easier to find.
Well my site isn't that big, and I've gone back and ficed things so often that I've practically memorised where everything is. I've also got part of it split up into different parts, like the UBBC parser in one files, etc, so one file will effect the rest of the site and it's easy to find. What I don't so is go out and say, okay, this is for bold, this is for reading the file with the posts, etc. ;)
#intj (Mastermind)^

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
tobias said:
bakura said:
you see tobias, thats how i used to be but you'll realise in time when you come to change something small in your script thats been a while since you first wrote it you will struggle to find it... so if you actually comment the script it will be alot easier to find.
Well my site isn't that big, and I've gone back and ficed things so often that I've practically memorised where everything is. I've also got part of it split up into different parts, like the UBBC parser in one files, etc, so one file will effect the rest of the site and it's easy to find. What I don't so is go out and say, okay, this is for bold, this is for reading the file with the posts, etc. ;)


You would be surprised how easily you forget the details about your codes ;)


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

newBookmarkLockedFalling