Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5984013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:18:48+00:00 2026-05-22T22:18:48+00:00

we have here at work a very strange coding convention, and I didn’t managed

  • 0

we have here at work a very strange coding convention, and I didn’t managed to setup the Java Formatter in Eclipse right to do what I want. The convention says:

  • Before a curly brace “{” there should always be a new Line

[UPDATE]
There is no rule in our convention saying, if after a “{” should be a line break or not. The examples actually use a line break (and almost ANY convention I saw so far says or implies that after a “{” and a “}” should always be a line break). So sample 1 and 2 are both “syntactically correct”.
[/UPDATE]

As this blows the code, our team have decided to write code like this (no, this wasn’t my choice!):

public void methode(final boolean b)
{ if (b)
  { do.something();
  }
  else
  { do.somethingElse();
  }
}

But in the formatter I only managed to get this:

public void methode(final boolean b)
{
  if (b)
  { 
    do.something();
  }
  else
  { 
    do.somethingElse();
  }
}

or this:

public void methode(final boolean b) { 
  if (b) { 
    do.something();
  }
  else {
    do.somethingElse();
  }
}

Is there a way to tell the formatter to break lines before a “{” but not after that? I know the first style is awful, and I would be pleased to use one of the last two, but this is a company decision.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:18:49+00:00Added an answer on May 22, 2026 at 10:18 pm

    So, here an Information about this Topic. I have done some more research. The here so abominated Brace-Style (sample 1) has a name: The Horstmann Brace Style or here Horstmann. There is a small group of people defending it, as it combines the advantages from the K&R and the Allman (sample 2) Style. As the braces are lined up, and there is no "waste" of space.

    But this is not the only true. This style miserable for the VCS. If you need to add a Line between the opening brace and the first statement, you need first to break the line, and put your new line there. In the diff or merge you will see then not "one line been added", but "one line been exchanged by two lines". But the actually old statement was changed by you.

    So another argument, not to use this style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here at work we have a very large application with multiple sub applications. (500
The system I work on here was written before .net 2.0 and didn't have
I have a very strange situation happening and I'm hoping someone here knows why.
At work here, we have a box serving XML feeds to business partners. Requests
Here is the situation: I have been called upon to work with InstallAnywhere 8,
I have just encountered very strange problem - my GWT app hosted on Google
I have a very strange problem and the following code wont compile: #ifndef MYWINDOW_HPP_INCLUDED
Very strange situation here: I'm using L2S to populate a DataGridView. Code follows: private
This code compiles but looks very strange. I have a typical and simple parent/child
I have a pretty weird situation here, and i came up with a very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.