Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 730 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Real Programmers... [Re: Inestical] #317699
04/01/10 20:58
04/01/10 20:58
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Yeah, barely any of my code has comments on it. It makes it hard to go back to something a couple years back, but if you keep up with your knowledge, it all comes back within 5-10 minutes. laugh


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: Real Programmers... [Re: William] #317975
04/03/10 23:04
04/03/10 23:04
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
The quote is a joke, Will. If you don't comment your code, others will have an impossible time understanding what it does. Also, it gets tiring trying to remember what significance FLAG2 has in your function after you've been absent from your code for a while.

Personally I've made it a habit to make a comment every time I do anything significant. If I turn on FLAG2, I make a comment. If I manipulate a vector with the "vec_" functions, I make a comment. Generally you should make comments that streamline the steps the computer should be going through in your function, such that if you read nothing but the comments in your function it should be clear what you're trying to accomplish.


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Real Programmers... [Re: Redeemer] #318023
04/04/10 11:20
04/04/10 11:20
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Guess I have mutated to an unreal programmer frown

Re: Real Programmers... [Re: FBL] #318068
04/04/10 19:54
04/04/10 19:54
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
If you are a lone wolf it might be the case that you take less benefit from exhaustive commenting than if you work with others. What I have learned during programming for my bsc thesis, is that if you properly select the names of your variables, functions, methods, classes, interfaces etc.pp. you get your code very well self-documented. It doesn't mean that you should'nt do comments, though, of course... ;-)

Re: Real Programmers... [Re: HeelX] #318071
04/04/10 20:04
04/04/10 20:04
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Captain_Kiyaku Offline

Dichotomic
Captain_Kiyaku  Offline

Dichotomic

Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
Exactly what HeelX said, plus if you comment TOO many lines, your code will become unreadable. You can easily over see small lines of code (i=0; for example) and so on.

I just make comments when i get the feeling that i could forget what this code does. And i often give a comment line to every function/class i declare, just to be 100% sure what function it is.


My Blog

"Tag und Nacht schrei ich mich heiser,
Wind weht alle Worte fort,
Tag und Nacht schrei ich mein Krähenwort!"

Subway To Sally - Krähenkönig
Re: Real Programmers... [Re: Captain_Kiyaku] #318073
04/04/10 20:16
04/04/10 20:16
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
HeelX is right. The code should also speak for itself. Otherwise it is too complicatedly written. No need to comment what function PLAYER_GetName() does.

Last edited by Joozey; 04/04/10 20:18.

Click and join the 3dgs irc community!
Room: #3dgs
Re: Real Programmers... [Re: Joozey] #318077
04/04/10 20:35
04/04/10 20:35
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
i usually cooment, when i need //TODO , to add features toa function.. or
//Improve optimization
//or examplain, int a is a skill means "exame : area" send from the caller function...

or that sort of things..

Re: Real Programmers... [Re: MMike] #318082
04/04/10 21:13
04/04/10 21:13
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Well the comments I do mainly are for auto generating documentation (I'm working on a template project).

All other comments are for my own understanding. I have coding guidelines, naming conventions and pick meaningful names, but still I explain some algorithms with comments because otherwise I would not understand anymore what I'm doing there.

Re: Real Programmers... [Re: FBL] #318555
04/08/10 13:00
04/08/10 13:00
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline

Serious User
TWO  Offline

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
For people not commenting at all or having a 1:1 comment code ratio I would advice you to grab a good book. 'Clean code' for instance introduces nicely to self commenting code (like HeelX said) by naming things right.

Re: Real Programmers... [Re: TWO] #318669
04/09/10 04:56
04/09/10 04:56
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
I agree with HeelX, I generally don't comment most of my code. I'm anal about the design of my code, I like to make it look pretty and it needs all of the indentions to be correct or else you can't tell where each thing begins and ends, but I also use variables and functions that are easy to read. I don't ALWAYS comment, but I might every once in a while.

Here's a random code example from Kino One:

Code:
function skinchange()
{
	var hp;
	var newhp;
	while(me)
	{
		newhp = my.health;
		if (newhp < hp)
		{
			my.skin = ent_skins(me);
			wait(1);
			my.skin = 1;
		}
		hp = my.health;
		wait(2);
	}
}



You might not understand exactly what the code is for at first glance, but you do understand what it does. The code reads: "check the enemy's health, if the enemy's health is lower now than it was two frames ago, change the enemy's skin to his last one". At very first glance it doesn't look that way, but because of the name of the function and variables you can tell what the variables hold and what the function is supposed to do.

The code is used for flashing enemy models to their last skin which is a "white" skin used to achieve a "flashing" effect when an enemy is damaged.

My big problem is though, because of my lack of commenting a lot of times when you look at some functions you can't really tell what the variables are for, but I generally do that after working on a game for a while, and for prototyping, but when prototypes make it in the final game then the variables might be the same. It does make some things confusing, but for most global variables I TRY (don't always do) to make the variables understandable.

Last edited by mpdeveloper_B; 04/09/10 05:03.

- aka Manslayer101
Page 2 of 3 1 2 3

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1