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

learn more… | top users | synonyms (1)

0
votes
0answers
26 views

What are the key areas to evaluate software (codebase) on?

I have been asked to do a code review of about 50 applications over a period of 6 weeks. (Management has changed and the new CTO asked for an full internal software audit) I am wondering, what are ...
3
votes
2answers
114 views

Are there any widely accepted sets of standards/practices for secure coding?

The title should be fairly self-explanatory. We need to update our coding standards, and as part of this process we've been asked to try and follow an industry standard from a ...
4
votes
1answer
137 views

Why is the use of JavaScript in HREF attributes discouraged?

Disclaimer: I came to Programmers.SE to ask this question because I understand this is the place to ask this type of question, and not necessarily stackoverflow. If I am wrong, please close the ...
-1
votes
0answers
68 views

Looking for Guidance in Setting Standards [closed]

I am a team leader of a small team (2 other staff). Initially for a number of years I was the sole developer (C# WinForms/SQL Server). This is where I learned my skills, but I never had a mentor for ...
2
votes
3answers
406 views

Should one value simpler code over performance when returning multiple values?

I'm too often facing situations where I need to get several types of information from a method. I usually think long and hard to circumvent these situations but I'm thinking it's pointless work that ...
0
votes
0answers
76 views

Improving the speed of coding in Fortran [duplicate]

I've got about 1.5 years of experience in writing Fortran 2003 codes for scientific applications (duh), and I'm finding myself now in the situation in which I need to write working code as fast as ...
0
votes
1answer
171 views

Project directory structure

Actually i'm using this project directory structure http://framework.zend.com/manual/1.12/en/project-structure.project.html But recently i started using namespaces in all my php-classes like: ...
0
votes
2answers
134 views

C Linked List Implementation Pointer vs. Pointer-to-Pointer Consistency

To get some practice in C, I'm writing some basic functions for operating on a linked list of ints. I started out with functions that accepted as a "list" a pointer to the head node. Now, I find ...
0
votes
1answer
119 views

Method Parameters Ordering [closed]

I was recently changing a method to add in an additional parameter, and I couldn't help but wonder if there were "best practices" or "generally accepted rules" in deciding what order parameters of a ...
0
votes
1answer
118 views

Is there a particular coding standard with comments between function name and body?

I'm integrating with a shipping API built in php. They have a strange coding standard where the comments are between the function name and the first curly bracket.. which - subjectively - makes the ...
0
votes
1answer
51 views

How to format Android view IDs

I struggle with this every time I work on a project. I am not entirely sure what the standard conventions are for creating view ids. I usually use something like view_more_button but then if we ...
15
votes
16answers
1k views

Do else blocks increase code complexity? [closed]

Here is a very simplified example. This isn't necessarily a language-specific question, and I ask that you ignore the many other ways the function can be written, and changes that can be made to it.. ...
0
votes
2answers
129 views

At what point should you start putting functions in a new file? [closed]

I'm currently writing a python script. It's currently about 400 lines long, and it seems like it's getting a bit long, as when I'm trying to scroll through it with eclipse it takes a bit to get from ...
0
votes
1answer
160 views

Should I continue stressing development standards? [closed]

I've been with my software team for about three years now, and just recently I brought up the concept of variable naming conventions (across all languages, but C#/VB.Net specifically). We really ...
16
votes
5answers
1k views

What does it mean when some technology is a “standard”?

I started learning Java EE 7 and I am frequently coming across this term "standard", and I don't understand what it means. So, for example, here is a quotation from this book: Contrary to SOAP ...
2
votes
2answers
71 views

Generic Repositories with DI & Data Intensive Controllers

Usually, I consider a large number of parameters as an alarm bell that there may be a design problem somewhere. I am using a Generic Repository for an ASP.NET application and have a Controller with a ...
0
votes
2answers
71 views

Erlang return value conventions

Should functions that return tuples, always return tuples? For example, I have a function is_user_name_allowed that returns a tuple in this he form if the username is not allowed: {false, ["Reason ...
1
vote
2answers
180 views

Is a try-catch-finally clause appropriate for production code?

While browsing around on SO, I came across an answer that suggested using a try-catch-finally clause to fix the problem he was having. (A rare bug that sometimes happened to his users). Someone ...
2
votes
1answer
302 views

Things developers do before the coding phase [closed]

I'm a new software developer, and in my internship my boss asked me to develop an application that allows him to manage his inventory. Something small but, for me, very enriching. The application is ...
15
votes
12answers
2k views

Why use getters only as opposed to marking things final? [duplicate]

I'm working in a java role after working a couple years in functional programming. Our company was bought by google and I took a java role after the acquisition. Coming back to java as a polyglot ...
3
votes
3answers
450 views

Refactoring previous intern's noodle code with future interns in mind [duplicate]

Background I've run across this problem as I am currently an intern at a large company's local software division. I have been given the task of extending a project that several previous interns have ...
16
votes
14answers
3k views

How many mistakes does a good software developer make? [closed]

I am currently in a situation where a lot of people criticized me for making bugs (on my first local try - the first time I run the code for the first locally done test - , not on a committed repo ...
3
votes
3answers
96 views

Is it bad to use the same class or idiom names as in a third-party API that you're using?

FlashPunk is a third-party graphics API for simple game development in AS3, and they take what are effectively sprites or display objects of some sort and refer to them as "Entities". Entity is the ...
2
votes
3answers
387 views

invoking methods within a conditional expression

In an oft-cited (if dated) reference for C# coding standards (pdf; from Lance Hunt), the statement is made, 33. Avoid invoking methods within a conditional expression. I've not seen this ...
0
votes
1answer
58 views

Matching the superclass's constructor's parameter list, is treating a null default value as a non-null value within a constructor a violation of LSP? [duplicate]

I kind of ran into this when messing around with FlashPunk, and I'm going to use it as an example. Essentially the main sprite class is pretty much class Entity. Entity's constructor has four ...
0
votes
1answer
177 views

What is the proper way to extract and pass parameters to call javascript functionality from my PHP page?

This is my situation: I have a search results page in PHP where most of the logic resides in a javascript file in order to avoid refreshing the page every time an action is performed. The first thing ...
1
vote
1answer
141 views

How much functionality needed to create a new class?

Right now I am working on my own small project of a WPF file back up application. I have come to a point where I want to create a method that will copy files recursively from one place to another. ...
73
votes
8answers
7k views

Is it okay to not completely understand code functionality? [duplicate]

As I am currently struggling with learning WCF for a project at work, for the past several days I have been looking at online tutorials and examples on the best way to make a WCF client; and today, ...
29
votes
1answer
989 views

How to deal with a misnamed function in production code?

I've recently come across a Python library on GitHub. The library is great, but contains one glaring typo in a function name. Let's call it dummy_fuction() while it should be dummy_function(). This ...
2
votes
2answers
125 views

Enforcing coding standards: What are the trade-offs of different methods?

Our team has recently agreed on some very light coding standards, and that we need a means of enforcing them. We already have a mature Continuous Integration practice including frequent, small ...
3
votes
2answers
183 views

Which do you code first, MVC? [closed]

I have been coding for a good bit, and I found a project I want to work on -- a python web app using django + mongodb. I know what I want my web app to do. When you are in this circumstance (just ...
0
votes
1answer
49 views

How using tab affects commands like diff

In the page at http://pear.php.net/manual/en/standards.indenting.php, it is advised to use space instead of tab as it causes issue with diff, patches. Here is the excerpt from the page. Use an ...
3
votes
3answers
531 views

Is it common to use code you don't understand? [closed]

I have been working on a project recently that uses a pretty comprehensive framework built by someone else. The framework is free to use commercially and privately as anybody sees fit, so there are no ...
1
vote
1answer
90 views

Are there any standards for separating different kinds of comments (explanatory, debug, to-do, etc.)?

For a while now I've been in the habit of differentiating different kinds of comments in my code. //this is an explanatory comment //!this line was commented out for debug purposes, DO NOT SHIP WITH ...
0
votes
3answers
110 views

Long vs short scripts? Big vs small scripts? [closed]

As a programmer, I have always wondered whether it is preferable to write (a) short modular functions that are each stored in their own script (i.e., file) or (b) long comprehensive scripts that ...
0
votes
4answers
182 views

What is the industry norm for naming standard for gui object event handlers in C# [closed]

Lets say you have a button objects on a form with a click event (c#/.Net). How is the event handler normally named throughout the industry? fooButton_Click fooButtonClick (or if you like ...
2
votes
3answers
415 views

Coding standards for c# [duplicate]

I wanted to know if there are some default standards for writing c# code. By default I mean may be something officially from Microsoft, or any other organization. I am looking for something where I ...
0
votes
0answers
437 views

Commenting MVC applications [duplicate]

I've recently realised that my workplace doesn't comment their ASP.NET MVC applications. By 'doesn't document', I mean there is probably 1 line of comment per model/view/controller. No file purpose, ...
4
votes
2answers
237 views

Is Convention Over Configuration “Knowledge in the World” or “Knowledge In Your Head”?

In Don Norman's seminal work "The Design of Everyday Things", the author coined the phrases and explains the difference between "Knowledge in the World" and "Knowledge In Your Head"; an example of ...
0
votes
1answer
139 views

PHP - PSR 0 - Configuration Constants

This question is about PSR-0 autoloaded libraries and the way main configuration constants should be declared and used. From your point of view (lib/framework developer), where/how should be declared ...
1
vote
2answers
145 views

Should I Aggregate Web API Errors?

The Situation We are writing a REST API that performs validation up-front. The code is written such that it tries to find as many errors as possible. However, each error might correspond to a ...
3
votes
2answers
258 views

Unit testing method name standard for overloaded methods

I have read several posts which discuss coding standard for naming the unit test methods for improving readability. I follow this NameOfMethod_ExpectedBehavior_WhenSomeScenario, but now I am confused ...
4
votes
4answers
320 views

Why is the following naming guideline different between OO and non-OO languages?

I am working with a non-OO language and I'm trying to name my routines consistently. I came acrross the following guideline from Steve McConnell's Code Complete: To name a procedure, use a strong ...
0
votes
1answer
322 views

Should the helper function in class be defined before the usage or after

I need to do the code review of fellow members. One of the member always defined the helper functions at the bottom and use them at top e,g class Sample { public function SendFile(){ file = ...
0
votes
4answers
849 views

Usage of magic strings/numbers [closed]

This is somewhat controversial topic, and I guess there is as many opinions as there are programmers. But for the sake of it, I want to know what are the common practices in business (or in your work ...
4
votes
4answers
554 views

Using a function's return value as an if condition, good practice?

Do you think it is a good practice to use function return values as if conditions? I'm coding in PHP atm but it holds for many other languages. if(isTheConditionMet($maybeSomeParams)) { } or $res ...
13
votes
6answers
7k views

Avoid too complex method - Cyclomatic Complexity

Not sure how to go about this method to reduce Cyclomatic Complexity. Sonar reports 13 whereas 10 is expected. I am sure nothing harm in leaving this method as it is, however, just challenging me how ...
0
votes
1answer
203 views

Where does the tradition of shell prompts in code snippets come from?

Most code samples I see that demonstrate shell code preface each command with $. Having a prefix makes sense, but I'm confused as to why $ is used in particular. Some other symbol, like !, that can be ...
1
vote
3answers
268 views

“state” or “status”? When should a variable name contain the word “state”, and when should a variable name instead contain the word “status”? [closed]

Reading code and discussions pertaining to code, I often see the words "state" and "status" used interchangeably, but the following tendencies seem to exist: When a variable holds a value intended ...
-1
votes
1answer
51 views

Convention for using super class functions and members

Is there a Convention or common way for using super class functions and members? For example the super class has the function protected void Foo() and protected int myInt; In subclass would I want ...