Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
| |
|
|
You are not logged in. #1 2008-10-15 10:29:03
Naming ConventionsI am trying to make my life easier by sticking to some Naming Conventions: "The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman #2 2008-10-15 11:39:20
Re: Naming ConventionsHere is one I could never find a good solution for: "In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..." #3 2008-10-15 13:01:06
Re: Naming ConventionsQuestion: Last edited by Chewy (2008-10-15 13:02:31) #4 2008-10-15 13:06:39
Re: Naming ConventionsAs I look at Ricky's example, it looks like you two are talking about either C++ or Java with the { 's. I am not sure what naming conventions you should use, MathsIsFun, in regard to either of those languages. I am teaching myself some Java, and I like it so far. #5 2008-10-15 13:45:23
Re: Naming ConventionsNaming conventions are almost universal. Just about all programming languages allow variables with AZaz09_, and can't start with a number. "In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..." #6 2008-10-15 15:28:35
Re: Naming ConventionsThat's right, I am not being specific as to language (but we should be aware that many languages are case sensitive).
I have used newWeight and also TheWeight in cases like that ... it is somewhat annoying I agree.
I personally do not like putting the type in the name (like intBeans or charID) because if you need to change the type you then have to do variable renaming, and possibly miss one. "The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman #8 2009-05-16 00:18:41
Re: Naming Conventionsmy lecturer always says give it a name that means something because it will be easier to understand when reading over, in functions the first letter in the word should be in lower case but after that to have them startin with an upper case letter e.g getLengthOfArray(). he also believes that member data should start with m_ eg m_Data Theres only 10 type of people in the world Those that understand binary And those that dont #9 2009-05-16 08:17:23
Re: Naming ConventionsFor me "m_Data" looks ugly, just personal preference I suppose. "The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman #10 2009-05-16 18:28:46
Re: Naming ConventionsIt is ugly. I wouldn't use m_Data, a week later I wouldn't remember what it meant. Unless my proggie is heavily commented, I have no chance of understanding it later. In mathematics, you don't understand things. You just get used to them. 90% of mathematicians do not understand 90% of currently published mathematics. I am willing to wager that over 75% of the new words that appeared were nothing more than spelling errors that caught on. |