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.

DarkBASIC Professional Discussion / DarkCore: DarkBASIC Programming Ruleset.

Author
Message
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 12th Jan 2008 15:21 Edited at: 12th Jan 2008 15:23
Rule #14
Stop being a turd and posting new rules


Come see the WIP!
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 12th Jan 2008 15:30 Edited at: 12th Jan 2008 21:03
Quote: "Cash Curtis II:

Rule #14
Stop being a turd and posting new rules"


Its within the guidelines of Forum Rules. I have never insulted you or anyone else, I expect the same regard. If you don't like the topic, please ignore it. Sincere Thanks.

New to this thread? Please read the First Post OR the post Posted: 4th Dec 2007 08:22 about this unique approach to programming with DBPro. Some like it. Some don't! You decide... post your opinions.

Dewi Morgan
16
Years of Service
User Offline
Joined: 16th Jan 2008
Location: London, UK
Posted: 29th Jan 2008 15:17 Edited at: 29th Jan 2008 15:21
The certification idea seems largely pointless, but I like things like naming conventions, especially for things like libraries and DLLs.

As best practice guidelines for shared code, I agree with the concept.

My own coding style, built up over the years in order to reduce the amount of mental change I need to do when learning a new language, is like so. I do not stick to this religiously, I just consider it best practice.

- One true brace with 2 character space indents. No tabs anywhere.

- Reserve i, j, k for loop iterators, i being the outermost loop. If more than three iterators are to be used, 'l' should not be used for obvious reasons: instead use descriptive names. Which are a good idea instead of i/j/k in any complex loop anyway.

- Reserve x/y/z for coordinates where the meaning is clear.

- Reserve a/b for comparison functions and other situations where there are two elements to operate over.

- Avoid any other 1-letter variable names.

- Use suffixes:
x/y/z - coordinates
Ptr - pointer to a memory address.
Ix - index. Like Ptr, but for arrays rather than memory addresses. (I often use Ptr instead, here, though).

- Prefixes:
Global_ - yeah it's long, but that's partly to discourage me from using them.

- I tend to name functions package_verb_noun, eg chess_get_player_name, mysql_do_query. For methods, where the package is obvious from the object type, I omit the package name. Conversion functions are one exception, where I use package_noun_to_noun (omitting the verb "convert"). eg "system.date_to_timestamp"

- Global constants are in UPPER_CASE, functions in lower_case, variables in TitleCase.

- Avoid single-line program flow constructs as they can cause indentation bugs.

- Avoid block comments except when commenting out regions of code, as it can cause bugs when commenting out regions.

- Avoid non-dependent single-line command concatenation, like "sing(); dance();" Short-circuiting, dependant oneliners are OK though: "sing() && dance();"

- Avoid goto in languages where there are more readable alternatives for that particular use (break/continue, next/last, gosub/function).

- And the stuff I wrote on http://en.wikipedia.org/wiki/Programming_style as well.

Yet another game programmer
McLaine
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 1st Feb 2008 12:49 Edited at: 1st Feb 2008 12:54
Nice idea. Though I think you may need to taylor it somewhat. (As it seems you are with all this feedback)

Your ruleset should be more of a guide as suggested. The end result of a Game is never going to benefit from being 'coded to standards'. So pointless approaching this as a Certification. However, development time, and readability of code would definately be improved. This is of MAJOR benefit to team development.

Keep it much the way it is for a section aimed at team development. Have a seperate section showing good practise for beginers, perhaps including all the do's/do not's about GOTO/GOSUB etc. Maybe a third section for advanced tips.

Though maybe all that is beyond the scope of what you're trying to achieve

Naming conventions need to be much simpler and less restrictive.

I don't think an individual programmer is going to adhere to this rule set. After all, anything goes to get the final frame rate boost. but I think it could be valuable to those who do want to impose some kind of structure on themselves

It's not my fault!
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Feb 2008 08:28
Rule #1 for Team Development:

Use GOTO wherever possible to ensure job security later on. No one but you will know why the program works, and therefore they will need to keep you.


That's the theory anyway.


The one and only,
~PlystirE~

TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 2nd Apr 2008 14:20 Edited at: 2nd Apr 2008 14:22
Quote: "The "DarkCore Council" is an embarrassing idea. None of the rules were very well thought out. "


I was wondering if any DB Programmers were interested in participating in a experiment with me to implement the "DarkCore Rules and Council System". I have found weakness and strengths in using the system on personal basis, however, I desire to challenge the concept beyond myself. I believe this experiment would be healthy for DBPro and programming games in general. Interested? Email Me. Regards, TechLord.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 3rd Apr 2008 01:49
TechLord - this is a forum - so Please take this with a grain of salt.

I respect you as a coder and I respect this idea as well, however I don't wish to be a detractor from something that could benefit some folks - yet I feel like a soap box moment.

I'm EXTREMELY convinced of the importance of formatting code in such a way that it is both easy to read and easy to debug - especially after having not looked at in months - meaning I believe it shouldn't be cryptic. In this way, I'm a stickler.

Like was mentioned above by one of my latest additions to "Favorite coders here" (Dewi Morgan) - I to don't follow some of my own "rules" some of the time - but I try to follow ALL of them ALL of time... (Did that make sense?)

At work, time is sometimes the most important thing - getting it done - and I manage to do OK - but when the clock is not my enemy - I'm even more particular. In short (too late) if its not maintainable - its quality is limited.

The ideas you are learning - I learned like many others - through non-stop experience molding me towards better and better practices as I honed my skills at my ART.

YES PROGRAMMING IS AN ART! It's a MARTIAL ART in many ways. Many people can do it, only a rare few become black belts. Only those who keep practicing the art, keep their skills tuned! Its one thing to make pretty code, and another to make Efficient code - the ART is making readable, maintainable, EFFICIENT code. You can write neat code that is dog slow, and write nasty code that is blazingly fast: Trying to find that perfect balance - is an ARTFORM!

Dewi mentioned alot of things I do more or less - and MY BIGGEST ONE that's easy to explain - is the 2 spaces for indentation - NO TABS rule. Anyone who has actually written REALLY COMPLEX code - LEARNS this. Tabbing - 10 nest levels deep just looks ugly and is harder to maintain.. especially due to how most editors (when moving cursor around) act with spaces versus tabs. Spaces are your friend! Tab are like "Dr. E-Vil" from Austin Powers!

Also, the real issue I have with a "Council" and setting "Rules" is that it starts to leave the ART realm (in my feeble mind) and the reason is that RULES set a limit beyond those we already maneuver around with programming language, operating system, hardware limitations etc.

For example - GOTO? Rare - but sometimes - they are the best tool for the job! Void Pointers is C++ are ALWAYS talked about as TABOO but in the right hands - they are a POWERHOUSE of usefulness!

In short - my views of programming being an ART FORM and the creativity that is needed to get machines to do what we want - often when the odds are against it - like painting and sculpture - is something that should remain free - anything less seems regimented and boring.

Good Luck Either Way! I'm all for a guidlines - and "Best Practices Lists" and the like - because there is so much information out there that programmers can learn to better their skills with formatting and tricks, etc etc. I guess I just have an issue with the word "RULES" - because ART - can not and should not be limited to someone's arbitrary rules.

calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 8th Apr 2008 17:16
Quote: "Use of GOTO and GOSUB prohibited."


GOSUB allows you to compress and clean up your code, without it I would probably stop programming. I don't know what TechLord was thinking when he wrote that.

The optomist's right, The pessimist's right.
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 29th May 2008 18:32
Quote: "GOSUB allows you to compress and clean up your code, without it I would probably stop programming."


Please explain how GOSUB cleans up your code. For some reason I'm really having a hard time understanding this.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 29th May 2008 19:52 Edited at: 30th May 2008 00:39
If your methodology is to modularize your code in subroutines versus functions, then GOSUB would serve as the equivalent of calling functions, and indeed could make code more readble than the same tasks being done with GOTO.

Many of us would rather use functions to accomplish this, however, this does not make another system invalid if its maintainable and serving its purpose as designed.

The whole GOTO is EVIL and GOSUB's are lame arguments are really silly to me. I see "commands" and "software" as tools. Using a hammer when an air powered hammer [is available] might sound "lame" too.... until you see that the hammer is a better tool for [the] task at hand, while other tasks are better accomplished with the air hammer.

Either way... it just sounds silly to throw away the old hammer to me because... well.. it works, and it does [in this case] have one optimization advantage over a function call... less overhead as in assembly it boils down to 4 bytes in the stack, and two low clock cycle assembly language commands.. jsr and ret, Jump Subroutine and Return from Subroutine respectfully. The return address is pushed on the stack when jsr is called, and removed when ret is called.

Frankly,

If you've ever seen the Intel Instruction Set, and applications (This would most likely include all the software you run) LOL), you'd find: bne, beq, bgt, blt, jsr, jmp, ret, call and the various "flavors" of these... you'd see that there isn't even such thing as a true function call... well... closest is CALL, as you prep the stack with "parameters" ... funny thing is: intel orders these in "pascal calling convention" order versus "C/C++ calling convention" order.

In short, GOTO, GOSUB, and functions all have a roll in my tool box... I guess I'm just a newb... I've only been coding for 26 years now.

TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 29th May 2008 22:58
Quote: "The whole GOTO is EVIL and GOSUB's are lame arguments are really silly to me."
I agree and therefore removed this restriction from the DarkCore RuleSet.

sinisterstuf
17
Years of Service
User Offline
Joined: 28th Mar 2007
Location: Namibia, Southern Africa
Posted: 31st May 2008 20:01
Holy crap! I just read all of this and now I have to gouge my eyes out and slap myself in the face several times because programming is evil and I must punish myself for reading this.

Seriously though, you lot argue way too much. Much more than is necessary. The guy never said "these are new rules that were sent down to me from heaven and everyone in the whole world must obey them or else they will never be allowed to program again in their whole life because I say so and whatever I say goes because I am the master!" No one is actualy forcing you to follow these rules but if you like them then you can.

That said, I think that programming is more like math than art, despite how much it actually resembles art. Don't get me wrong though, because I absolutely LOVE math. The math teacher once told us the story of a math teacher who, when his student left math for art, said "I guess he just wasn't creative enough for math and picked art instead". Math is problem solving. You are given the problem and the equations, which are the math equvilant of jason p sage's tools in the box. Math has rules, which if you don't follow you won't get the correct result. But it also has guidlines, which if you follow make it a whole lot easier to understand the steps in solving the problem. This also reminds me of the forum. There are rules and if you don't obey them then the mods will 'take action against you' but there are also guidelines like putting your code in code boxes and not using text slang which just make it easier for other people to read you posts.

Now, I agree with jason p sage about the word 'Rule' because I think that these should be called guidelines instead of rules. Apart from avoiding the negative connotation, associated by many, with the word 'rule', 'guidline' also does allow for more freedom because you know you won't be struck by lightning if you find that a better solution for your snippet doesn't actually follow the guidelines.

However, I do think it would be handy for someone who is having trouble with their code, who can then post it on the forum and say "I wrote this following the DarkCore ruleset so those of you who are familiar with it might find it easier to figure out just what it is I've done here and are likely to be able to tell me what I've done wrong".

I apologise for writing so much but I just want to add that, being somewhat of a beginner with this, as someone like jason p sage has been programming for longer than I've been alive, I probably wouldn't be able to use this ruleset because it's a bit complicated to implement. Some of those things I have never used before and those that I have would be harder for me to do if I had to look up the way of writing my variable name in addition to just defining it.

Lastly, even though english is not really my first language, I think that Tech Lord has incorrect usage of the word 'whom' in his ruleset, a word which I believe should be used with a preposition such as with or to and should in this instance be changed to 'who'.

That is all, please try to be nice to eachother and respect to you all!

cheers

(\__/) When the going get stuf,
(O.o ) the stuf get's sinister
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 31st May 2008 23:29
Quote: "Please explain how GOSUB cleans up your code. For some reason I'm really having a hard time understanding this."


Consider a program with multiple loops, each of which will call a certain fragment of code. The code will access a lot of internal variables, so function calling would be impractical. Would you rather have 1 copy of the code, where you can easily edit it, or several copies throughout your source file, which, if you wanted to make improvements, would require painstaking work to change each one identically.

Secondly, it removes the need to have an immense loop, by allowing it to call subroutines.

The optomist's right, The pessimist's right.
bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 31st May 2008 23:47
Quote: "Consider a program with multiple loops, each of which will call a certain fragment of code. The code will access a lot of internal variables, so function calling would be impractical. Would you rather have 1 copy of the code, where you can easily edit it, or several copies throughout your source file, which, if you wanted to make improvements, would require painstaking work to change each one identically.

Secondly, it removes the need to have an immense loop, by allowing it to call subroutines."


Functions are far more useful though, since your able to pass values in the function call. (instead of setting local/global variables before the call).

For example, I'm working on one engine, and the code is comprised entirely of functions for different things, like character creation or map creation.

Now, if I want to implement some scripting language, I just set it up so you call a function right in the script.

Also, functions are much easier to follow. Think of this:

mapSizeX = 1000
mapSizeY = 1000
mapTileCountX = 100
mapTileCountY = 100
mapNumber = 5
GOSUB createMap

That's pretty ridiculous compared to:

success = CREATE_MAP(5,1000,1000,100,100)


Hurray for teh logd!
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 1st Jun 2008 09:58
Quote: "Functions are far more useful though"


Yes, I agree with that, and have written plenty of them myself. But what if you wanted a function to output multiple variables, without using globals?

I generally use functions for self-contained procedures that either calculate something or create/edit an object, image etc, but I use subroutines for complex procedures like AI, which would involve reading and writing to multiple variables.

The optomist's right, The pessimist's right.
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 1st Jun 2008 10:12
Quote: "But there ARE times where it is either the ONLY WAY or simply the BEST way for speed and/or simplicity."


It might be the best way for speed/simplicity, but it is never the only way: (the following code shows two alternative methods. One uses goto's, the other doesn't.



The optomist's right, The pessimist's right.
sinisterstuf
17
Years of Service
User Offline
Joined: 28th Mar 2007
Location: Namibia, Southern Africa
Posted: 1st Jun 2008 16:03
Ok, I know I suck and all but my understanding of these was that:

Functions are used almost as a way of making user defined commands so that you can save time if you want the program to carry out a series of commands based on the input and then possibly return a value. Like if you wanted to draw a million stickmen at different positions at various points in your program then you could make a "draw_stickman_at_xy" function.

Gosubs are for organising your code and can also be used to execute a series of instructions, at verious parts in your program, that do not necessarily require an input or outpu. For example, you could jump to various labels during your game setup to improve the readability of your code or you could have a "save_game" label which you could jump to from various places in your code and then return to where you were.

Gotos are for leaving the set of instructions or loop that you are currently at and going elsewhere in your code, possibly from various points in your program. For example if you finish the game, for whatever reason, you could jump to a menu asking you to quit or play again, from which you could either terminate the program or jump to the start of the game.

That's just what I thought and if I'm wrong then please tell me because as I might have mentioned before... I am n00b.

(\__/) When the going get stuf,
(O.o ) the stuf get's sinister
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 1st Jun 2008 18:20
Yes, these are what these are basically for, although if you wanted to jump back to the start of the game you would use a loop.

The optomist's right, The pessimist's right.
sinisterstuf
17
Years of Service
User Offline
Joined: 28th Mar 2007
Location: Namibia, Southern Africa
Posted: 1st Jun 2008 18:53
Oh, but the example I gave for that was simple, you could for example, jump to a specific level of the game...

(\__/) When the going get stuf,
(O.o ) the stuf get's sinister
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jun 2008 00:32
Quote: "But what if you wanted a function to output multiple variables, without using globals?"

You are still using globals - in fact it's worse than that because without functions all variables are globals.

Quote: "creating spaghetti code"

... and although this will probably upset calcyman, that's what his examples look like to me, especially the second one. There's a loop and some gosubs, and absolutely no need for either. Perhaps I'm just not understanding what he's trying to show here...

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 3rd Jun 2008 01:35
IanM - I thinnk its not that bad - I mean - if a (gosub'able) subroutine doesn't really need to pass variables, and works on some globals, and its used in a loop - the value of calcy's example still has value as it summerizes the loop (via subroutine name) and one can drill down to the details if they wish like a subroutine.

If the subroutines are used in various locations in the program, their value increases. If you add that calling a gosub is less stack overhead - AND he's not "presetting" a ton of variables prior to each iteration (defeating the cpu cycle gain) I think its decent.

That said, I don't use them much except in DBPRO where they have a "code reading" benefit for me - as I like in dbpro to have a INIT subroutine, that does all the global setup, and then have the program continue under the one gosub call (or one per file... badguyinit, soundinit etc) but in C++, or Freepascal, or VB6, or vba, I tend to go with the function/sub (sub meaning function that doesn't return a value, not a gosub'able routine) paradigms as IDE's are more friendly to it, and I like how functions work -

In fact I remeber when I first learned how to use my first function - I was estatic so many years ago....

Quote: "You mean I can call a gosub and get an answer? IN AN IF STATEMENT! WHOA!!!! No WAY!"


TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 31st Jul 2008 02:40
If anyone is interested, I will be posting source in my DarkMORG Thread which adheres to the DarkCore Ruleset. As I stated before the Ruleset is intended to be flexible, and I will be updating it with rules based on realworld issues I've encountered programming with DBPro.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Aug 2008 17:53
I think that this is an idea which should have been posted in the newbies section as they're the one who would benefit more from this. Also, I believe that the term RULEset is a misleading as these dont NEED to be followed in order for DBPro to work, therefore they're guidelines not rules.

My nextpoint about goto's and gosubs. I personally have never used either of these commands in any of my dark basic programs. GOTO because it introduces too much instability in my code (In such that code is designed to flow in one direction, gotos upset this rule and make things difficult to follow) Likewise, gosub is prettymuch a direct copy of a function, other than variables can be shared between then. Arguements that "do you want to duplicte code" are false as if you need to duplicate code in your functions, then your functions, and basic program design is flawed.

I use functions and never use goto/gosub. THis is a personal choice which I recommend to others, but don't demand. My code (In my opinion) is structured and efficient to the point that I have NEVER felt the need to use them as they're the "best option" They're only the best option if your basic program design is imperfect, as really good code will take this into account and code around it.

This is my little contribution and is my own personal opinions. The guides set by Techlord are a good idea to newbies and new teams as these are the people best suited for a simple and unified coding methodology. Experianced, or semi experianced coders need not follow this in my opinions.

Not bad work though.

3700+ Athlon 64 - Geforce 7600 GS - 2GbDDR2 RAM - 40Gb Hdd (In this pc) - Windows Vista Ultimate (x86)
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 3rd Aug 2008 18:10
Quote: "They're only the best option if your basic program design is imperfect, as really good code will take this into account and code around it."


This - I'm glad you qualified as just your opinion. Gosub - is like a funtion without stack overhead and is therefore faster.. this is fact.

Having a Goto - doesn't not mean your code is flawed - though - very easy to misuse... GOTO can alleviate writing extra code sometimes just to get that "Single entry/Single Exit" flow - A good example is file loading routines where you are parsing a ton of stuff... and you make the end of your function do a nice clean up... close file etc... with a label over the "close stuff" then as you're reading in data - if its bad - file no good - error - whatever - you goto the end of your function that does the nice clean up. This can save you a ton of "IF" statement like:





--Jason

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 4th Aug 2008 02:21
Quote: "Any Var labels assigned a Memory Address, include 'Ptr' Suffix."

Use a 'p' prefix - as is done by C and C++ programmers. It's quicker to type. It's faster to read (You notice that the variable is a pointer). And more people follow that.

I think the idea *can* be useful. And I think it's an interesting way for newcomers to organize their code (And we all know they'll post it). It at least shows an example of what is meant by "readability." Readability is important to both yourself and those looking at your code (should you post it).

I wouldn't call it a rule set though, rather a set of guide lines.

The certification idea should be removed though.


Cheers,

-naota

I'm not a dictator to those that do stuff for me by will. Only those who don't.
Bluestar4
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 4th Aug 2008 02:29
I think of all of us , that Jason is the most qualified to speak on and elaborate on the gosubs,functions, and gotos'but I would like to put in my 2 cents and to re-emphasise what jason said earlier : the right tool for the right job ! if any of you ever programmed in c+ you would understand quite clearly what he was talking about but since some or most of you dont I'll try to put this in standard english - goto can be bad or good, depending upon how its used. Every time you make a function call ,a gosub, a do-loop ,or a repeat-until your using a form of goto because you are in effect jumping addresses. now , as Jason pointed out, gosubs are faster, but cant return variables. functions can both recieve and return variables and can be very useful for quick returns of a commonly used routine. on the other hand goto simply jumps to another part of the program forgetting all that was before it - at the right place this can be a good thing, but in the wrong place can cause disaterous results such as objects that you forgot to clean up before the jump not being deleted and variables not being reset to default values, leaving you with a small to large headache by the end of the week. In a worse case scenerio where it used at the wrong place it could cause a recursive memory leak that eventually crashes both your program and your computer so my advice is to not use goto unless your absolutely certain that its the right tool for the job. Now , you could use a program with all functions and suffer a little speed, or you could use a mixture of gosubs and functions at the cost of a little spaugetti. Using a mixture of gosubs and functions may create a little spaugetti, but I personally prefer that because the trade off is good. Now a word from personal experiance, you may ask if I ever used goto and the answer is yes I have - and the result of the projects I used it in was a 67% failure all because of that little word called goto was put in the wrong place - the result was that being a noob at the time I did not understanding what was going wrong with my program or where the bug was and it seemed that everything should have worked fine,but there was a big bug somewhere. After many nights of step through line by line trace debugging, I attributed it to the compiler because it seemed like there was no other explanation and shelved the project for a little while. Weeks later I finally figured it out and removed the offensive goto and the program then ran fine. I hope that by sharing this that some poor noob will read it and not have to waste their time doing what I did - in short -> STay AWay from goto until your ready for it ! Stick to gosub and functions for now so that your productivity wont be hindered with the untraceable bug syndrome

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Aug 2008 04:35
(Thanx for the words BlueStar4)

Aaron - I personally like the lp (long pointer) prefix for straight up pointers - lpSomeVari... and the reason is I use p_ for parameters like this:

function MyFunction( p_lpMyPointerParameter ){

etc.

Just a thought. I'm defiantely down with hungarian stuff - but lately with intellisense anyways - I still do the p_ for a parameter - but have dropped the hungarian style iunless its a local variable.... for ease of reading - where as stuff that intellisense finds easy - I use that regular named so I can find in alphabetic list.

(don;t forget I'm in DarkGDK - in DBPro - I use hungarian style variable naming everywhere... (No intellisense)

--Jason

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 5th Aug 2008 02:33
@jason
Well, I've been dropping SOME hungarian notation as well. For example, I don't like the use of "dw" or "f" prefixes, etc. ('f' mainly because it can mean either "float" or "flag" (bool)). Instead I stick to 32-bit types since they're just as fast to be processed as the other types of lower bits. And I tend to know rather or not a variable is a float or not by its actual name (Ex, if it's a 3D vector and I have a member named "x" I'm fairly certain it's not a string... ). I can see why you like "lp" though, it makes sense. I prefer "p" because I don't like the notion of a "long pointer" since all pointers are long now, lol.

I also enjoy the use of "g_" for global variables and "m_" for member variables.

Nice to see someone else who enjoys proper coding conventions

Cheers,

-naota

I'm not a dictator to those that do stuff for me by will. Only those who don't.

Login to post a reply

Server time is: 2024-05-08 22:14:00
Your offset time is: 2024-05-08 22:14:00