Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Program Structure

Author
Message
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 4th Jul 2008 22:02
I'm quite adjusted to it so it isn't very hard for me to read, but then you have to remember that the average person doesn't read through the header files anyway.

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 4th Jul 2008 22:06
It's the parameters. They're like parameters from hell.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 4th Jul 2008 23:11 Edited at: 4th Jul 2008 23:12
WinSock.h (aka HELL)


Just look at that beast. It's intimidating.

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 4th Jul 2008 23:14
Worst section:

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 4th Jul 2008 23:18
I think they should add some linebreaks in between large sections. That would make it much clearer.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 4th Jul 2008 23:40
Why exactly does it need to be clearer to you? I don't get it.

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 4th Jul 2008 23:45
I'm saying that code in general should be written neatly. Also, with so many people using the code, it should be neat. Even if just for Microsoft employees.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 5th Jul 2008 00:19
I'm not saying there's a really important reason, I'm saying, as professionals, it should be neat.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 5th Jul 2008 03:19
Where exactly isn't that winsock header neat? The whole thing seems to use a consistent format with correct indentation and each of the major sections are commented, all the define values are tabbed to the same position, same for the comments for them; I'd consider it to be quite neat.

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 5th Jul 2008 03:28
It gets points for consistency, but layout is the main issue that I have with it.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 5th Jul 2008 04:02
I'm sorry, but I must ask: why do they make the integer name in this loop _i instead of i?

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 5th Jul 2008 04:08
We didn't code those headers, how are we supposed to know? Besides that doesn't exactly affect the readability of it.

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 5th Jul 2008 04:09
I'm sure the fact that I'm fairly new to this makes it seem that much more complex. But it is a lot of code.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 5th Jul 2008 04:10
Quote: "We didn't code those headers, how are we supposed to know?"


Not what I meant. I was asking if there is some coding practice I don't know of that dictates this usage of underscores.

Quote: "Besides that doesn't exactly affect the readability of it."


Didn't say it did. Just asking.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 5th Jul 2008 04:50 Edited at: 5th Jul 2008 04:53
Personally, I dislike using i as a variable name, because it lacks a description. Of course, in for statements, it's not a big deal, because there is nothing to describe, and a generic variable is recyclable, so I suppose it's acceptable. _i has no specific meaning, just what the programmer wanted to use, to stay in line with some preset format.

EDIT: On closer inspection, it's actually __i; It has two underscores.


My site, for various stuff that I make.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th Jul 2008 04:57
Quote: "I'm sorry, but I must ask: why do they make the integer name in this loop _i instead of i?"


Because its a define, it can be embedded anywhere - and by using a totally whack variable name - it's pretty "unique"

(This is just an educated guess - I'm aware if the variable is instantiated in curly's its life is just in the curly's but... I digress)

Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 5th Jul 2008 08:10
It's data type is there typedef u_int. You think that has something to do with it?
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 5th Jul 2008 11:02
Quote: "We didn't code those headers, how are we supposed to know? Besides that doesn't exactly affect the readability of it."


I sure as hell can't read that.

Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 5th Jul 2008 12:18 Edited at: 5th Jul 2008 12:19
Quote: "nice thread - only one slight disagreement:

Quote: " functions should be quickly recognized, so making huge elaborate or descriptive names is not a good idea as you will likely be typing them a lot"

I agree to an extent - but intellisense does alot for you, and typical frequency of a function might be a guide to how cramped the name should be - for example - if you have a special function that isn't used a lot - a LONG name might be all the self documentation you need - where something used often... like ascii to integer (most people know of the atoi() function) then short names are a blessing.

Also - I think you might find some really good modular coding and gui examples here: http://code.google.com/p/darkgdkoop/

--Good Luck - and Good Question! code makes computers do things - design allows us to manage it for the long haul!

--JAson"


Yeah that's true. Just as a general rule of thumb is what I intended =)

I usually name functions using camelHump, starting with a lower case signifier depending on namespace or class. For instance, if I have a general purpose 4d struct in the Core namespace, I would name it something like "coreVector4" or something similar. Variables are similar, I name them according to where they are placed. Function arguments I start with "f" to signify function, so something like "fIndex".

I never cared for underscoring(_). Not a time thing really(oh noes! teh shift key!), just don't like the style =P CamelHump works efficiently and is easy for me, and usually others, to read.

Cheers


Tux is my guildmaster.

Login to post a reply

Server time is: 2024-09-30 01:27:43
Your offset time is: 2024-09-30 01:27:43