Convention over Code is a design approach for programming languages where the conventional use of a feature is taken into consideration when defining the default semantics of the feature. Similar to Convention over Configuration, if a keyword can be implied by its absence due to convention, it becomes less a part of the idea the coder is expressing and a part of the hidden implementation.
A common, notorious example is found in Java and C#. We find the keyword public infused throughout a typical Java code excerpt, and in the case of methods it implies public scope access. In practice, more methods use public scope access than the other three: private, protected and package protected (which happens to be the actual Java default). While a matter of opinion and much debate by programmers that love to be explicit about everything, it is clear that leaving out scope access keywords altogether takes very little away from the actual expression of an idea in code, because it has nothing to do with the idea at all, it is an attribute of the implementation of an idea.
Convention over Code means we would make public the default for methods, and make better use of keyword Huffman coding in language design.
Famous quotes containing the words convention and/or code:
“Every one knows about the young man who falls in love with the chorus-girl because she can kick his hat off, and his sisters friends cant or wont. But the youth who marries her, expecting that all her departures from convention will be as agile or as delightful to him as that, is still the classic example of folly.”
—Katharine Fullerton Gerould (18791944)
“Faultless honesty is a sine qua non of business life. Not alone the honesty according to the moral code and the Bible. When I speak of honesty I refer to the small, hidden, evasive meannesses of our natures. I speak of the honesty of ourselves to ourselves.”
—Alice Foote MacDougall (18671945)