Page 2 of 2

Posted: Fri Dec 08, 2006 7:48 pm
by elDiablo
Javadoc is AWESOME! Pure and simple. If used correctly :P Just look at the Java API to see what type of comments you should use. It's schmexy!

And alphager: i++ does what now?! :shock: :o

Just kidding, and fair point. I shall make a trade. LOTS of USEFUL comments! No need to comment every line of code (though we've been taught to write at least 1 line of comments for every line of code - yeah right...), but 3-4 lines of comments (even in one block) for every 10ish lines of code is usually a good rule... Especially if it's complex stuff. 20 lines of array manipulation can easily be commented with "Manipulating the array to do BLAH".

Posted: Sat Dec 09, 2006 4:35 pm
by wwarnick
For C#, I'd recommend Beginning Visual C# 2005 by Wrox or Professional C# 2005 by Wrox depending on your programming proficiency.

I'd have to agree with elDiablo about comments. I think javadoc definitely has its purposes. However, C#'s autodoc (not sure if VB uses it) is even more useful because it incorporates your comments into Intellisense. I also think too many comments can clutter your code and be distracting. Comments should be concise and useful. I think saying that "i++" increments in a comment is stating the obvious and it draws attention to an unimportant piece of code. However, I won't go so far as to say my preference is universal.

wwarnick

Posted: Sat Dec 09, 2006 7:17 pm
by Montyphy
Recently, I was amused to find the following comment in a friend's assembly code:

Code: Select all

inc a          # inc a

Posted: Sat Dec 09, 2006 10:52 pm
by TheRaven
elDiablo is right about the Java API being a good basis of how you should document code, although it's a massive headache I find to do it. Also it doesn't tell you what individual bits of code are doing. At the moment a lot of my comments consist of '//fix this when I hate the world less' or comments telling my course tutor not to bitch because I know something's inefficient or just plain stupid. But yeah commenting so you understand what the hell it does is useful. Also thanks guys for all the books I'll make sure to check some of em out.

Posted: Sat Dec 09, 2006 11:04 pm
by NeoThermic
Montyphy wrote:Recently, I was amused to find the following comment in a friend's assembly code:

Code: Select all

inc a          # inc a


If it was difficult to write, it should be difficult to read! ;)

NeoThermic

Posted: Sat Dec 09, 2006 11:14 pm
by Stewsburntmonkey
Montyphy wrote:Recently, I was amused to find the following comment in a friend's assembly code:

Code: Select all

inc a          # inc a


Assembly code is the only place I think line by line comments are proper. When I used to write assembly stuff I would comment every line and when I went back I would ignore the code and just read the comments, so a comment like the above often appeared in my code just to keep the comments complete. :)

Posted: Mon Dec 11, 2006 10:49 pm
by tabasco boy
NeoThermic wrote:I would wager there isn't a single person who touched the DevDisk who doesn't get nightmares about the code....

Then again, I do look back at some of my A-level stuff and cringe.

Regardless of what language you decide to fly with, always learn and stick to a decent set of coding standards, and use them exclusively. Not only will it make your code far more maintainable by yourself (you won't wake up to code and go "who the hell coded this?!" only to realise a few seconds later it was you), but others will be able to pick your code up without much problem.

NeoThermic


i'm still so traumatised about the DevDisk i had to stay in our naval ship and scrub the decks, paint and do some watches (guard) just to keep my mind away from it....

ohhh damn there here again don't let them make me wear that straight jacket PLEEEEESE. :shock:

Posted: Tue Dec 12, 2006 6:00 pm
by prophile
PHP - I learned PHP from PHP and MySQL Web Development (Luke Welling/Laura Thompson)
C++ - I learned C++ from looking at open-source projects and being taught by Miah Helpmann
C - The C Programming Language (K/R)
C# - avoid

Posted: Tue Dec 12, 2006 7:59 pm
by wwarnick
prophile wrote:C# - avoid

Wrong answer. .NET is different. It's a new idea and most programmers are wary about it. That's understandable. But it's not worse or better. It's different.
If you want to be a game developer, avoid it because it has a slight performance decrease. Otherwise, I'd recommend it. With most applications, you won't even notice the decrease.

wwarnick