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

learn more… | top users | synonyms (1)

2
votes
3answers
280 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
182 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
457 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 ...
49
votes
17answers
5k 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 ...
10
votes
5answers
4k 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 ...
1
vote
1answer
333 views

Capitalization convention in assembly? [closed]

Is there any convention on what to capitalize in (x86) assembly? For example, which one of these 'looks best'? (Or maybe none of them do?) [BITS 32] %define MACRO 1 MyLabel: MOV EAX, 2 versus ...
7
votes
5answers
492 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 ...
253
votes
9answers
57k 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?
63
votes
17answers
12k 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
460 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
310 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 ...
61
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 ...
2
votes
2answers
166 views

Standards for mixing languages within one application? [duplicate]

Possible Duplicate: What do you do when working with multiple languages with different capitalization schemes? When mixing programming languages, is it a best practice to use different ...
6
votes
1answer
182 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
164 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 ...
23
votes
7answers
10k 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
1k 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
142 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 ...
4
votes
3answers
229 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 ...
12
votes
3answers
576 views

Bugs that can be avoided with coding standards

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
771 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: ...
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
462 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
426 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
484 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
95 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
856 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
961 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
334 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 ...
18
votes
10answers
2k views

Are chatty/humorous comments in source code acceptable or unprofessional? [duplicate]

Possible Duplicate: Humor in Documentation Throughout my professional career, I have often relied on chatty or humorous comments in source code (or source control commit messages) to help ...
3
votes
2answers
390 views

What is the right way to develop ASP.NET applications in order to separate data access from data visualization?

I'm currently involved in a migration to TFS from SVN of a large project that is going to be divided into five different sites. This project allows some providers to insert five different product data ...
7
votes
8answers
823 views

How should I introduce a coding standard to my team?

First a bit of background: My current development manager is taking another opportunity the end of this week, leaving our team with four fulltime developers, a part-time intern and a web designer ...
2
votes
4answers
340 views

What kind of interface should a double container offer?

I want to write a class which offers two sequences of elements to its users. The first one (lets call it "primary") is the main of the class and will be use 80% of the time. The second one (lets call ...
0
votes
2answers
191 views

Naming Rules: Standards, Reserved, and what do they depend on? [closed]

I want to know the rules of naming (AlwaysCapitalize, _underscore, firstSmallLetter, etc...) for each of Namespaces, Classes, Interfaces, Exceptions, Data Members, Methods, Variables, etc.... also I ...
3
votes
3answers
125 views

migrating product and team from startup race to quality development [duplicate]

Possible Duplicate: A simple ways to improve the release quality in RAD environment This is year 3 and product is selling good enough. Now we need to enforce good software development ...
8
votes
5answers
281 views

How do you avoid name similarities between your classes and the native ones?

I just ran into an "interesting problem", which I would like your opinion about: I am developing a system and for many reasons (meaning: abstraction, technology independence, etc) we create our own ...
3
votes
2answers
834 views

How to mark an empty conditional block in Java

In C++ when I wanted to mark that if is empty by design I added NULL; as statement: if (cond1) { ... } else if (cond2) { NULL; } else { ... } However in Java it seems to be impossible ...
7
votes
2answers
127 views

What do you do when working with multiple languages with different capitalization schemes?

I'm making a webapp using Django. The Python convention for naming variables is lowercase_with_underscores, but the Javascript convention is camelCase. In addition, I've seen many people use ...
7
votes
5answers
1k views

How to deal with different programming styles in a team?

We have a small dev team (only 3 developers) and we recently got a new team member. While he is a smart coder, his coding style is completely different from ours. Our existing code base contains ...
501
votes
21answers
43k views

Where did the notion of “one return only” come from?

I often talk to Java programmers who say "Don't put multiple return statements in the same method." When I ask them to tell me the reasons why, all I get is "The coding standard says so." or "It's ...
30
votes
6answers
3k views

Should interface names begin with an “I” prefix?

I have been reading "Clean Code" by Robert Martin to hopefully, become a better programmer. While none of it so far has been really ground breaking it has made me think differently about the way I ...
1
vote
2answers
414 views

Why would a video game need main(String[] args) in its own class?

My teacher just told me that whenever I create a class to run something for a video game company that uses Eclipse, I should make a run class with the main and any outputs. He says any arithmetic ...
17
votes
13answers
2k views

Is it an appropriate use of #define to make typing repeated code easier?

Is there any view on whether using the #define to define full lines of code for simplifying coding is good or bad programming practice? For example, if I needed to print a bunch of words together, I'd ...
0
votes
4answers
243 views

How do I convince some one that test should do assertion (not assertions) and not the helper methods

Joined a new employer and came across a new style of writing tests. @Test() public testMethodWhichDoesNotDoAnyAssertion() { LoginPage loginPage = signUpPage.doLogin("username","password"); ...
1
vote
4answers
235 views

What are the pros and cons of directly exposing a Table/View entity class to the client?

I'm developing a multi-tier application. We separate our project into three logical layers: client, service and data access. However, almost all methods in the service layer don't do anything except ...
5
votes
5answers
281 views

Standards in Enterprise Development

Is it perhaps time for enterprise systems to be developed to strict enforced standards? Many books list optional 'standards' and best practices, but these are purely suggested practices. Still, every ...
3
votes
7answers
5k views

Is there a common capitalization convention in C++? [closed]

I do a lot of work in Python and Java, and both those languages have fairly common (though not universal) conventions on how capitalization should be used in identifiers: both use PascalCase for class ...