why brackets are not in new line

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 2256 Views - Last Post: 11 September 2017 - 04:07 PM

#16 Arenlor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 414
  • Joined: 26-April 06

Re: why brackets are not in new line

Posted 11 September 2017 - 07:27 AM

Never considered that. I'm not sure it's any more clear on new lines or not.
Was This Post Helpful? 1
  • +
  • -

#17 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon


Reputation: 6979
  • View blog
  • Posts: 14,599
  • Joined: 16-October 07

Re: why brackets are not in new line

Posted 11 September 2017 - 07:51 AM

View Postjon.kiparsky, on 10 September 2017 - 12:25 AM, said:

Low-bid contractors, yes, tend to produce crap code.


Bingo! Contractors are an interesting rogues gallery and I've never found nationality to be a competence predictor. I've worked worked with people who hail from all over the globe, some are great and some suck because, well, people.
Was This Post Helpful? 1
  • +
  • -

#18 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon


Reputation: 6979
  • View blog
  • Posts: 14,599
  • Joined: 16-October 07

Re: why brackets are not in new line

Posted 11 September 2017 - 08:00 AM

I should add I'm in the one true brace camp. Even before Java existed.

One of my earliest programming professors emphasized the value of having code blocks no larger that a screen, so you could worry out the logic without jumping around. This is works for me and as a natural extension, wasted white space for a brace seems not just wasteful, but detrimental.
Was This Post Helpful? 0
  • +
  • -

#19 jon.kiparsky  Icon User is online

  • Chinga la migra
  • member icon


Reputation: 10681
  • View blog
  • Posts: 18,290
  • Joined: 19-March 11

Re: why brackets are not in new line

Posted 11 September 2017 - 08:16 AM

The current prevailing wisdom says that functions should be no longer than ten lines, on the grounds that functions should do only one thing, and you should be able to do that one thing in just a few lines. That seems to leave plenty of room for vertical space, so if I were for some reason to use a braces language again I'd probably stick with Allman.
Was This Post Helpful? 0
  • +
  • -

#20 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 2386
  • View blog
  • Posts: 5,009
  • Joined: 11-December 07

Re: why brackets are not in new line

Posted 11 September 2017 - 02:32 PM

LISP envy:

import java.util.stream.*;

public class FizzBuzz {
	public static void main(String[] args) {
		System.out.println(
				IntStream
					.rangeClosed(1, 100)
					.mapToObj(i -> 
						(String)(
							(i % 15 == 0) ? "FizzBuzz" : 
							(i % 3 == 0) ? "Fizz" : 
							(i % 5 == 0) ? "Buzz" : 
							("" + i)))
					.collect(Collectors.joining("\n")));}}

Was This Post Helpful? 0
  • +
  • -

#21 Damage  Icon User is offline

  • Lord of Schwing
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,961
  • Joined: 05-June 08

Re: why brackets are not in new line

Posted 11 September 2017 - 04:07 PM

i'd never heard of Whitesmith's style and at first glance was immediately vexed by the tab styles....but after reading it a bit more it does kinda make sense, it seems to make it really easy to identify what code belongs with what block
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2