Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm wondering if it is worth reading language specifications/standard documents (e.g. The Java Language Specification) if you aren't going to write a compiler/interpreter for the language or something similar? I understand that reading such a book shouldn't be anyone's first exposure to the language, but it could be a great way to learn the finer details of it.

Have you ever bothered, and should others?

share|improve this question
3  
A language specification isn't meant to be read from cover to cover, it's simply a reference. –  Mahmoud Hossam May 18 '11 at 4:14

12 Answers 12

up vote 13 down vote accepted

It basically comes down to one fairly simple question: do you want authoritative, detailed knowledge of the language, or are you happy knowing it well enough to use it, realizing that there are probably parts you don't know well, and quite possibly other parts you don't know at all?

Basically, there are some people who seem almost born to be "language lawyers" -- they won't (can't) rest as long as there are even a few nooks or crannies in the language that they don't know and/or understand. Many of these gravitate toward relatively simple languages simply because learning more complex languages at this level of detail is often next to impossible for any one person.

For most programmers, that would be an utter waste of time -- they're quite happy and productive knowing enough of the language to be able to use it (reasonably) well. Beyond that, they simply don't care. The language is a tool, and as long as they can use the tool well enough for their purposes, the fact that there are other things they don't know is largely irrelevant.

share|improve this answer
3  
+1 for the last paragraph. That's what most programmers should realize - do they want to be a John Skeet (who knows everything about C# but next to nothing about anything else - haven't seen him answering SQL questions, for instance) or just a user but of many other technologies which makes the practice more practical and the life more interesting. –  user8685 May 17 '11 at 22:03
2  
@Developer Art: But Jon Skeet is god ;) –  Anto May 17 '11 at 22:04
1  
@sbi: I'd agree that the language (and its complexity) clearly is a major factor. Standard size doesn't necessarily mean a lot though. For example, the part of the C++ standard that covers the language proper is only ~400 pages long, whereas the Java language spec is ~500. While I don't really think Java is nearly the "cleaned up" C++ that some claim, I hardly believe it's 25% more complex than C++ either. –  Jerry Coffin May 17 '11 at 22:18
3  
@Developer Art - a bit harsh about Jon Skeet, he's got badges for everything (including SQL!) –  SHug May 18 '11 at 9:49
2  
@dietbuddha: I certainly don't mean to excuse ignorance, but in fairness, for most people it's less a question of whether they should learn something, than of what they should spend their time learning. Which will benefit a C++ programmer more: learning a new algorithm, or learning the exact rules used to choose which overloaded function to call for a given set of parameters? Keep in mind that if he normally has much reason to care which is called, he's probably abusing overloading anyway! –  Jerry Coffin May 18 '11 at 18:59

It's definitely worth reading it. Some languages such as C++ and Java and Python are complex enough that by reading the language spec you'll learn a lot about those languages and all the fancy syntax/semantic tricks they have.

I used to read the Scheme R5RS language specification on the bus ride to college because it was short and compact and I learned all the syntax and all basic functions available.

share|improve this answer

Perhaps it's just me, but this question makes no sense. Understanding the tools you use is the hallmark of a professional. The deeper the understanding, the better your ability to use the tool. To me it's a choice between being a dilettante or a professional.

Whenever I'm learning a new language the first thing I look for is the spec.

I've read specs for ANSI C, C++, Java, Scheme, Python and Javascript. I've forgotten most of C, C++ and Java details just because I don't use those languages often. Having read the specs I was a better programmer because I knew how to use the language better.

share|improve this answer

I don't normally put much stock in the Standard. The simple fact is that the Standard will not tell you to not use exceptions as control flow. It will not tell you not to use Singletons. It will not tell you how to design a maintainable class interface. It will not tell you why your application is crashing when you don't know why. You can have the most well-defined program in the world and it will still be horrific.

In my opinion, the simple fact is that the vast majority of programming challenge is not in making the language do what you want, it's knowing what the right thing is. As long as you know the basic language features, then it's going to be how to use them that counts.

share|improve this answer

The general answer is: Yes it is worth.

If you want to write portable code, it is mandatory.

For some languages, it is just unavoidable, e.g., Ada or perl.

Moreover, if you don't only write code but also read code from others, you'll eventually have to refer to the specification.

share|improve this answer

I think if programming in this language is your job and you want to take your job seriously you should read the language specification, especially when it is relatively easy and quick to read and to comprehend like the Java language specification although it has recently lost a lot of it's simplicity with generics.

But also if you plan to learn and eventually master a new language that you don't know yet it can be very insightful to read the specification of that language before you waste your time with it. I'm sure if more C++ developers would have read and tried to comprehend the C++ Annotated Reference Manual before they started to use it many would have run scared away from it.

share|improve this answer

Never

One should never read a language specification.

It's a total waste of time.

Great programmers are able to type random code, ask questions on Stack Overflow, and use the IDE to eventually write code that doesn't crash very often.

Don't waste time on understanding the language. Just find a great IDE with good autocomplete. Ask lots of SO questions. It's all anyone needs.

share|improve this answer
3  
Never? Not even if you're writing an interpreter/compiler? –  greyfade May 17 '11 at 23:15
1  
You nailed it! That's how it works. ;) –  x4u May 17 '11 at 23:56
4  
@greyfade: Never. Never trust facts. Stick with assumptions. –  S.Lott May 18 '11 at 0:44
5  
+1 for subtle sarcasm. –  dietbuddha May 18 '11 at 3:30
6  
what's subtle in that? –  Aditya P May 18 '11 at 9:09

If you are a hard core programmer in that language, and you need to be able to wring every subtle nuance from it, yes. There are clear returns on your investment of time in that case.

Otherwise, no. If you're not going to use the knowledge, it's certainly not going to stick with you. Language specs are about the dullest thing imaginable to read.

share|improve this answer

I find it useful when your run into a what the moment, but I find it hard to retain as a straight read. However when I have used after I didn't understand something it always furthered my knowledge a great deal.

share|improve this answer

For Java the language specification is intended to give a definite answer to any question about the meaning of a given source construct. Reading it as a learner is not recommended - instead a good teacher shows you all the traps and what they actually mean.

For an experienced developer the Java Puzzlers is really good to train your understanding of the dark corner cases.

share|improve this answer

The part of doc.python.org labelled "language reference" is extremely useful. The "data model" chapter particularly so.

share|improve this answer

In general it can be useful to understand certain tricky moments you encounter now and then.

But seriously, if mastering a language requires you familiarize yourself with its detailed specification, then perhaps the language is an unfortunate one. Similarly to the common saying, if you need a documentation for your application, then it is poorly designed.

share|improve this answer
    
This is precisely why I keep a copy of ECMA-262 handy. –  greyfade Jun 2 '11 at 19:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.