D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Java, VIM, tabs, spaces and indents

 

On Saturday 03 February 2007 21:46, Simon Williams wrote:
> Benjamin A'Lee wrote:
> > On Sat, Feb 03, 2007 at 08:27:19PM +0000, Simon Williams wrote:
> >> I'm now doing java in my computer science course. Much to my irratation,
> >> I have discovered that java is poorly designed language which makes all
> >> code indented by an extra level because of the class definitions.
The Java compiler does not insist on any indentations - thats someones idea of 
'proper style' which is frankly useless if you have to write anything of any 
complexity. Coding 'Styles' are meant to make the code more readable but if 
the text is seven feet to the right then theres something wrong - try to 
refactor but it can be the style thats 'at fault'.
> >
> > Why not just not bother indenting after the class definition?
>
> That's probably what I'll do if I ever use java for anything else.
> Unfortunately the style rules for this are no hard tabs, indents must be
> consistent and 4 spaces or less.
>
> For the purposes of arguing my case:
> Am I right in thinking that the class definition will usually (or even
> always) span the whole file, even in very large programs?
you can have many classes in a file if you want
I'd suggest using a different editor (emacs?) or even IDE like netbeans - well 
cool! Vims good  if you have to use a simple monitor and its good to know how 
to use it but its a bit hair shirt for a college course!
Whatever it is tho find an editor your happy with and then use sed or 
something to process the files to whatever standard your tutor/college 
requires.
Tom te tom te tom



-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html