Questions tagged [conventions]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
3 answers
160 views

Should I ensure my libfoo library's include file can be included as foo/foo.h?

I'm maintaining a small C library; let's call it libfoo. It has quite a few users (actually it's complicated - it's the main fork of a highly popular library which has been abandoned); and it sports a ...
user avatar
  • 2,390
0 votes
5 answers
80 views

best practice for error handling between PAM_SUCCESS and PAM_AUTH_ERR macros

We have two exit code code PAM_SUCCESS(0), PAM_AUTH_ERR(7). If we wanna return 0 or 7 when we compared password with our password in following code which code is better that this code ? if (strcmp (...
user avatar
1 vote
1 answer
473 views

How can I write good Conventional Commit-style commit messages for one feature over multiple commits?

If I am working on a single feature, I would usually commit multiple commits. Should every commit start with feat? Or should only 1 commit have the type of feat and use a different type for the other ...
user avatar
  • 119
0 votes
3 answers
150 views

What is this numeral system notation?

I used Google search to convert numbers from one numeral system to another. 10 to binary is 0b1010; 10 to hexadecimal is 0xA. What's the meaning of 'b' and 'x', accordingly? I think these are ...
user avatar
  • 31
-2 votes
1 answer
246 views

Git semantic commit versioning for file deletions

What commit type should I use when I'm deleting files from a repo? I have seen several types over the internet, but none talk about file deletions. Possibly the closest options that come to mind are ...
user avatar
1 vote
0 answers
279 views

Broker queue and topic naming conventions

I'm in the process of adding a message broker (ActiveMQ Artemis) to a system currently and while I have my own notions on how I can divide up the namespace, it seems like a good time to get opinions ...
user avatar
0 votes
2 answers
212 views

Should default settings be considered as business rules from the viewpoint of "Clean Architecture"?

The examples of default settings: Default port for server applications Default resources directory for Java Applications Default Webpack config file ("webpack.config.js") My particular ...
user avatar
-2 votes
5 answers
291 views

Why does today's companies follow old RFC's?

Let me start by saying that of course conventions are important, there should be a rule of thumb for some cases that is representing the best action to follow by, in order to prevent mistakes and make ...
user avatar
3 votes
1 answer
306 views

Why is it not the case that all d-tors of virtual C++ classes be virtual?

I am basically plagiarizing When NOT to use virtual destructors?. The excellent answers remind us that C++ is pay only for what you use. However, the Standard is a couple of thousand pages long. The d-...
user avatar
  • 6,735
2 votes
2 answers
467 views

Does it make sense to use meaningless named constants?

For example, does it make sense to refactor the following code: a = a * 2; as: const int INT_TWO = 2; // ... a = a * INT_TWO; My question hinges on the fact that the new constant conveys no ...
user avatar
0 votes
2 answers
147 views

How to divide responsibility between poco, writer and converter

I have several POCO´s (simple classes holding data) that I have need to flush from memory from time to time whenever a collection grows too large. Most often I want to upload the data to a REST ...
user avatar
  • 265
1 vote
0 answers
34 views

Standard way to bulk crud image with caption in an API?

I am trying to build a API for doing CRUD on images with their caption. So far I can think of option1: sending the images in form-data as list of images and their corresponding captions in another ...
user avatar
-4 votes
1 answer
88 views

Java Class Structure

I have a problem during a project of mine using Java, as usual my java classes have the structure: import ...; import ...; ... private Type0 myVariable0; private Type1 myVariable1; ... ... private ...
user avatar
9 votes
1 answer
1k views

What does "TILT" mean in a comment?

I'm reading Clean Code by Robert C. Martin, and the phrase TILT inexplicably appears in some code samples. Example (it's in Java, by the way): ... public String errorMessage() { switch (...
user avatar
  • 201
0 votes
0 answers
42 views

HTTP/REST and chained processing protocol/convention

Is there a protocol or a convention that supports REST (ok, maybe we should use HTTP here instead) processing chain and some neat features to help with that? Let me explain what I mean. Let's assume ...
user avatar
-4 votes
1 answer
87 views

Public var vs protected var and get function [closed]

I've noticed this style of code a lot in frameworks like Symfony and Magento 2 (which is based on Symfony): <?php class Foo { protected $foo; # construct function - not ...
user avatar
3 votes
2 answers
2k views

Is there a term for functions starting with the "Is" prefix?

There are a number of functions of a kind; returning a boolean, and the name always starts with the "Is" prefix. e.g. IsAlive(), IsDead(), IsKeyPressed(), IsKeyReleased(), etc. How do we categorize ...
user avatar
  • 161
1 vote
1 answer
239 views

Difference between failed and canceled task

In case we hav functions (f_1,....,f_n) which runs in this order somewhere in the future. I would like to define a relationship between those functions such that if f_i failed due to expection then ...
user avatar
  • 267
2 votes
1 answer
419 views

Naming Convention [closed]

When we determine names for the variables, there are two important issues that the people mention: The variable names must be explanatory. For the sake of this, their names can be long.` The variable ...
user avatar
  • 229
36 votes
5 answers
6k views

Is it enough for methods to be distinguished just by argument name (not type)?

Is it enough for methods to be distinguished just by argument name (not type) or is it better to name it more explicitly? For example T Find<T>(int id) vs T FindById<T>(int id). Is there ...
user avatar
  • 1,421
2 votes
1 answer
77 views

Does any scale exist (e.g. naming convention to be used for sizes) that allows trivial insertions at any point in the scale?

Question probably sounds confusing so let me clarify. Let's say I have an object containing keys and values for my project's font sizes: { small: '8px', medium: '11px', large: '14px', } ...
user avatar
  • 129
1 vote
3 answers
685 views

Convention for labelling coordinate axes in 3d graphics

When I recently started doing some 3d graphics, I carefully (tried to be careful, anyway) decided to use the conventional mathematical standard for labelling axes, which was much more convenient for "...
user avatar
2 votes
3 answers
768 views

Why do we follow Convention?

Preface: I am not arguing against convention but rather want to have a greater understanding why convention is something I should follow and what are the benefits/drawbacks of doing so. I have found ...
user avatar
  • 37
1 vote
1 answer
455 views

Naming standards or conventions for ecommerce

Naming things There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton Naming things seems so trivial, before I read this quote, I would have ...
user avatar
  • 2,598
2 votes
1 answer
245 views

Is the URL 'users/new' RESTful?

I was in a job interview demo-ing a RESTful API in Flask when an argument broke about the API. The interviewer argued that the URL for adding a new user (/users/new) is not proper REST. My API ...
user avatar
  • 232
1 vote
1 answer
2k views

Proper modeling and name convention for an intermediate table between intermediates

I have 4 entities: Event, Message, Flow and Document. Event table stores a limited (seeded) number of records. Message has many events and each event can be related to many messages. The name ...
user avatar
-7 votes
1 answer
429 views

Where should I store data related to UI/presentation?

Say, I have a table Categories. On a page I have a header and for each category the colour of a header varies. A colour is of the presentation level and I've heard that what's related to the UI/...
user avatar
  • 51
3 votes
2 answers
124 views

Ajax response -- is there an agreement on the structure?

Say, I make an ajax request to a server from a page, something like "show more articles". Is there a common agreement on the format or rather structure in which a result should be returned? Something ...
user avatar
  • 39
1 vote
1 answer
943 views

Where to place Docker-related configuration files

Many projects need more than a Dockerfile or a docker-compose.yml in their root to work out of the box (e.g. for local development or a demo): For example a web application might need its runtime, a ...
user avatar
  • 273
3 votes
1 answer
145 views

Naming a view class

I'm a little hesitant on what to name a view class. I have a view class which I call ChooseImageView because that's what the user does in that view. After the user has chosen an image I display a ...
user avatar
1 vote
1 answer
696 views

ASP.NET MVC test structure and naming conventions

I decided to take the plunge and add the first set of integration and units tests to the projects I work on (yes, we have dozens of internal applications with no automated testing whatsoever...). I ...
user avatar
  • 1,101
1 vote
1 answer
466 views

The format of an response in ajax — any convention/recommendations?

Say I have a lot of page with ajax. Is there any convention or recommendation on the format/structure of an ajax response? Namely, if there's an error, a server returns http status 4xx or 5xx and... ...
user avatar
  • 21
2 votes
1 answer
701 views

Is it true that for both React or Angular, they are also both "convention over configuration"?

In the Ruby on Rails communication, it is often said that RoR is "convention over configuration". Can you say for React / Redux / Flux and AngularJS, Angular2, they are also "convention over ...
user avatar
  • 1,799
6 votes
1 answer
31k views

The correct use of application.properties file?

Java programmers are encouraged to store all their configurable parameters in an application.properties file from which they either load properties during runtime or they load during program start and ...
user avatar
  • 1,163
50 votes
5 answers
76k views

Should I really use all uppercase for my constants?

I am a Python programmer primarily who uses pylint for linting source code. I am able to eliminate all of the warnings except one: Invalid name for a constant. Changing the name to all caps fixes it, ...
user avatar
4 votes
2 answers
155 views

Using A Configuration Class (For All Constants/Magic's)

I come from a background where using a configuration file for every, if not every, constant is the best solution for maintainability and flexibility of the program. By this I mean, every hard coded ...
user avatar
  • 508
101 votes
10 answers
20k views

Should I follow a bad coding style just to follow the established conventions at my workplace?

I've been working at my job for about a year. I primarily do work in our GUI interface which uses methods from a C backend, but I generally don't have to deal with them except for return values. Our ...
user avatar
  • 913
2 votes
1 answer
2k views

Is there anything wrong with my project structure and naming convention in ASP.NET MVC and Web API?

I wonder if project structure and naming convention which I use in ASP.NET MVC and Web API projects are ok. These technologies are quite new to me, so I don't have my own standards yet. I don't ...
user avatar
-2 votes
2 answers
2k views

Java - is it bad to name variables starting with uppercase if they are vectors or matrices? [closed]

Often in math a vector or matrix will be denoted by a single capital letter. Would it be bad to have some variables such as this? Vector3 A = ... int Bx = ... int By = ... int Bz = .. I would ...
user avatar
0 votes
0 answers
306 views

Invent custom filename extension for derived format

Say I use a predefined serialization format X for certain data. Should I indicate the application in a custom filename extension or not? It is quite common pk3 is a zip archive XSL, SVG and many ...
user avatar
12 votes
3 answers
4k views

Naming convention for functions which have side effects? [closed]

I heard somebody say their language has a convention where the names of functions which mutate state must end with an exclamation point. I'm trying to write more functional code and I like the idea of ...
user avatar
0 votes
4 answers
945 views

Is "Pushing a variable to the Stack" a misnomer in C++?

In C++ a variable is allocated in the 'Call Stack' ('Stack') or the 'Heap.' Frequently when referring to allocating a variable to the 'Stack', people use the phrase "Push to the Stack." My issue with ...
user avatar
2 votes
1 answer
865 views

In Objective-C,what is the naming convention around protocols and their implementation classes?

Is there a naming convention for protocols and concrete implementations of them in Objective-C? Specifically regarding a protocol that's used as an abstract 'service' or 'manager' class declaration. ...
user avatar
3 votes
1 answer
204 views

What are good conventions/standards for application messaging through stdin and stdout?

I'm designing and application that spawns another processes to handle some specialized work. The application and the process it spawns will communicate through standard input and standard output (and ...
user avatar
1 vote
3 answers
177 views

In an ESB type system, what field name should be used as a "correlation ID"?

We're using ASP.NET Web API and Azure Service Bus and adding logging to our disparate services and systems. We need to track a correlation ID to the headers of each set of bus messages as well as logs ...
user avatar
  • 170
1 vote
4 answers
437 views

How to mark/track features in code?

After some time in every project sooner or later you will need to find a feature in it a fix it or extend it so I was wondering if there is already a system or a convention for marking those features ...
user avatar
  • 2,496
0 votes
1 answer
229 views

Is it worth it to follow code conventions of Netbeans? [closed]

I am always not able to follow Netbeans default coding conventions like the following Function should be N lines only Method Length is N Lines (M allowed) Warning: Do not Access Superglobal $...
user avatar
13 votes
3 answers
51k views

How to deal with Classes having the same name (different packages)

Me and my R&D team maintain a large codebase. We've divided our business logic into multiple packages. some of which have classes with identical names. As you can guess, the names conflict when ...
user avatar
1 vote
2 answers
5k views

What's the use of lint warnings vs errors? [closed]

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 ...
user avatar
  • 462
3 votes
1 answer
173 views

CharSequence to represent a named object

I always followed the opinion to not abuse interfaces in case of decomposition. Usually I only implement them if I am absolutely sure to have a "is-a"-relation and avoid implementing them if there is ...
user avatar