由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - JAVA coding style
相关主题
java beginner question两个很基本的JAVA问题
eclipse中怎样改变tab/indent大小?[Share] Java ScreenShot Application
[转帖]如何才算掌握Java(J2SE篇)is there anyway that i can return...
JAVA IDE ?Java on AIX
请问一个最初级问题java & XML 2 example problem
求助!Tomcat下设置servlets的问题向各位高手求教,多谢先
自学java,编了个Hello world。怎么都是错误读不出来啊java rugular expression question
JAVA APPLICATION PATH 一问有没有Java提高书,或者别的,我刚刚上完java
相关话题的讨论汇总
话题: style话题: java话题: coding话题: code话题: example
进入Java版参与讨论
1 (共1页)
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
2
太难看了
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 的大作中提到】
: 你是说括号不另起一行?
相关主题
求助!Tomcat下设置servlets的问题两个很基本的JAVA问题
自学java,编了个Hello world。怎么都是错误读不出来啊[Share] Java ScreenShot Application
JAVA APPLICATION PATH 一问is there anyway that i can return...
进入Java版参与讨论
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
12
左括号另不另起一行的问题。。。感觉无所谓其实
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 的大作中提到】
: 要得不完全是这个效果,而是约束。不符合规范就不能编译或者不能提交。
相关主题
Java on AIXjava rugular expression question
java & XML 2 example problem有没有Java提高书,或者别的,我刚刚上完java
向各位高手求教,多谢先java这个是什么逻辑?
进入Java版参与讨论
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吧

1 (共1页)
进入Java版参与讨论
相关主题
有没有Java提高书,或者别的,我刚刚上完java请问一个最初级问题
java这个是什么逻辑?求助!Tomcat下设置servlets的问题
Java concurrency的疑惑,难道我理解错了? (转载)自学java,编了个Hello world。怎么都是错误读不出来啊
JAVA 考试题请教JAVA APPLICATION PATH 一问
java beginner question两个很基本的JAVA问题
eclipse中怎样改变tab/indent大小?[Share] Java ScreenShot Application
[转帖]如何才算掌握Java(J2SE篇)is there anyway that i can return...
JAVA IDE ?Java on AIX
相关话题的讨论汇总
话题: style话题: java话题: coding话题: code话题: example