请输入您要查询的百科知识:

 

词条 Convention over Code
释义

  1. See also

{{Multiple issues|{{Orphan|date=March 2018}}{{Unreferenced|date=March 2008}}
}}

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.

See also

  • Convention over Configuration
  • Ruby on Rails
  • Spring Framework

1 : Object-oriented programming

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/26 0:20:26