coding-standards

What is the recommended coding style for PowerShell?

Is there any recommended coding style how to write PowerShell scripts? It's not about how to structure the code (how many functions, if to use module, ...). It's about 'how to write the code so that it is readable'. In programming languages there are some recommended coding styles (what to indent, how to indent - spaces/tabs, where to ...

When to use log level WARN vs ERROR?

Given you have these levels with increasing severity at hand from your favorite logging tool: TRACE < DEBUG < INFO < WARN < ERROR < FATAL How do you decide, when to use WARN vs ERROR? I can never decide what is appropriate. Do you have a good heuristic to base that decision on? ...

"if" considered harmful in ASP.NET MVC View (.aspx) files?

I remember seeing a blog (or something) that said you should not use <% if ... %> in .aspx files in ASP.NET MVC, but I can't remember what it said the alternative is. Can anyone remember seeing this and point me to it? ...

PEP8 - 80 Characters - Big Integers

This is somehow related to question about big strings and PEP8. How can I make my script that has the following line PEP8 compliant ("Maximum Line Length" rule)? pub_key = { 'e': 3226833362680126101036263622033066816222202666130162062116461326212012222403311326222666622610430466620224662364142L, 'n': 22642100386104124846282622610...

Advantages of std::for_each over for loop

Are there any advantages of std::for_eachover for loop? To me, std::for_each only seems to hinder the readability of code. Why do then some coding standards recommend its use? ...

Creative ways to punish (or just curb) laziness in coworkers

Like the subject suggests, what are some creative ways to curb laziness in co-workers? By laziness I'm talking about things like using variable names like "inttheemplrcd" instead of "intEmployerCode" or not keeping their projects synced with SVN, not just people who use the last of the sugar in the coffee room and don't refill the jar. ...

C++ namespaces - "using" or explicitly stated?

Possible Duplicates: Why is using namespace std; considered a bad practice in C++? Using std Namespace Is it just a matter of preference? Or is there a valid reason for preferring using namespace std; #include <string> myString string; or #include <string> myString std::string; I suppose that explicitly stating the name...

To camelCase or not to camelCase

What is the standard when coding in Java, when do you use camel case when do you use underscores etc. ...

naming convention for two interfaces for one object

Hi, I am working on a project to develop a poker bot, I have to store the state of every hand that is played. I wanted to do this via an object - however Players can only read from the state and the Dealer is allowed to write to the state. I thought a good way to solve this would be to make the HandState object implement 2 interfaces (o...

Software and Security - do you follow specific guidelines?

As part of a PCI-DSS audit we are looking into our improving our coding standards in the area of security, with a view to ensuring that all developers understand the importance of this area. How do you approach this topic within your organisation? As an aside we are writing public-facing web apps in .NET 3.5 that accept payment by cred...

Enforcing using the class name whenever a shared member is accessed.

We have a coding standard that says all shared (static) fields and methods must be called with the class name. E.g. NameOfClass.whatever Rather then whatever Is there a tool that we can use to check this is in fact the case? (Likewise for modules) Sorry I should have make it clearer we are using VB.NET. This is a bigger exam...

Ordering columns in DB tables

When it comes to column order in DB tables, are there any standards or at least best practices? Here are a few handmade best practices that I've adopted: primary key comes first; foreign keys come after the primary key; columns holding user generated data come after the foreign keys; timestamp columns come in the end of the table (no ...

What is best practice as far as using perl-isms (idiomatic expressions) in Perl?

A couple of years back I participated in writing the best practices/coding style for our (fairly large and often Perl-using) company. It was done by a committee of "senior" Perl developers. As anything done by consensus, it had parts which everyone disagreed with. Duh. The part that rubbed wrong the most was a strong recommendation to...

Functions should start with "Get"?

Hi, I'm trying to look at the C# Coding Standards to make my code more beautiful and standard, and I have a question: Does functions (methods that are not voids), according to the C# coding standards, should start with "Get"? For example: "GetSongOrder()", "GetNextLine()" etc? Thanks. ...

What StyleCop like tools are there for VB.NET

see also VB.NET Static Code Anaylsis For better or for worst we now have a VB.NET coding standards document that is based on a C# coding standard as enforced by StyleCop. For example the number of spaces you should put in each side of a “+” sign etc all instance Members (fields and methods!) must be access as “me.fieldName” all sha...

Is this ambiguous or is it perfectly fine?

Is this code ambiguous or is it perfectly fine (approved by standards/has consistent behavior for any compilers in existence)? struct SCustomData { int nCode; int nSum; int nIndex; SCustomData(int nCode, int nSum, int nIndex) : nCode(nCode) , nSum(nSum) , nIndex(nIndex) {} }; edit: yes, I am...

Assembly Coding Standard / Best Practices

I've know 8086 Assembly and now I'm learning MIPS Assembly by reading the books MIPS Assembly Language Programming and See MIPS Run, but I never stopped to think about the coding standards/best practices of Assembly. I want to turn me in a better developer each day, then want to know this to improve myself. ...

Is this an abuse of try/finally?

Given that multiple return statements are acceptable (I disagree, but let us digress), I'm looking for a more acceptable way to achieve the following behavior: Option A: multiple returns, repeated code block public bool myMethod() { /* ... code ... */ if(thisCondition) { /* ... code that must run at end of method ... *...

How beneficial is a top down code review?

It seems that most code reviews are bottom to top - being that the lower engineers get their code reviewed by the higher ups and the higher ups by the managers or not at all. It occurred to me when working with some new graduates that a top down code review may be a great thing. The idea being that us older guys have probably adopted so...

Is there a convention for naming initializer method in objective-c?

In an objective-c class that can be initialized through different init... methods, it is common sense to collect initialization code that is common to all initializers into one common method that is called from the other init* methods (or also sometimes from awakeFromNib). Is there a convention for how this method should be named? initi...