July 6, 2009 at 11:44 pm
Does anyone know of any usability studies or reference articles having to do with keyword capitalization and naming conventions in T-SQL? I was told by a former colleague that all lowercase with underscores for word separators (for example select column_name from dbo.table_name) were superior in terms of readability and ease of typing. The idea was that the average typist could type more code per minute using lowercase and underscore formatting than when using Pascal or Camel case for user-defined entities and that all lowercase keywords were somehow more readable and easier on the eye. This colleague never produced any of the supporting articles that he cited during our conversation so I left it at that point. That said, he was convincing however he has since moved on and Google has failed to uncover any articles on the subject despite my best efforts. Can anyone that can provide supporting reference documentation provide input on this topic? I am not looking for a religious or philosophical discussion here, no unsupported opinions please, zealots stay away...thanks for reading 🙂
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
July 7, 2009 at 12:04 am
I'm not a zealot, and i don't have any supporting documentation. What I will tell you is that you will get a lot of differing opinions on the matter.
I personally like case-sensitive collations, type key words in lower case, hate underscores and spaces in column names and table names, and use Pascal casing for names.
Now that I have had my say, I'm sure others will be along and post their thoughts as well.
Bottom line, it depends on what you prefer and the standards in place where you work. Sometimes you have to change to meet the standards where you work.
July 7, 2009 at 8:15 am
I'm not a zealot either, but I prefer all lowercase with underscores instead of Pascal or CamelCase for object names, although I do like uppercase key words.
I don't like case sensitive collations, but by using all lowercase and underscores I can handle case sensitive collations when it comes to object names.
The main thing to me is that an organization have a standard and everyone sticks to it. My current project someone else created the database objects and used Mixed_Case with underscores. I can't stand it, but when I create tables or columns I use that standard. Because I did the stored procedure development stored procedures are in all lowercase with underscores so we have slightly mixed standard.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 7, 2009 at 9:43 pm
With all due respect all the quasi-objective opinions and conjecture have been stated (and restated, and restated) at this point...does anyone know of any objective case studies (no pun intended) or research articles they can relay?
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
July 7, 2009 at 11:38 pm
No. It all comes down to company standards and/or personal preference.
As a former co-worker once stated, Standards are great and every one has one.
If SQL Server required all UPPER CASE keywords, then I would use them, as would every one else. SQL doesn't care, regardless of collation how the keywords are typed. It only cares abut case with regard to object names when the collation is case sensitive, as then A a.
Even when using a case-insensitive collation, I chose to type object names in the appropriate case. You will always see my code using all lower case characters when referencing system objects, such as sys.objects. If a case insensitive database has a object name such as dbo.ThisIsMyTable, that is exactly how I will type it even though dbo.thisismytable and dbo.THISISMYTABLE would also work. That is my preference. I just find it easier to read.
July 7, 2009 at 11:40 pm
It should be noted, iirc, that if you want to write code that will port directly to Oracle, all object names need to be created and typed in UPPER CASE. And that you will most likely use (_) underscores to separate words in object names to make them more readable. So you also have that to worry about. Of course, I'm not writing code like that as I work in a Microsoft centric shop.
July 8, 2009 at 12:05 am
I see this not as a SQL Server or Oracle problem, but as a human one. I am looking for evidence that supports that an approach to capitalization can make for more readable code and therefore make humans more productive in an environment that favors a particular approach over another. Something not based on opinion or preference and certainly not what a software company decided to implement. For instance there are areas of linguistics dedicated to how a languages can shape thought based solely on how the language is constructed. The written word is studied extensively, but I am not finding much in the way of research done on source code and how the format of it can impact productivity. Why aren't books printed in all caps? Can source code be compare to books? I have seen claims that the human brain can more easily consume words in all caps when those words are meant to be interpreted as symbols, and that claim inferred that keywords in a programming language could qualify as symbols making all caps the best way to go. I have also seen it stated that words in all lowercase are more easily read and digested by the human brain given that words in all caps tend to disrupt the eye and thought process rather than to allow the brain to read and understand the words naturally as it would any other printed text...see where I am going with this? Just looking for someone that knows of some science that has been applied to this topic.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
July 8, 2009 at 12:16 am
Most people on this site are practitioners not scientists. Not really sure you will find what you are looking for here.
Simple question for you though, would you read a 600 page book written in all capital letters? I wouldn't. Mixed case as appropriate is easier to read. Also, look at a post or email written in all caps, it feels like you are being yelled out.
July 8, 2009 at 12:23 am
Also, I can read code fine wether it is written in all lower case, all upper case, or mixed case. What I really want from some one writing code is consistancy. If you are writing all your keywords in all UPPER CASE, be sure all your keywords are in all UPPER CASE. If object names are mix cased, keep them mixed case through out the code. If system objects are in all lower case, please keep them in all lower case. Especially on a forum site like this, you never know what collation some one may be using on their system. You really should write your code in that case as if it might be run on a case sensitive system. At work, we run PeopleSoft which uses the Latin1_General_BIN collation (case sensitive) we also run an SIS system which uses a case insensitive collation. Don't change how you write things through out your code, that is what makes reading code more difficult.
July 8, 2009 at 7:29 am
Lynn Pettis (7/8/2009)
Simple question for you though, would you read a 600 page book written in all capital letters? I wouldn't. Mixed case as appropriate is easier to read. Also, look at a post or email written in all caps, it feels like you are being yelled out.
As you reference in your next post, a lot of that is convention. If books were always in upper case we would probably be comfortable with that. Would you be comfortable reading a book with every noun capitalised? Well I wouldn't, but isn't that how German does it? The OP (or, indeed, opc) may find academic research in the wider field of written language.
I have SQL2K5 with no fancy tools: if Intellisense (I gather it is in SQL2K8) or any of the Third Party add-ons default to a particular casing-style, that could become the standard simply because we all start using them. But the point about Oracle is significant: if SQL is meant to be a cross-database standard, in the absence of rules perhaps we ought to adopt conventions that make us write SQL that is more portable. (Then if only we could do something to force those Access [aaaah!] users to define sensible names for those objects they want moving to SQL Server...)
July 8, 2009 at 8:33 am
sigh
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
July 8, 2009 at 8:39 am
Ewan Hampson (7/8/2009)
Lynn Pettis (7/8/2009)
Simple question for you though, would you read a 600 page book written in all capital letters? I wouldn't. Mixed case as appropriate is easier to read. Also, look at a post or email written in all caps, it feels like you are being yelled out.As you reference in your next post, a lot of that is convention. If books were always in upper case we would probably be comfortable with that. Would you be comfortable reading a book with every noun capitalised? Well I wouldn't, but isn't that how German does it? The OP (or, indeed, opc) may find academic research in the wider field of written language.
I have SQL2K5 with no fancy tools: if Intellisense (I gather it is in SQL2K8) or any of the Third Party add-ons default to a particular casing-style, that could become the standard simply because we all start using them. But the point about Oracle is significant: if SQL is meant to be a cross-database standard, in the absence of rules perhaps we ought to adopt conventions that make us write SQL that is more portable. (Then if only we could do something to force those Access [aaaah!] users to define sensible names for those objects they want moving to SQL Server...)
Unless I start working in a shop where I need to write code that will run in both a SQL Server and Oracle database environment, I am not going to try write portable code. I work with with SQL Server, and I will write code that makes the most of that platform. If it isn't portable to MySQL, Oracle, PostgeSQL, DB2, Informix, etc, oh well. I don't see any need for that in the near or distant future where I work.
July 8, 2009 at 8:43 am
opc.three (7/8/2009)
sigh
I take it you are still hoping to get back to the question of existing research into what works better. Well, I suggested linguistics/language studies; you might look into User Interface work too - that's a huge field these days - where text styles and input will be looked at alongside pretty colours and form layout.
July 8, 2009 at 10:23 am
I have alluded to the fact that while much research has been done in the field of linguistics the findings may not be applicable to source code. My original question: "Does anyone know of any usability studies or reference articles having to do with keyword capitalization and naming conventions in T-SQL?" is geared towards discovering any efficiencies in choosing one convention over another. By specifically saying in T-SQL I mean that this is not just about readable text one would find in a book or magazine, but rather a question about a programming language.
Regarding readable text, this article http://en.wikipedia.org/wiki/Typography, in the first bullet of the list titled Some commonly agreed findings of legibility research include it states that Text set in lower case is more legible than text set all in upper case (capitals), presumably because lower case letter structures and word shapes are more distinctive however this article is focused on readable text, not source code, and it lacks citations in many places so validity is also an issue.
Joe Celko touches on the topic here http://joecelkothesqlapprentice.blogspot.com/2007/05/proper-case.html and he mentions Boumas, which are also mentioned in the Typography article, however the Typography article contradicts his assertion that Boumas are better. From the Wikipedia article: Studies distinguishing between Bouma recognition and parallel letterwise recognition with regard to how people actually recognize words when they read, have favored parallel letterwise recognition, which is widely accepted by cognitive psychologists.[citation needed]. Again, validity of the Typography article is in question.
PS Regarding your practitioner comment...how many computer scientists who are also SQL Server practitioners do you think peruse this forum?
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
July 8, 2009 at 1:22 pm
opc.three (7/8/2009)
I have alluded to the fact that while much research has been done in the field of linguistics the findings may not be applicable to source code. My original question: "Does anyone know of any usability studies or reference articles having to do with keyword capitalization and naming conventions in T-SQL?" is geared towards discovering any efficiencies in choosing one convention over another. By specifically saying in T-SQL I mean that this is not just about readable text one would find in a book or magazine, but rather a question about a programming language.Regarding readable text, this article http://en.wikipedia.org/wiki/Typography, in the first bullet of the list titled Some commonly agreed findings of legibility research include it states that Text set in lower case is more legible than text set all in upper case (capitals), presumably because lower case letter structures and word shapes are more distinctive however this article is focused on readable text, not source code, and it lacks citations in many places so validity is also an issue.
Joe Celko touches on the topic here http://joecelkothesqlapprentice.blogspot.com/2007/05/proper-case.html and he mentions Boumas, which are also mentioned in the Typography article, however the Typography article contradicts his assertion that Boumas are better. From the Wikipedia article: Studies distinguishing between Bouma recognition and parallel letterwise recognition with regard to how people actually recognize words when they read, have favored parallel letterwise recognition, which is widely accepted by cognitive psychologists.[citation needed]. Again, validity of the Typography article is in question.
PS Regarding your practitioner comment...how many computer scientists who are also SQL Server practitioners do you think peruse this forum?
Do you consider anyone with a degree in Computer Science a Computer Scientist? Okay, I must be a computer scientist then. Unfortunately, I don't work in an area that deals with the actual research in computer science. I work the real world where we have to apply our knowledge to meet user and business requirements. Most users and business don't really care if the code we write is in UPPER CASE, lower case, or Mixed Case has long as it does what they want.
As for most of us on this site, we probaly don't care either as long as those we work with or provide us with assistance (such as on this site) write code in a consistant manner so that it is easy to read. Changing case through out a long piece of code is distracting, as is failing to consistantly format one's code. We are more likely to help when code is well formatted using white space apporpriately versus code that is crammed together with little white space.
Again, I don't think you are going to find what you want here. My suggestion, go to the nearest Univeristy and talk to some of the professors there, you might have a better chance of finding what you are looking for there.
Viewing 15 posts - 1 through 15 (of 24 total)
You must be logged in to reply to this topic. Login to reply