New topic: Object/function/variable naming guidelines
<http://forums.realsoftware.com/viewtopic.php?t=27992> Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message thoiz_vd Post subject: Object/function/variable naming guidelinesPosted: Mon May 11, 2009 9:22 pm Joined: Mon May 11, 2009 8:41 pm Posts: 1 I'm looking for some guidelines (or just opinions) about naming. All examples of RB code I can find, differ in when capitalization is used and/or in the clarity of names for objects, functions, variables and so on. This is just a very small selection of an awful lack of consistency I sense. When to use caps and when not? When to keep names very brief, like using strings called just 's', and when to come up with 'InterestinglyNamed'? Prefix it and make 'sInterestinglyNamed'? Shouldn't objects like an EditField be prefixed with 'o(bj)' then either? Rather extend it to 'InterestinglyNamedString'? Make the first character lowercase, like sometimes in functions? 'interestinglyNamedString'? Sometimes there's 'mySub', while 'MsgBox' in it is written with a capital M. There's even 'If' and 'End If' with 'then' (lowercase) in between. Please show me the logic or give me anything to hold on to. Last edited by thoiz_vd on Mon May 11, 2009 10:17 pm, edited 1 time in total. Top kendoll Post subject: Re: Object/function/variable naming guidelinesPosted: Mon May 11, 2009 9:56 pm Joined: Mon Jul 17, 2006 10:39 am Posts: 1430 My opinion is that it doesn't matter a great deal what naming conventions you have, so long as the names chosen are appropriate, and the conventions are kept consistent. Do what feels natural to you, but be consistent about it. _________________ Kenneth McCleary UPshift Studios http://ken.upshiftstudios.com/ Top timhare Post subject: Re: Object/function/variable naming guidelinesPosted: Mon May 11, 2009 9:57 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 5302 Location: Portland, OR USA This is really a matter of personal preference and local custom. Every place I have worked has had their own unique naming scheme. In addition, there are several well known naming systems. You can find them on Wikipedia, etc. It depends on what you are programming and who you are programming with. Naming schemes are all about trying to communicate information on the one hand, and being memorable/derivable on the other. They exist to help you, and those working with you, be more efficient and productive. Bottom line: do what works best for you, unless you must conform to somebody else's system. Try a couple of different systems out and keep what works and let the rest slide. Tim Top tomis Post subject: Re: Object/function/variable naming guidelinesPosted: Mon May 11, 2009 11:54 pm Joined: Thu Jul 27, 2006 6:31 pm Posts: 1456 Location: Monterey, CA I usually use Hungarian Notation for my variable/object naming: http://en.wikipedia.org/wiki/Hungarian_notation I find it helps me keep things organized. But as others have said, use whatever makes sense for you. _________________ ImagePlay Effects Library (40+ image effects in one open source module. No plugins, no dependencies, no restrictions.) http://imageplay.sourceforge.net/ Top npalardy Post subject: Re: Object/function/variable naming guidelinesPosted: Tue May 12, 2009 12:00 am Joined: Sat Dec 24, 2005 8:18 pm Posts: 4851 Location: Canada, Alberta, Near Red Deer I've never liked Hungarian for the reason that it embeds type info into something I had to maintain a pile of VB code that had variables named this way and it was confusing as hell when the variables that were supposed to be integers held floating point values Turns out the type had been changed in the declaration but the name had not been updated as well as it was too much work for too little pay back I tend to try and use names that indicate purpose only _________________ My web site Great White Software RBLibrary.com REALbasic learning Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 5 posts ] -- Over 900 classes with 18000 functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v8.1. <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml> [email protected]
