|
|
|
|
![]() ![]() |
Nov 22 2005, 08:47 PM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 5 Joined: 22-November 05 Member No.: 9,767 |
Interesting thought to ponder... And here is an article on it, that might get you thinking... http://www.phpbuilder.com/columns/perdue20030310.php3
--Katie |
|
|
|
Nov 23 2005, 07:53 PM
Post
#2
|
|
|
Pretty please? Group: Members Posts: 733 Joined: 28-November 04 From: Holland Member No.: 1,552 |
My codes sloppy but usually short, because I try to get everything as short as possible so there's less lines of code to comment to.
Anyway, sloppy code is especially a problem when doing Object Oriented Programming where you have to keep things a separate as possible so you can re-use any classes you've already written. I kinda have the tendency while writing classes that I kinda weave everything together. (I just started learning OOP a very short while ago). The main problem's laziness, it's kinda boring to comment every single block of code when it's meaning is obvious (for now at least |
|
|
|
Dec 12 2005, 02:30 PM
Post
#3
|
|
|
Cosmic Overlord Group: Members Posts: 550 Joined: 26-November 05 From: Chennai, India Member No.: 9,811 |
Slopy code? Do I?
Well, that is a question that I have to answer two fold. The reason is that I code for my job and I code for my hobby. As it is my responsibility to code at my job, and as my company already has a lot of processes in place, I am driven to write clean code. Since I wirte the code with the team, I cannot afford to write sloppy code. Everything is properly designed, commented, documented and reviewed. And tested. That results in a clean code - or atleast is supposed to. Now, when it comes to my own creations, taking it as a hobby, I go wild. Because I am sure, what I write, I never will use again. I always move to greener pastures, and want to learn new things. I rarely need to revisit the same code. So, the result is, it tends to be sloppy. I just burst into it, test it, correct it and test it, and the cycle goes on until I get a satisfactory code - but the end result is a shabby code. But on the other note, the lastest project I am undertaking as I pursue this hobby of coding, I have decided that I will try to stick to the Software Development Life Cycle as far as possible. I do not have much faith in this though. |
|
|
|
Dec 12 2005, 03:28 PM
Post
#4
|
|
|
the Q Group: [HOSTED] Posts: 1,022 Joined: 13-July 05 From: Lithuania, Vilnius Member No.: 7,059 |
I used to code without any comments for myself, but now when my work needs to be seen by others, I try to comment and write everything clean, the variable names, and so on.. the names of the files, the mysql fields and etc. because the code which only you can understand is almost useless for others.
|
|
|
|
Dec 12 2005, 08:09 PM
Post
#5
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 1,980 Joined: 16-August 05 Member No.: 7,896 |
I see that, at school, students have to write code. And they have to comment their codes. So, I see the guys, they write down their program, they test it, and then they comment it before submitting the code to the teacher.
So, getting used with comments is very important. |
|
|
|
Mar 27 2006, 11:28 PM
Post
#6
|
|
|
Premium Member Group: Members Posts: 292 Joined: 15-December 04 Member No.: 1,768 |
I see that, at school, students have to write code. And they have to comment their codes. So, I see the guys, they write down their program, they test it, and then they comment it before submitting the code to the teacher. So, getting used with comments is very important. I'm a CIS major and one of my professors emphasized this a lot. Commenting closing brackets, functions, variables, etc. I think it helped me a lot. Now he hired me as a independent contractor to help develop his software written in php. I found it very useful when dabbling in someone elses' code to have comments. As far as coding myself, I use comments, but not a lot. Tabbing is a must, especially in web development areas. I can't imagine reading a piece of "spaghetti" code now days. Example: CODE /*********************************** ****** function do_something() **** *********************************** Function to do something ..more details. Accepts 2 arguments to change something and enable something 1.)$argument1 : is some kind of flag 2.)$argument2 : displays a menu or something This function returns something as an int ***********************************/ function do_something($arg1, $arg2){/*Beginning of function do_something--i usually don't add this but helps for if statements and loops...keep it short and to 1 line though*/ here are the contents to do something.... }//!End of function do_something The closing bracket helps a lot, and the function information helps a lot if you're modifying someone elses' code. If you're coding for yourself these simple things can help if you plan on revisiting your code. If you're coding within a team you'll have to document pretty much everything. It pays to practice on your own code. I'm still learning but that's my $.02. Oops posted on old topic. Sorry, didn't read the date until after I clicked it. I saw this topic toward the top and assumed it was rather new. Sorry mod's/admin's. Won't happen again, I'll check dates from now on. =/ This post has been edited by minnieadkins: Mar 27 2006, 11:30 PM |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th September 2008 - 01:42 PM |