i**p 发帖数: 902 | 1 In a code review, one colleague mentioned someone's JAVA code is in C coding
style, and need to change. I don't think coding style is a serious issue,
unless the project has the specific request.
What do you think?
Here is an example, which is said a C coding style in a JAVA code. a, b, c,
d, e are in C style.
public class Example
{ // a
public static void main(String[] args)
{ //b
int i;
...
if ( i > 10 )
{ // c
...
} // d
else
{ // e
...
}
...
}
} |
p*****2 发帖数: 21240 | |
w**z 发帖数: 8232 | 3 什么意思?
coding
,
【在 i**p 的大作中提到】 : In a code review, one colleague mentioned someone's JAVA code is in C coding : style, and need to change. I don't think coding style is a serious issue, : unless the project has the specific request. : What do you think? : Here is an example, which is said a C coding style in a JAVA code. a, b, c, : d, e are in C style. : public class Example : { // a : public static void main(String[] args) : { //b
|
T****U 发帖数: 3344 | 4 you can use checkstyle
http://checkstyle.sourceforge.net/
but i think your way of using braces are fine with java
coding
,
【在 i**p 的大作中提到】 : In a code review, one colleague mentioned someone's JAVA code is in C coding : style, and need to change. I don't think coding style is a serious issue, : unless the project has the specific request. : What do you think? : Here is an example, which is said a C coding style in a JAVA code. a, b, c, : d, e are in C style. : public class Example : { // a : public static void main(String[] args) : { //b
|
w**z 发帖数: 8232 | 5 你是说括号不另起一行?
【在 T****U 的大作中提到】 : you can use checkstyle : http://checkstyle.sourceforge.net/ : but i think your way of using braces are fine with java : : coding : ,
|
g*****g 发帖数: 34805 | 6 Yes, coding style is important, because code is meant to share. Java coding
convention has been there since early days and it's been well known in
industry.
http://www.oracle.com/technetwork/java/javase/documentation/cod
If you are using an IDE like eclipse, formatting your code is one shortcut
away, ctrl+shift+F.
coding
,
【在 i**p 的大作中提到】 : In a code review, one colleague mentioned someone's JAVA code is in C coding : style, and need to change. I don't think coding style is a serious issue, : unless the project has the specific request. : What do you think? : Here is an example, which is said a C coding style in a JAVA code. a, b, c, : d, e are in C style. : public class Example : { // a : public static void main(String[] args) : { //b
|
c*********e 发帖数: 16335 | 7 一个公司里面的code style要一致,这个是常识。当然,每个公司可能都不一样,但是
,进了一个公司,就要遵守一个公司的code style.
coding
,
【在 i**p 的大作中提到】 : In a code review, one colleague mentioned someone's JAVA code is in C coding : style, and need to change. I don't think coding style is a serious issue, : unless the project has the specific request. : What do you think? : Here is an example, which is said a C coding style in a JAVA code. a, b, c, : d, e are in C style. : public class Example : { // a : public static void main(String[] args) : { //b
|
f******n 发帖数: 314 | 8 coding style is very very important. |
i**p 发帖数: 902 | 9 The company does not have a code style request. Almost everyone has his own
style.
【在 c*********e 的大作中提到】 : 一个公司里面的code style要一致,这个是常识。当然,每个公司可能都不一样,但是 : ,进了一个公司,就要遵守一个公司的code style. : : coding : ,
|
i**p 发帖数: 902 | 10 Yes, you are right. The reviewer expects the code like this, which he means
the Java style.
public class Example { // a'
public static void main(String[] args) { //b'
int i;
...
if ( i > 10 ) { // c'
...
} else { // d'
...
}
...
}
}
【在 w**z 的大作中提到】 : 你是说括号不另起一行?
|
|
|
p*****2 发帖数: 21240 | 11
means
就应该这样
【在 i**p 的大作中提到】 : Yes, you are right. The reviewer expects the code like this, which he means : the Java style. : public class Example { // a' : public static void main(String[] args) { //b' : int i; : ... : if ( i > 10 ) { // c' : ... : } else { // d' : ...
|
c*********r 发帖数: 2733 | |
c*********e 发帖数: 16335 | 13 那肯定是小公司。
own
【在 i**p 的大作中提到】 : The company does not have a code style request. Almost everyone has his own : style.
|
T****U 发帖数: 3344 | 14 i recommend gannam style
means
【在 i**p 的大作中提到】 : Yes, you are right. The reviewer expects the code like this, which he means : the Java style. : public class Example { // a' : public static void main(String[] args) { //b' : int i; : ... : if ( i > 10 ) { // c' : ... : } else { // d' : ...
|
z***s 发帖数: 3241 | 15 这个东西能不能自定义个什么东西,配置在ide里面,不符合的话报错?比如{不能单独
一行。
好比eclipse可以定义java什么是warning什么是error。
coding
【在 g*****g 的大作中提到】 : Yes, coding style is important, because code is meant to share. Java coding : convention has been there since early days and it's been well known in : industry. : http://www.oracle.com/technetwork/java/javase/documentation/cod : If you are using an IDE like eclipse, formatting your code is one shortcut : away, ctrl+shift+F. : : coding : ,
|
g**e 发帖数: 6127 | 16 http://checkstyle.sourceforge.net/
【在 z***s 的大作中提到】 : 这个东西能不能自定义个什么东西,配置在ide里面,不符合的话报错?比如{不能单独 : 一行。 : 好比eclipse可以定义java什么是warning什么是error。 : : coding
|
e*****t 发帖数: 1005 | 17 eclipse can auto format your code.
【在 z***s 的大作中提到】 : 这个东西能不能自定义个什么东西,配置在ide里面,不符合的话报错?比如{不能单独 : 一行。 : 好比eclipse可以定义java什么是warning什么是error。 : : coding
|
z***s 发帖数: 3241 | 18 这个刚才我看了,没有细看。
又看了一下,貌似很强大,连命名规范都要管。
【在 g**e 的大作中提到】 : http://checkstyle.sourceforge.net/
|
z***s 发帖数: 3241 | 19 要得不完全是这个效果,而是约束。不符合规范就不能编译或者不能提交。
【在 e*****t 的大作中提到】 : eclipse can auto format your code.
|
g*****g 发帖数: 34805 | 20 It's possible to bundle that into your build system. aka. a jenkin plugin,
though most teams don't take it to that extreme.
【在 z***s 的大作中提到】 : 要得不完全是这个效果,而是约束。不符合规范就不能编译或者不能提交。
|
|
|
e*****t 发帖数: 1005 | 21 checkstyle can be integrated via ant/maven/gradle.
It also has very good IDE support.
【在 z***s 的大作中提到】 : 要得不完全是这个效果,而是约束。不符合规范就不能编译或者不能提交。
|
x****o 发帖数: 29677 | 22
去写Python吧
【在 z***s 的大作中提到】 : 要得不完全是这个效果,而是约束。不符合规范就不能编译或者不能提交。
|
z***s 发帖数: 3241 | 23 哈哈,记得有个语言是严格缩进,没有花括号,看来就是python了? :)
【在 x****o 的大作中提到】 : : 去写Python吧
|