Questions tagged [conventions]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9
votes
1answer
674 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 (...
0
votes
0answers
37 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 ...
-4
votes
1answer
75 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 ...
3
votes
2answers
277 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 ...
1
vote
1answer
90 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 ...
2
votes
1answer
260 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 ...
36
votes
5answers
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 ...
2
votes
1answer
49 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', } ...
2
votes
3answers
102 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 "...
2
votes
3answers
409 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 ...
1
vote
1answer
173 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 ...
2
votes
1answer
157 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 ...
1
vote
1answer
795 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 ...
-7
votes
1answer
186 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/...
3
votes
2answers
61 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 ...
1
vote
1answer
335 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 ...
3
votes
1answer
72 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 ...
1
vote
1answer
483 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 ...
1
vote
1answer
417 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... ...
2
votes
1answer
438 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 ...
6
votes
1answer
26k 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 ...
31
votes
4answers
31k 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, ...
3
votes
2answers
108 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 ...
102
votes
10answers
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 ...
2
votes
1answer
1k 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 ...
-2
votes
2answers
774 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 ...
0
votes
0answers
261 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 ...
8
votes
3answers
2k 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 ...
0
votes
4answers
680 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 ...
2
votes
1answer
602 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. ...
2
votes
1answer
137 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 ...
1
vote
3answers
114 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 ...
1
vote
4answers
388 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 ...
0
votes
1answer
208 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 $...
9
votes
3answers
20k 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 ...
1
vote
2answers
3k 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 ...
3
votes
1answer
153 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 ...
25
votes
2answers
18k views

Why does convention say DB table names should be singular but RESTful resources plural?

It's a pretty established convention that database table names, in SQL at least, should be singular. SELECT * FROM user; See this question and discussion. It's also a pretty established convention ...
0
votes
2answers
2k views

get set method naming conventions [closed]

In OOP coding, there is a long standing naming convention to name accessor/mutator methods getThing and setThing. These directly manipulate the properties, which are often private. Should these ...
-3
votes
2answers
2k views

In HTML and CSS what are the standard tab sizes? [closed]

I searched on Google but couldn't find an answer. I'd like to know what are the standard tab sizes for HTML and CSS. Is it 2 or 4?
2
votes
1answer
78 views

Modern frameworks method conventions

I've been noticing that modern frameworks tend to have this kind of code style: expect(6 - 4).toBe(2) this can be rephrased as: assert(6-4, 2) Yet the former is much more readable. I would like to ...
3
votes
1answer
107 views

Are there any problems with defining a single-source “module” in C using conditional compilation to separate the “header” from “source”

I'm writing a project that I want to keep small in the sense of being very densely-coded and a single source file. But it's growing large enough that navigating the file is becoming tiresome, so I ...
10
votes
5answers
21k views

Is it okay to go against all-caps naming for enums to make their String representation simpler?

Several times I've seen people use title-case or even all lower-case naming for enum constants, for example: enum Color { red, yellow, green; } This makes working with their string form simple ...
5
votes
4answers
2k views

Should I edit a codebase's whitespace to conform to a coding style? [duplicate]

We have a large Java project (1m+ SLOC) with mixed whitespace - some files have tabs and some have spaces. It's tricky to make my editor work with whichever file I happen to be editing. We are ...
7
votes
2answers
5k views

What is the correct project file structure for a versioned rest api?

Should I have resource directories inside version directory, like app/ v1/ book/ author/ v2/ author/ or version directories inside resource folder app/ book/ v1/ author/ v1/...
7
votes
2answers
6k views

Is it conventional to name final/constant local variables in UPPER_SNAKE_CASE?

Pretty simple, I have a method: public final void myMethod(User user, Group group) { final int MAX_USERS_PER_GROUP = group.getMaxUsersPerGroup(); int usersInGroup = 0; // Get users in ...
0
votes
0answers
52 views

Internal class variables convention

When I see some open source projects, specifically classes, I see that its variables starts with a 'm' minuscule. What does it mean? What means the 'm'?
1
vote
3answers
976 views

Are project naming conventions more important than language naming conventions? [closed]

I'm working on a project with a senior developer and he doesn't really abide by the naming conventions of the language that we're using. The project is in Go and he uses underscores for everything. ...
1
vote
0answers
150 views

Code structure with MongoDB in python

I am new to MongoDB and python. I know how to make basic use of pymongo in order to manipulate documents. I am having trouble finding how to create some structure or governance in what gets inside ...
1
vote
2answers
140 views

Github convention for putting projects on hold

I have a few github projects on the go at the same time. I am only actively working on one at any one time which can take months. My other projects remain in a semi-completed state. Is there a ...