By Kingsum Chow, Sanhong Li and Jianmei Guo
Introduction
Alibaba Java Coding Guidelines (AJCG), which consolidate best programming practices over the years, are now publicly available. To increase productivity, Alibaba released a suite of Integrated Development Environment (IDE) plugins to automatically scan source code, detect issues incompatible with AJCG, and fix some anomalies with just one click. On October 14, it was released on Github at https://github.com/alibaba/p3c.
Alibaba Java Coding Guidelines (AJCG)
When we are working on a large software project, how we express something may be critical to the quality of code. At Alibaba, many Java programming teams have been adopting a set of conventions that define a common coding vocabulary to make code easy to understand and maintain. AJCG consolidates the best programming practices over years. It covers diverse topics such as programming specification, exception and logs, MySQL rules, project specification, and security specification.
AJCG is not the only way to write Java, or even the best. But we hope that it is a set of coding guidelines for readability and consistency, which facilitate software quality.
IDE Plugin Support for AJCG
To use AJCG, Alibaba recently released an open-source project, called P3C, which offers tool support for AJCG. P3C consists of three parts: an implementation of the static code analyzer PMD, IntelliJ IDEA plugin, and Eclipse plugin.
P3C automatically scans source code, detects anomalies incompatible with AJCG, and fixes some anomalies with just one click. As shown in Figure 1, P3C categories anomalies into three types: blocker, critical, and major. After scanning the source code, P3C detects the anomalies and lists them separately in terms of the three types. For each type, we can see the error messages and guidelines. In particular, for some anomalies, P3C can fix them automatically.
Recently, Alibaba has established a long-term plan to maintain and improve the plugin support, and we welcome any contribution to the project. With the community support, we hope that AJCG can help many more Java programmers outside of Alibaba.
Figure 1: P3C automatically detects anomalies incompatible with AJCG
About the Authors
Jianmei Guo is currently a Senior Advisor at Alibaba Systems Software, focusing on hardware-software co-optimization for system performance. Before coming to Alibaba, he was an Associate Professor of Computer Science and Engineering at East China University of Science and Technology. He received his Ph.D. in Computer Science and Engineering from Shanghai Jiao Tong University in 2011, and worked as a Postdoctoral Fellow at the University of Waterloo from 2012 to 2015. He can be reached here: https://www.linkedin.com/in/jmguo/
Sanhong Li is JVM lead at Alibaba. He has been working on Java since 2004. In 2014, he joined in Alibaba to lead the development for Alibaba JDK, a customized OpenJDK version. Sanhong Li has presented at local and international conferences such as JVM language summit, JavaOne and QCon. He co-leads Shanghai Java User Group and co-chairs APMCon. He has authored over 10 technical papers and a number of technical patents.
Kingsum Chow is currently the Chief Scientist for Alibaba System Software Hardware Co-Optimization. Since receiving PhD in Computer Science and Engineering from the University of Washington in 1996, he has been working on performance, modeling and analysis of software applications. He has been issued more than 20 patents. He has delivered more than 80 technical presentations. He joined Alibaba in 2016. He can be reached here: https://www.linkedin.com/in/kingsumchow/
Benchmarking AI models from an ethical angle involves ensuring that the evaluation processes promote fairness,...
Find out moreIn his talk on "Fake News: easier to detect with sentiment analysis," Sanjaikanth E. Vadakkethil...
Find out more