• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Code Convention  RSS feed

 
Indranil Sinha
Greenhorn
Posts: 20
IntelliJ IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks.
I recently started coding java professionally and now code convention is must thing for me. I am reading the codes of experienced programmers and really getting disgusted.
No line length, no proper indenting. I have to scroll vertically to read codes etc.

While coding in php I was using PSR1 and PSR2 standards. But while searching about the coding standards of Java I am in an ocean of selection range. Few coders giving
direct links of several conventions few asking to follow books like Clean Code. I also found the link for coding standard given in Coderanch.

What to do? Clean Code is a good option? or anything else is suggested for me?

Thanks in advance.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indranil Sinha wrote:What to do? Clean Code is a good option? or anything else is suggested for me?

Well, there's the horse's mouth, which is what I generally use. Not familiar with Clean Code, but it sounds like a reasonable title.

I doubt whether you'll ever get 100% adoption of all the things you want, particularly "vertical scrolling"; because there'll always be dinosaurs like me that prefer to declare my fields at the TOP of my classes.

I reckon that if you can good indenting and spacing, consistent "bracing", and standard naming, you should count yourself lucky. And even with all those in place, you can still find some pretty horrific code.

Winston
 
Indranil Sinha
Greenhorn
Posts: 20
IntelliJ IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
Indranil Sinha wrote:What to do? Clean Code is a good option? or anything else is suggested for me?

Well, there's the horse's mouth, which is what I generally use. Not familiar with Clean Code, but it sounds like a reasonable title.

I doubt whether you'll ever get 100% adoption of all the things you want, particularly "vertical scrolling"; because there'll always be dinosaurs like me that prefer to declare my fields at the TOP of my classes.

I reckon that if you can good indenting and spacing, consistent "bracing", and standard naming, you should count yourself lucky. And even with all those in place, you can still find some pretty horrific code.

Winston


Thanks for the link it seems it can save my time from reading a 413 pages book.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check to see if your employer has a standard. If so, follow that. it's better for all the code in your repository to be the SAME than for some of it to be under one standard, and some under another, even if one standard is more 'right'.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The book Clean Code has much more in it than code conventions. You should not be looking for opportunities to excuse you learning such things.
 
Indranil Sinha
Greenhorn
Posts: 20
IntelliJ IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:The book Clean Code has much more in it than code conventions. You should not be looking for opportunities to excuse you learning such things.


Yeah you are right Ritchie. I was reading the book and the intro encouraged me to read this book for my growth and future. I am quoting the line that attracted me.

Be prepared to work hard while reading this book. This is not a “feel good” book that
you can read on an airplane and finish before you land. This book will make you work, and
work hard. What kind of work will you be doing? You’ll be reading code—lots of code.
And you will be challenged to think about what’s right about that code and what’s wrong
with it. You’ll be asked to follow along as we take modules apart and put them back
together again. This will take time and effort; but we think it will be worth it.
James O. Coplien
quote from the Clean Code


So it is in my reading list.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!