Skip to main content

Questions tagged [code-formatting]

focuses on legibility and consistent look of code: lexical-level intelligibility is a basic element of coding-style

Filter by
Sorted by
Tagged with
-2 votes
1 answer
124 views

About formatting Here are two scenarios in which the details of the formatting are described. How should in the clean code way, this be formatted Scenario 1: Dependent functions of dependent functions ...
user13047397's user avatar
1 vote
1 answer
896 views

I am currently using tracy to profile a program I am writing. Tracy as a tool seems quite awesome, but it has one issue. You need to markup your code when profiling. This has the negative consequence ...
Makogan's user avatar
  • 261
1 vote
2 answers
3k views

I know an empty method without any good reason is a code smell, but it can be required for constructors. What would be a good way to write an empty constructor among the following? class A { ...
dolgom's user avatar
  • 129
-1 votes
2 answers
620 views

I am the manager of a small team of software engineers. I am looking for arguments in favor of automatic, mandatory code formatting. For me it is natural, it goes with the Quality Assurance process ...
mguijarr's user avatar
  • 226
2 votes
2 answers
399 views

In Clean code it's suggested that private helper functions should always exist directly below the function they're directly used within. Should I be doing this when using computed properties? It's the ...
Declan McKenna's user avatar
3 votes
1 answer
477 views

Our team is growing, and with it, discontent with common coding standards being imposed on developers with alternate (strong, bordering on religious) views on what constitutes a good coding style. ...
Steve Lorimer's user avatar
8 votes
12 answers
7k views

I'm new at writing professional code (the bulk of my experience is with personal projects) so excuse me if this is trivial. When I write code I find myself being a little inconsistent with how much ...
CS2020's user avatar
  • 213
1 vote
0 answers
134 views

Our organization is looking to standardize the way we use const T& and T const& and while we initially looked at clang-format to solve the job, it doesn't reorder tokens so there is no way to ...
Jon's user avatar
  • 111
3 votes
3 answers
3k views

Abstract: Is it acceptable to include the type name in the variable name? My scenario: I am working with C# MVVM, and I have a lot of ICommand properties in my ViewModel, named various things like ...
Michael Brandon Morris's user avatar
1 vote
2 answers
6k views

I'm hoping someone who's given this some thought can help me understand. Most style-checking tools seem to distinguish between warnings and errors. To me, the point of a lint error is that a style ...
user1446's user avatar
  • 492
0 votes
1 answer
340 views

In Java Swing if you want to add a listener to a component, it would look something like this... JButton j = new JButton(); int counter = 0; j.addAncestorListener(new AncestorListener() { @...
Ogen's user avatar
  • 303
2 votes
1 answer
310 views

Look at the formatting of the variable declarations. I haven't encountered this indentation style in the past, but lately I stumbled upon two different code examples which use this style. Where does ...
Paul's user avatar
  • 161
5 votes
3 answers
401 views

UPDATE: an issue would arise from stuff that is not strictly defined by a formatter, like consecutive empty lines etc., that would get lost in the process (local to server to local reformatting) which ...
Jaroslav Záruba's user avatar
7 votes
1 answer
2k views

I understand the general Erlang conventions for functions are using snake case or camel case, but what about exported functions? For example, say I have a gen_server module that defines a check to ...
Selali Adobor's user avatar
8 votes
1 answer
29k views

I'm on my first bigger C++ project and find that I have some really long lines. My goal is to break them to 79 columns, but I do not really know how to do this in a neat way. Are there some guidelines ...
Martin Ueding's user avatar
6 votes
2 answers
237 views

has there ever been a proposal for establishing a formatting style file for programmers? In web programming, we have CSS files that help separate style from 'code', so two people can see the same code ...
Rodolfo's user avatar
  • 335
0 votes
2 answers
1k views

I've read the flame wars over the use of spaces and tabs. When working with any markup language (when scope isn't very important and when pressing space 4 times is a PITA), I tend to minimize the tab ...
Indolering's user avatar
0 votes
2 answers
313 views

Is it looked down upon or bad to write multiple variable declarations on the same line? As in: boolean playMoreGames = true; int length; boolean win; int ...
Steve P.'s user avatar
  • 151
7 votes
1 answer
1k views

I'm in the planning stage of making a code beautifier (similar to AStyle or Uncrustify) - originally I was going to just contribute to one of those projects, but reviewing their source led me to the ...
Matt Kline's user avatar
97 votes
17 answers
22k views

We are considering to impose a single standard code format in our project (auto format with save actions in Eclipse). The reason is that currently there is a big difference in the code formats used by ...
-1 votes
1 answer
367 views

When validating a JavaScript form, would it be better to process each input field individually, or, where possible check collectively? e.g. validate() { noblanks() fieldOne() fieldTwo(...
fdsa's user avatar
  • 175
7 votes
2 answers
1k views

Are there any eye-tracking case studies, or similar research done to verify what code format is easiest to read, maintain and work with? I always format my code the following way: function thing() { ...
Reactgular's user avatar
  • 13.1k
2 votes
6 answers
28k views

Possible Duplicate: Is the ternary operator evil? Does using shorthand if else statments hurt readability? Compare: string name = street != null ? street.Owner : "Not known"; With: string name; ...
Tom Squires's user avatar
  • 17.8k
4 votes
2 answers
250 views

I hope this is the right forum for this ... Well, in C, the standard library uses usually (void* buffer, int size) when referring to some data buffer. I wonder if there is a rationale for this order ...
Anteru's user avatar
  • 163
20 votes
3 answers
14k views

Some people swear by closing their PHP files with ?>, some say it's more optimized to leave it off. I know that it's not essential to have it on there, I'm just wondering what the pros and cons ...
Steve Robbins's user avatar