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
6answers
721 views

Criticizing your former employer in an interview [closed]

I'm a very junior developer fresh out of college, and in my first programming job. I'm pretty unhappy with my current company-the software engineering standards here are pretty shoddy-the code base is ...
2
votes
4answers
524 views

Naming convention for a method that both sets and gets

Let's say we have a method setFoo that sets a flag in a Bar object e.g. class Baz { public void setFoo(String foo)( ... } } inside setFoo, the method is doing some expensive load of ...
67
votes
20answers
12k views

How important is it to reduce the number of lines in code?

I am a Software developer who works on J2SE (core java). Often during our code reviews we are asked to reduce the number of lines in our code. It's not about removing redundant code, it's about ...
0
votes
2answers
117 views

addIfNotExist alternative

Is there are any standards or conventions on naming methods which add something if it not exist into another something. For example: Store.instance().addItemIfNotExist(item) IfNotExist is really ...
16
votes
15answers
2k views

I hate one of our coding standards and it drives me insane, how to process it? [closed]

Disclaimer: Not as exaggerated as the title suggests, but it still makes me uncomfortable. I'm just going to express honestly, so take it with a grain of salt. Just pretend that I'm talking about that ...
0
votes
1answer
762 views

Preventing override of methods in Objective-C [closed]

Objective-C lacks private methods or java-esque final methods. This means that it is possible for a subclass to (accidentally) override some of the internals of a superclass. How does one prevent ...
4
votes
5answers
528 views

How can I avoid mistakes using the same variable name again?

This isn't a rare case and occurs with me often and I spent countless time trying to debug the code. Latest example, this PHP code where I used $email for the parameter and for object as well. ...
30
votes
8answers
10k views

Is it necessary to add the default case while using switch cases?

During a recent code review I was asked to put default cases in all the files wherever switch block is used, even if there is nothing to do in default. That means I have to put the default case and ...
6
votes
3answers
334 views

Why does Zend discourage “floating functions”?

Zend's Coding Standard Naming Convention says Functions in the global scope (a.k.a "floating functions") are permitted but discouraged in most cases. Consider wrapping these functions in a static ...
2
votes
8answers
826 views

tips, guidelines, points to remember for rendering professional code? [closed]

I'm talking about giving clients professional looking code. The whole nine yards, everything you hardcore professional highly experienced programmers here probably do when coding freelance or for the ...
7
votes
3answers
218 views

“static” as a semantic clue about statelessness?

this might be a little philosophical but I hope someone can help me find a good way to think about this. I've recently undertaken a refactoring of a medium sized project in Java to go back and add ...
4
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
338 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
328 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
982 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
289 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
683 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
825 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
728 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
275 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
319 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
417 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
480 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
334 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
138 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
245 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
321 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
241 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
538 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
245 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
4answers
441 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
155 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
292 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
453 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
309 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 ...
37
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
494 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 ...
11
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
329 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
147 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
582 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 ...
71
votes
14answers
18k 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
393 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 ...