Coding standards a set of conventions and practices used in software, such as naming classes, variables, and files.

learn more… | top users | synonyms (1)

3
votes
1answer
1k views

Capitalization convention for C# protected fields

What is the capitalization conventions for protected field names in C#? Is it _myVar (like private field) or MyVar (like properties)?
1
vote
3answers
313 views

CSS vs codebehind, if I have to do part of the style in codebehind, should I do all of it there?

I'm working with ASP.Net and trying to style an ImageButton. I tried to do this via CSS only to discover that for some reason, .Net writes out an inline style setting the border width to 0 ...
1
vote
1answer
315 views

Where does the “mm” come from in GTKmm, glibmm, etc

I understand that the "mm" suffix [in various GTK-associated C++ binding libraries] means "minus minus," but where exactly does it come from? I understand that there is a programming language called ...
5
votes
4answers
884 views

C# coding standards” Use the const directive only on natural constants

I've seen these 2 guidelines in coding c# standard and I’m not sure the what the 2nd one means. With the exception of zero and one, never hard-code a numeric value; always declare a constant ...
1
vote
5answers
267 views

CSS naming guildlines with elements with multiple classes

Its seems like there are 2 ways someone can handle naming classes for elements that are designed to have multiple classes. One way would be: <span class="btn btn-success"></span> This ...
12
votes
4answers
652 views

Co-worker uses ridiculous commenting convention, how to cope? [closed]

A co-worker in the small start-up I work at writes (C++) code like this: // some class class SomeClass { // c'tor SomeClass(); // d'tor ~SomeClass(); // some function void ...
4
votes
2answers
674 views

What package name to choose for a small, open-source Java project?

I'd like to publish a small open-source library in Java. I wonder what package name should I choose? I'm not a company and I don't have a domain that I could use as the basis for naming the package ...
22
votes
8answers
2k views

Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth) [duplicate]

The often provocative Chuck Moore (inventor of the Forth language) gave the following advice[1]: Use comments sparingly! (I bet that's welcome.) Remember that program you looked through - the ...
8
votes
1answer
651 views

Are there well-known PowerShell coding conventions?

Are there any well-defined conventions when programming in PowerShell? For example, in scripts which are to be maintained long-term, do we need to: Use the real cmdlet name or alias? Specify the ...
2
votes
3answers
273 views

using “IS” is better or checking for “NOT NULL”

In C#.NET language: This style of coding is recommended or the one below it? if (sheet.Models.Data is GroupDataModel) { GroupDataModel gdm = ...
3
votes
7answers
316 views

Vocabulary: Should I call this apply or map?

So, I'm tasked with organizing the code and building a library with all the common code among our products. One thing that seems to happen all the time and I wanted to abstract is posted below in ...
1
vote
1answer
395 views

Established coding standards for pl/pgsql code

I need to standardize coding practices for project that compromises, among others, of pl/pgsql database, that has some amount of nontrivial code. I look for: Code formatting guidelines, ...
1
vote
4answers
403 views

Long lines of text in source code [duplicate]

Possible Duplicate: Is the 80 character limit still relevant in times of widescreen monitors? I used to set a vertical line set at 80 characters in my text editor and then I added carriage ...
1
vote
4answers
319 views

Where to find common database abbreviations in Spanish

I'm doing a little pro bono work for an organization in Central America. I'm ok at Spanish and my contacts are perfectly fluent but are not techincal people. Even if they don't care what I call some ...
4
votes
1answer
125 views

Naming conventions for newtype deconstructors (destructors?)

Looking into Haskell's standard library we can see: newtype StateT s m a = StateT { runStateT :: s -> m (a, s) } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype Sum a = Sum { ...
3
votes
4answers
1k views

Why should one use a single-use temporary variable?

Let's say we have a class called 'Automobile' and we have an instance of that class called 'myCar'. I would like to ask why do we need to put the values that our methods return in a variable? Why ...
5
votes
4answers
216 views

Should Equality be commutative within a Class Hierachy?

It is easy to define the Equals operation in ways that are not commutative. When providing equality against other types, there are obviously situations (in most languages) were equality not being ...
4
votes
2answers
275 views

What should my “large codebase sample” look like?

If an employer asks for a large code sample, one for an entire project, what characteristics should the project have to show architectural skills and the ability to manage a large codebase? For ...
8
votes
7answers
1k views

Why would an employer ask for a 'long' code sample?

What would a large project that spanned multiple files and >1000 lines show to an employer that a few individual files and a couple hundred lines couldn't capture?
0
votes
2answers
234 views

What is the standard for describing functions and objects?

What is the standard for describing functions/methods (function name, number of arguments, argument type, return type, etc...) in a manner that is language independent? EDIT: More specifically, how ...
10
votes
5answers
511 views

Should coding standards be enforced by the continuous integration server?

Should coding standards/style be enforced by the continuous integration server running static analysis tools (ex. PMD, StyleCop/FxCop) and failing the build if the standards are not followed? What ...
13
votes
9answers
2k views

Is a coding standard even needed any more?

I know that it's been proven that a coding standard helps enormously. However, there are many different tools and IDEs that will format to whatever standard the programmer prefers. So long as the ...
6
votes
3answers
242 views

How should I get my code ready for OpenSourcing it and putting it on GitHub?

In a few weeks, my project is going to be finished and I want to start getting my code ready for other people to use it. I am going to be posting everything to GitHub so people can tweak it and ...
2
votes
3answers
394 views

When creating a library for a simple program, what must I do to protect others from its lack of thread safety?

When creating a library for a simple program, is it more cost effective to make it thread safe or is there a way to detect the program's use in a multithreaded program and ASSERT() or otherwise ...
6
votes
1answer
149 views

How to learn what the industry standards/expectations are, particularly with security?

For instance, I was making my first mobile web-application about a year ago, and half-way through, someone pointed me to jQuery Mobile. Obviously this induced a total revolution in my app. Rewrote ...
0
votes
2answers
285 views

Approach on Software Development Architecture

I am planning to standardize our way of creating project for our new projects. Currently we are using 3tier architecture where we have our ClassLibrary Project where it includes our Data Access Layer ...
1
vote
2answers
359 views

What is faster and preferable way for variable assignment in ruby? [closed]

I am a RoR developer and want to clarify some doubt about ruby variable assignment. In ruby we have two ways for variable assignment. str, arr, num = "Hi", [1, 2], 3 and str = "Hi" arr = [1, 2] ...
2
votes
2answers
288 views

Case Class naming convention

In my recent adventures in Scala, I've found case classes to be a really nice alternative to enums when I need to include a bit of logic or several values with them. I often find myself writing ...
36
votes
11answers
3k views

Why are cryptic short identifiers still so common in low-level programming?

There used to be very good reasons for keeping instruction / register names short. Those reasons no longer apply, but short cryptic names are still very common in low-level programming. Why is this? ...
5
votes
3answers
479 views

CTO has left — codebase is a huge kludge, any advice on how to manage/handle/damage control? [closed]

I began work at a company 2 months ago as a PHP developer. I stepped in to somewhat of a kludge, but I've yet to find a company that isn't... The development stable is currently two developers ...
10
votes
7answers
1k views

In C and C++, what methods can prevent accidental use of the assignment(=) where equivalence(==) is needed?

In C and C++, it is very easy to write the following code with a serious error. char responseChar = getchar(); int confirmExit = 'y' == tolower(responseChar); if (confirmExit = 1) { exit(0); } ...
4
votes
3answers
319 views

Naming a “do X if needed” method

What is a good way to name a method that checks if X needs to be done, and does X it if necessary? For example, how to name a method that updates a user list if new users have logged in? ...
4
votes
1answer
144 views

Naming convention for main arguments

I recently started using arguments in my main program (here written in C++ but could be any programming language) #include <iostream> int main(int argn, char* argv[]) { // do stuff ...
33
votes
7answers
2k views

Are there deprecated practices for multithread and multiprocessor programming that I should no longer use?

In the early days of FORTRAN and BASIC, essentially all programs were written with GOTO statements. The result was spaghetti code and the solution was structured programming. Similarly, pointers can ...
5
votes
3answers
146 views

Where do I place my example implementations in my framework?

I've created a pretty simple templating framework and have default implementations for some of my interfaces used for passing around information. I store these in MyFramework.Default namespace ...
5
votes
1answer
566 views

Are there any FOSS operating systems available that conform to NASA's JPL coding standards? [closed]

I, like many others, have been completely enamored with the recent successful landing of Mar's Curiosity rover. After reading a couple of articles, and following a few links, I've found a couple C ...
64
votes
13answers
16k views

Do I need to use an interface when only one class will ever implement it?

Isn't the whole point of an interface to for multiple classes to adhere to a set of rules and implementations?
12
votes
3answers
2k views

Can someone explain to me C#'s coding convention?

I recently started working with Unity3D and primarily scripting with C#. As, I normally program in Java, the differences aren't too great but I still referred to a crash course just to make sure I am ...
7
votes
2answers
369 views

REST API Library Conventions

Most API libraries define one method for each endpoint. If there is an endpoint for getting user information, you might have a method like: getUserInfo(userId); That simple method is often a ...
0
votes
1answer
503 views

Convention on model names in ruby on rails

I was doing my ER diagram for a rails application I'm about to begin with and there I have an entity called Class News so I'd have a model ClassNew but I don't know if I will have problems in the ...
7
votes
6answers
1k views

Indentation: is there any evidence to show whether 2 or 4 spaces is more readable? [closed]

At the company I work for, we're trying to standardize our development practices, and we want to make the right call regarding indentation. Is there any empirical evidence (preferably research ...
5
votes
2answers
541 views

Should you create a class within a method?

I have made a program using Java that is an implementation of this project: http://nifty.stanford.edu/2009/stone-random-art/sml/index.html. Essentially, you create a mathematical expression and, ...
4
votes
5answers
350 views

Keep coding the wrong way to remain consistent? [duplicate]

Possible Duplicate: Code maintenance: keeping a bad pattern when extending new code for being consistent, or not? To keep things simple let's say I am responsible for maintaining two ...
8
votes
6answers
9k views

Single quotes vs double quotes [closed]

I just started a job where I'm writing Python after coming from a Java background, and I'm noticing that other developers tend to quote strings using single quotes ('') instead of double quotes (""). ...
2
votes
3answers
491 views

Convention for writing Python without newlines or whitespace?

Is there a convention for writing Python when deprived of newlines and whitespace? For example, stackexchange comments, Twitter, text messages...
0
votes
5answers
631 views

Standards & compliances for secure web application development?

I am working with developers right now that write code the way they want and when i tell them to do it other way they respond that its just matter of preference how to do it and they have their way ...
5
votes
3answers
768 views

Should my source code be in UTF-8?

I feel that often you don't really choose what format your code is in. I mean most of my tools in the past have decided for me. Or I haven't really even thought about it. I was using TextPad on ...
11
votes
13answers
3k views

Should I add an “Abstract” prefix to my abstract classes?

Suppose I have an abstract class named Task. Is there a standard or convention that would suggest I should name it AbstractTask instead?
3
votes
4answers
290 views

Create new variable or make multiple chained calls?

What is the best way to get this attributes, thinking in performance and code quality? Using chained calls: name = this.product.getStock().getItems().get(index).getName(); id = ...
2
votes
2answers
131 views

Assignments in mock return values

(I will show examples using php and phpunit but this may be applied to any programming language) The case: let's say we have a method A::foo that delegates some work to class M and returns the value ...