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

learn more… | top users | synonyms (1)

4
votes
1answer
146 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
3k 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
148 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
590 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 ...
72
votes
14answers
19k 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?
13
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
412 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
614 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
660 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
402 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 ...
9
votes
6answers
12k 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
519 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
700 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
852 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
4k views

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

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
292 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
136 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 ...
2
votes
3answers
291 views

Is it common to declare class properties at the bottom of the class declaration? [closed]

I work in a PHP development shop and several new developers have joined the team. One of the new members insists on declaring class properties at the bottom of the class declaration rather than the ...
4
votes
3answers
187 views

User defined type for healthcare / Medical Records variable name prefixes?

I was reading Code Complete regarding variable naming in trying to find an answer to this question and stumbled on a table of commonly accepted prefixes for programming word processor software. Well, ...
2
votes
9answers
461 views

What is a widely accepted term for a string variable that would probably contain a file path and file name?

For functions that need to index files in a directory and rename them FileName0001, FileName0002, etc... I often need to write a function that splits the file name from the file path and rename the ...
50
votes
17answers
6k views

Working on someone else's code

I have hardly a year's experience in coding. After I started working, most of the time I would be working on someone else's code, either adding new features over the existing ones or modifying the ...
12
votes
5answers
7k views

Naming classes, methods, functions and variables

There are 3 important naming conventions: with_underscores PascalCased camelCased Other variants are not important because they are not commonly used. For variables it seems that the one with ...
7
votes
5answers
503 views

Is it considered bad practice to run different JavaScript for IE

Is it considered bad practice (and how bad) to run different JavaScript for IE? Currently im writing some JavaScript and the simplist way to work arround IE quirks seems to be to check for browser ...
1
vote
2answers
1k views

Why is 24 lines a common default terminal height?

80x24 characters seems to be a very common default for terminal windows. This answer provides a very good historical reason as to why the width is 80 characters. But why is the height commonly 24 ...
282
votes
9answers
67k views

Why is 80 characters the 'standard' limit for code width?

Why is 80 characters the "standard" limit for code width? Why 80 and not 79, 81 or 100? What is the origin of this particular value?
66
votes
16answers
15k views

Is it wrong to use a boolean parameter to determine behavior?

I have seen a practice from time to time that "feels" wrong, but I can't quite articulate what is wrong about it. Or maybe it's just my prejudice. Here goes: A developer defines a method with a ...
8
votes
3answers
554 views

When comparing a combination of String literals, is it convention to call .equals() on the literal? [closed]

There are benefits to each, and I understand the differences - but what is considered best / standard practice? Why? "myString".equals(myStringVar) Avoids a potential NPE and does not require a ...
4
votes
5answers
316 views

What is the minumum code/operations to have in a separate thread?

I understand that threading is needed to get the maximum performance out of today's multicore processors but starting a thread is rather costly so you can't put every single calculation that can be ...
62
votes
17answers
4k views

Recommendations for teaching junior programmers good coding style

I am a big fan of good coding style, producing clean, clear code that runs well and is easy to use and integrate into larger systems. I believe that we programmers are essentially craftspeople who ...
6
votes
1answer
205 views

Should classes from the same namespace be kept in the same assembly?

For example, ISerializable and the Serializable Attribute are both in the System.Runtime.Serialization namespace, but not the assembly of the same name. On the other hand, DataContract attributes are ...
2
votes
5answers
165 views

What is a generic term for name/identifier? (as opposed to label)

I need to refer to a number of things that have both an identifier value (used in code and configuration), and a human-readable label. These things include: database columns dropdown items ...
24
votes
7answers
13k views

Practical considerations for HTML / CSS naming conventions (syntax) [closed]

Question: what are the practical considerations for the syntax in class and id values? Note that I'm not asking about the semantics, i.e. the actual words that are being used, as for example ...
3
votes
4answers
2k views

What are the benefits of closing every if-statement with an else in Python?

I am reading Learn Python the Hard Way by Zed Shaw. In this lesson he writes: "Every if-statement must have an else." What are the benefits of ending every if-statement with an else? Are there any ...
10
votes
6answers
1k views

Javascript naming conventions

I am from Java background and am new to JavaScript. I have noticed many JavaScript methods using single character parameter names, such as in the following example. doSomething(a,b,c) I don't like ...
8
votes
1answer
146 views

Are there any free tools to measure web project's performance, security and other standards?

Are there any open-source tools to measure the standard of a web application project? I want to verify my project for: Possible security leaks (SQL Injection etc.) Performance Stability (in high ...
5
votes
3answers
255 views

What quality level in the commit history can/should I expect/enforce?

I worked as a lone developer for a long time. During this time, I developed a way of formulating and ordering commit messages: Refactor first, describe exactly the reason for the commit in the ...
11
votes
3answers
644 views

Bugs that can be avoided with coding standards [closed]

I am looking for statistics (or estimations) that backup the claim that coding standards help reduce bugs. Hard-numbers would be nice, although I haven't had much look finding any. I've even looked ...
6
votes
5answers
878 views

Should I use title case in URLs?

We are currently deciding on a consistent naming convention across a site with multiple web applications. Historically, I've been an advocate of the 'lowercase all the letters!' when creating URLs: ...
65
votes
17answers
11k views

Coding Guideline : Methods shouldn't contain more than 7 statements?

I was looking through the AvSol Coding Guidelines for C# and I agree with nearly everything but I'm really curious to see what other think of one specific rule. AV1500 Methods should not ...
15
votes
9answers
3k views

How to lead a development project without technical expertise

I have been a hands-on developer for my entire career and love working with code. I have always resented the team lead who has little or no expertise regarding a particular technology and yet insists ...
2
votes
1answer
497 views

Package conventions for MVC app [closed]

Which (if either) of the below is the more conventional/acceptable way to structure packages in a J2EE app? I'm trying to follow an MVC pattern as much as possible. foo.bar.users ...
2
votes
2answers
476 views

GUI architecture and class naming advice

Problem: I'm working on coding a few light-weight touch-tablet games and often get stuck with difficulties naming my user interaction/interface classes and their relationships with each other ...
3
votes
1answer
500 views

Has anyone thoroughly compared C# common coding standards?

Most of the C# programmers I know embrace one of the common coding standards. However being aware of the standards is one thing, telling the differences is another. Browsing the common coding ...
7
votes
1answer
96 views

How does one request / handle personal or financial information?

I would like to create a budget app for Android. Obviously, to be competitive, I would need to allow users to get data from their bank. For [huge] security reasons, this stuff is not just freely given ...
4
votes
4answers
887 views

How can I deal with developers who don't use English in code? [duplicate]

Possible Duplicate: Code maintenance: keeping a bad pattern when extending new code for being consistent, or not? I'm working on a project for a Greek public organization, as a part for a ...
5
votes
2answers
4k views

What are the reasons one would use fully qualified class names in source code?

I recently ran across code where the developers used both fully qualified class names AND imported class names in their source code. Example: import packageA.Foo; public class Example { public ...
12
votes
8answers
1k views

Conflicting Java Styles within a Team

I am part of a Java development team with a 6 week deadline. This necessitates writing a good deal of code very very quickly. However our development team has different styles of coding. Everything ...
5
votes
1answer
338 views

Word for red flags / warning signs?

When reading about best practices and code reviews, I have come across a word/phrase that people on forums have used to describe code that should be a warning sign that the programmer may have missed ...
26
votes
4answers
18k views

Why is #include <iostream.h> bad?

I was reading another thread where a guy asked about C++ books for beginners, and one of the programmers answering wrote this: Some warnings: avoid all books that present an "hello world" stating ...