Page 1 of 1

Programming languages and natural langauge/cognition

Posted: Wed Dec 16, 2009 12:29 pm
by madeofstaples
Not sure if this belongs in "General Ramblings" or even the Auto-Delete forum, but I just read this fascinating research paper which discusses the implications of natural language and human cognition on both making code readable, and perhaps designing better programming languages.

Here's an excerpt from the "Conclusions and Future Work" section at the end of the article:
Modern software is incredibly complex. The source to Microsoft Windows XP has 40 million lines of code [21]. The Linux 2.6 kernel weighs in at 6 million lines [32]. Managing this kind of complexity requires that programmers draw deeply upon all their cognitive abilities. We have discussed several ways in which programmers select and use names in cognitively motivated ways. Lexical and morphological conventions convey basic information about a name's role, while metaphors encourage productive inferences drawn from other domains of experience. The grammars of natural languages shape name use in intricate ways, and polysemy appears as overloading with attendant debates over literal versus metaphorically extended meaning. Throughout, we find that programmers leverage fundamental aspects of cognition and natural language comprehension to make code easier to read and understand.

Practical considerations have motivated us to narrowly study the role of naming in imperative languages. If we were to expand our scope, we might ask how increasingly linguistically sophisticated programming languages have changed the cognitive burden on programmers. Conversely, we might ask how language designers could better support programming as a cognitive, communicative task. Should programming languages provide linguistic support for anthropomorphism as indicated by Herbsleb's study of metaphors used to describe software behavior[13]?

Programming is a sophisticated intellectual process that combines aspects of natural language with the regular structure of formal mathematical thought. The study of programming truly has the potential to contribute valuable perspectives to current research in linguistics and cognition.
Liblit, B., Begel, A., Sweeser, E.: Cognitive perspectives on the role of naming in computer programs. In: Proceedings of the 18th Annual Psychology of Programming Workshop, Sussex, United Kingdom, September 2006, Psychology of Programming Interest Group (2006)

Full Article

Enjoy

Re: Programming languages and natural langauge/cognition

Posted: Thu Dec 31, 2009 11:10 am
by fara7at
However, if you look closely at the visual programming tools, you'll find that what's really happening is that the same programming example, earlier, is just being represented in a visual form. You still need to know how to describe the sort procedure in a mathematically defensible way and use various statements and control structures of the development environment to implement what you want.

Re: Programming languages and natural langauge/cognition

Posted: Thu Dec 31, 2009 4:31 pm
by madeofstaples
I'm not exactly sure what you are saying... that paper doesn't talk about the design of the tools for using a programming language, but the design/organization of an application's code, itself.
fara7at wrote:You still need to know how to describe the sort procedure in a mathematically defensible way
The sort procedure (or was that a typo)? I'm first going to take the assumption that the sort procedure is something already implemented and provided by a certain language's standard libraries. If that's the case, then why should the application programmer need to "describe [it] in a mathematically defensible way"? Unless the programmer suspects something is wrong or that the algorithm used is not optimal?

If the sort procedure is an application-defined procedure, then only those who have worked on the part of the application which implements "sort" should really care about how it is implemented.
fara7at wrote:and use various statements and control structures of the development environment to implement what you want.
? Yes, I guess... but this paper isn't saying that this required knowledge should/could be removed from the responsibility of the programmer...

Sorry if I'm misunderstanding you.