From what I understand, lines should not exceed 80 and at most 120 characters. I'm not sure of how much emphasis is put on the length of lines when grading the project but I just wanted to get some opinions on how most people would go about shortening a line with more than 120 characters. For example: <bold>public void updateRecord(long recNo, String data, long lockCookie)throws RecordNotFoundException, RecordLockedException;</bold> would probably be too long for a single line. How would you guys go about shortening this line? All comments are appreciated.
IMHO, I would strictly adhere to the conventions defined in the Code Conventions for the Java Programming Language as well as in the Java Coding Style Guide just to be on the safe side, as the former seem to be missing some. According to the above, your code should look like this:
Good luck with your assignment! [ September 15, 2002: Message edited by: Franck Rasolo ]
Hi Ronnie, I absolutely agree with Franck. I've seen several candidates in recent weeks losing 10 or more points on general considerations. You should follow the link Franck provided or better yet download it and thoroghly read and understand the coding conventions. BTW, according to those conventions, under no circumstances should lines exceed 80 chars. I spent two weeks checking my source code to make sure that I had complied with all the conventions and it paid off with a perfect for general considerations. Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I'm using two products to "validate" my style. CheckStyle helps Java programmers adhere to a coding standard with the default being Sun's Coding Conventions and Jalopy which is a Java source code beautifier. One advantage of using these tools is that it provides an automated and consistent coding style throughout your source code. - John [ September 16, 2002: Message edited by: John Sinues ] [ September 16, 2002: Message edited by: John Sinues ] [ September 16, 2002: Message edited by: John Sinues ]
Hi, but I did not see any requirement stating that we should follow the "java code convention". Also, some codes are really easier to read if leave them to be one line, not wrapping them. I am extremly frustrated now. I have submitted my assignment, and I keep noticing something I missed...... Is Sun really asking for those patterns, models, and styles in the exam? They are really not in my requirement document. Too late...... Hope miracle will happen, that's all I can do now. Wish all of you, who is still in the process, the best luck. [ September 24, 2002: Message edited by: Sandra Baker ]