酒仙网Java编码规范1.1详解

需积分: 10 3 下载量 193 浏览量 更新于2024-07-19 收藏 505KB PDF 举报
"酒仙网Java编码规范1.1.pdf" 该文件是酒仙网内部使用的Java编程规范,版本1.1,基于阿里巴巴集团的技术部《阿里巴巴Java开发手册》进行制定,旨在规范内部代码开发,禁止用于商业用途。这份规范详细列出了编程规约、命名规约等多个方面的指导原则,以提升代码质量、可读性和团队协作效率。 1. **编程规约** - 命名规约是规范的核心部分,强调了命名的重要性和规则。 - 禁止以下划线或美元符号开头和结束的命名,例如`_name`, `__name`, `$Object`, `name_`, `name$`等。 - 禁止使用拼音与英文混合或直接使用中文的命名,以确保代码的国际化和专业性。 - 类名应遵循UpperCamelCase风格,如`MarcoPolo`, `UserDO`,但领域模型的特殊命名如DO/BO/DTO/VO除外。 - 方法名、参数名、成员变量和局部变量使用lowerCamelCase风格,如`localValue`, `getHttpMessage`, `inputUserId`。 - 常量命名应全大写或全小写,单词间用下划线分隔,如`MAX_STOCK_COUNT`,以便清晰表达其含义。 - 抽象类以`Abstract`或`Base`开头,异常类以`Exception`结尾,测试类以被测试类名+`Test`结尾。 - 数组定义时,中括号被视为类型的一部分,如`String[] args`,而不是`String args[]`。 - POJO类中布尔类型的变量不应以`is`开头,以免引起序列化问题,如`isSuccess`应避免。 这些规约体现了良好的编程习惯,有助于提高代码的可读性、可维护性和团队一致性。遵守这些规范可以降低出错概率,提高代码质量,并促进团队间的有效沟通和合作。在实际开发中,每个开发人员都应该严格遵循这些标准,以实现代码的规范化和标准化。
2011-05-28 上传
Create cross-platform .NET applications for the browser Silverlight is a framework for building rich, browser-hosted applications that run on a variety of operating systems. Silverlight works its magic through a browser plug-in. When you surf to a web page that includes some Silverlight content, this browser plug-in runs, executes the code, and renders that content in a specifically designated region of the page. The important part is that the Silverlight plug-in provides a far richer environment than the traditional blend of HTML and JavaScript that powers ordinary web pages. Used carefully and artfully, you can create Silverlight pages that have interactive graphics, use vector animations, and play video and sound files. If this all sounds eerily familiar, it’s because the same trick has been tried before. Several other technologies use a plug-in to stretch the bounds of the browser, including Java, ActiveX, Shockwave, and (most successfully) Adobe Flash. Although all these alternatives are still in use, none of them has become the single dominant platform for rich web development. Many of them suffer from a number of problems, including installation headaches, poor development tools, and insufficient compatibility with the full range of browsers and operating systems. The only technology that’s been able to avoid these pitfalls is Flash, which boasts excellent cross- platform support and widespread adoption. However, Flash has only recently evolved from a spunky multimedia player into a set of dynamic programming tools. It still offers less than a modern programming environment like .NET. That’s where Silverlight fits into the picture. Silverlight aims to combine the raw power and cross-platform support of Flash with a first-class programming platform that incorporates the fundamental concepts of .NET. At the moment, Flash has the edge over Silverlight because of its widespread adoption and its maturity. However, Silverlight boasts a few architectural features that Flash can’t match—most importantly, the fact that it’s based on a scaled-down version of .NET’s common language runtime (CLR) and allows developers to write client-side code using pure C#.