coding-standards

What is the best practice/coding standard with regard to the "this" scope is AS3?

What is the best practice/coding standard with regard to the "this" scope is AS3? Is there one? I feel it really helps with standardization and my readability, but sometimes it seems like "too much". For instance, is the use of "this" in the following really necessary (I know it works without "this")?: private var _item:Object; privat...

Is it more important to get the problem done or to write programs that are easy to follow?

A guy I work with is outstanding at programming. He gets the job done quick and always has an answer to any question you may have. However, I was recently going through some of his code and found it to be really sloppy. He uses variable names like ulc and td, and he mixes instance variable declarations between method declarations. I ask...

What tools exist for comparing C++ code to coding guidelines?

There exist tools for comparing code against a custom specified set of coding guidelines/standards for a variety of languages (rather than pure static analysis for common defects). Examples include FxCop for .Net code and CheckStyle for Java, but I was wondering what examples people know of in the C++ world. An existing question was as...

StyleCop for other languages

Hi, weve been using StyleCop for enforcing coding standards in C#, I was wondering are there similar tools for other languages? namely: js css sql ...

Clashing guidelines

While coding in Python it's better to code by following the guidelines of PEP8. And while coding for Symbian it's better to follow its coding standards. But when I code for PyS60 which guidelines should I follow? Till now I have been following PEP8, but this code shows the opposite. Do I need to rework my code? ...

Configuration Management - History in Code Comments

Let me pose a bit of background information before asking my question: I recently joined a new software development group that uses Rational tools for configuration management, including a source control and change management system. In addition to these tools, the team has a standard practice of noting any code changes as a comment in ...

Enclosing calls to debug() in if isDebugEnabled(): a good policy?

Our team has the policy of doing logging like if (LOGGER.isDebugEnabled()) { LOGGER.debug("model[" + model + "]"); } instead of simply calling the logging method like this: LOGGER.debug("model[" + model + "]"); This practice is capable of leading to some performance improvement, but on the other hand it makes the codebase more ...

Is it appropiate to break down a long line into two operations?

Tidying up some code that has what I consider to be a confusing line break structure: return CommonContext.HttpWebService.DownloadXml(configuration.MethodUrl(APIMethods.CharacterSheet), postData); If it were on one line it would clearly to be to long to be readable. As it...

Naming, declaring and defining delegates and events conventions

How do you name delegates, events and instance of events? I use this: delegate void OnSomethingHandler(); event OnSomethingHandler onSomething; Is this an accepted way? Notice lower and upper cases Where do you place delegates and events? I usually put delegates in an a namespace best reflecting them: mynamespace.Def.SomethingL...

Resources for SQL Server code review and best practices

Are there any good resources out there for T-SQL coding standards? ...

Should we create objects if we need them only once in our code?

This is a coding style questions:- Here is the case Dim obj1 as new ClassA ' Some lines of code which does not uses obj1 Something.Pass(obj1) ' Only line we are using obj1 Or should we directly initiaize the object when passing it as an argument? Something.new(new ClassA()) ...

How do you deal with new features of C# so that they don't lead to poorly written code?

A number of features were introduced into C# 3.0 which made me uneasy, such as object initializers, extension methods and implicitly typed variables. Now in C# 4.0 with things like the dynamic keyword I'm getting even more concerned. I know that each of these features CAN be used in appropriate ways BUT in my view they make it easier fo...

What does an HTML E-Mail look like?

I am trying to automatically build html emails and am trying to figure out whether there are standards and what attributes in an email work and which have to exist. Do I need a ? And if no does there have to be a body? Do I need to specify what Doctype I am using? I am working with the Zend Framework in their example they don't set anyt...

Warning: Assignment in condition

One thing that has always bugged me is that when checking my php scripts for problems I get the warning "bool-assign : Assignment in condition" and I get them a lot. e.g.: $guests = array(); $sql = "SELECT * FROM `guestlist`"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) $guests[] = $row['name']; Is there ...

Are there any more benefits, or perhaps drawbacks of the "new" way to define properties?

Are there any further benefits to the "new", shorter way to handle properties, other than shorter code - like performance benefits, less memory usage etc.? Writing public string StrVariable { get; set;} Rather than private string strVariable; public string StrVariable { set { strVariable = value; } get ...

Should I use properties in my C# programs or should I use get/set accessors?

I was reading a book called C# Yellow Book by Rob Miles when I came across this statement: Programmer’s love new shiny toys. They are very keen to use language features to show off. Properties can be a bit like this. When considering properties versus get and set methods I am rather a fan of the old fashioned get and set methods beca...

Where is the right balance of predicates in a single if statement?

I personally have no problem with the following code if (Object foo != null && !String.IsNullOrEmpty(foo["bar"])) { // do something } Because I think the following is too verbose if (Object foo != null) { if (!String.IsNullOrEmpty(foo["bar"])) { // do something } } But I wouldn't go so far with this standpoi...

What do you recommend for a PHP Coding Standards tool/system/program?

I'm working on a PHP project with several developers, each who has their own style. The styles differ significantly, and can make the code really hard to read, and everyone is in agreement that we need to standardize our style. The issue I'm having is that I can't find any good program or system to help enforce standards for PHP. I've...

Checking in of "commented out" code

Ok, here is something that has caused some friction at my current job and I really didn't expect it to. Organized in house software development is a new concept here and I have drawn up a first draft of some coding guidelines. I have proposed that "commented out" code should never be checked into the repository. The reason I have stated...

Delphi Coding Standards

I am in the process of writing (down) our companies coding standards for Delphi programming, so what would anyone suggest to have as a basis, anything that you would recommend to use / not use ? ...