Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What human learning techniques can be applied to improve code layout?

Tags:

coding-style

Is it possible to use the results of studies made into human learning in order to identify how code might be laid out to improve comprehension?

Code layout wars almost always end up defending consistency and the prevailing style, but could there be ways of laying out code that are provably better than others?

like image 525
David Sykes Avatar asked Mar 19 '10 08:03

David Sykes


2 Answers

What is Code Layout to you?

On one hand there are these evil things called coding conventions, which place everyone in a corset. I loathe these and I believe we're far behind schedule to eliminate them. We can parse code and I do not understand, why our IDEs still display code based on the very textual format it is stored in. What's so hard in allowing each user set up his layout prefences and the IDE displays all source code accordingly? Most IDEs offer some kind of auto-format option, yet you often cannot customize how it works.

However, a far more interesting approach is whether our current point of view on source code is suitable for learning at all. Projects like Code Bubbles are pioneering a new way there. And then of course, we have model-based approaches which are often more accessible from a learner's point of view.

I'm afraid there is no definite answer to this question. In fact, if you can write down a detailed answer for it, don't forget to claim a PhD for it ;)

like image 106
Frank Avatar answered Nov 14 '22 07:11

Frank


Could there be ways of laying out code that are provably better than others?

Yes. This problem was studied extensively in the 1980s. You could read all about it :-)
A good university library should have Human Factors and Typography for More Readable Programs by Ronald M. Baecker and Aaron Marcus, published by Addison-Wesley in 1990.

like image 41
Norman Ramsey Avatar answered Nov 14 '22 06:11

Norman Ramsey