coding-standards

Thoughts on the use of readonly for any/all instance members of a class?

Preface For some time now I've been using the readonly modifier for nearly all class fields. I use it for List<T> members, IDisposeable members, ints, strings, etc... everything but value types I intend to change. I tend to do this even when I would normally like to null a member on Dispose(). IMHO The advantages of not needing the i...

How to use transactions in DotNetNuke (entangled with L2S)?

I use L2S at my module. The problem occurs while I'm using the default DNN entities at the same TransactionScope with my L2S data access, then I get a DTC request which I want to avoid. How can I share the connection/transaction for both DNN entities and my L2S data access? ...

Checkstyle source control intergration

I've been looking into checkstyle recently as part of some research into standard coding conventions. Though it seems like it is perfectly suitable for brand new projects, it seems to have a huge barrier to adoption for already existing projects as it doesn't seem to supply a method of only checking new or edited code. Maybe I'm wrong?...

Window Service and C# design pattern question

I have recently taken over a legacy windows service and it has been writing the following event in the system event log: Event ID: 7034 Description: The MyService service terminated unexpectedly. It has done this X time(s). I was looking over source code and found the following code pattern in the service class library: (It ...

Coding-style: How to improve coding-styles and standards at a company

What are the best ways to improve the standards of coding-styles at a company? Let's use C# as an example here. I guess there are many differences between developers that need to be taken into consideration. The concrete ones could be education, experience and past programming-languages. How does one justify that something is right ove...

C# - Any standard way to divide a class into regions?

I was wondering if there is some standard way to divide a class into regions. almost every project is using a different "region approach" (even classes within the same project). We pay so much attention to naming conventions and so little to the class's structure. I think that introducing some standard will make it much easier on us to ...

ASP.NET coding standards guide.

Can anyone tell me where can I find a good article on ASP.NET with C# Coding Standards. ...

Coding standards and design patterns in PHPSpec library

I really like the codebase of PHPSpec. Could any of you guys mention any standards and/or design patterns that are prominent in this library as that is how I want my code to be? ...

Ruby Style: should initialize take a file with data or just the raw data as parameters

Hello, I was curious if anyone had insight on what is the best way for an object to load data from a file in Ruby. Is there a convention? There are two ways I can think of accomplishing this: Have the initialize method accept a path or file and parse the data within the initialize method, setting the object variables as well. Have th...

Standard and Best practice in dealing with Muliple/Complex Columns with Forms

Hi, I've want to know what is the best practice or approach in dealing with multiple and complex columns with a form inside. here's an example of the form I'm dealing with http://img96.imageshack.us/img96/5658/complexform.jpg How to properly write a HTML markup for this? If I wrap every form element with a 'DIV' for every column it...

3-Tiered Web Architecture: Are Layers on Seperate Machines Beneficial?

A client I'm working for has a standard in which they require the data layer of new applications to be wrapped into a web service, and placed a machine seperate from where the business/presentation layer will be hosted. Could someone tell me what the benefits of doing this are? It seems to me that this causes more problems than it solv...

What should the standard be for ReSTful URLS?

Since I can't find a chuffing job, I've been reading up on ReST and creating web services. The way I've interpreted it, the future is all about creating a web service for all your data before you build the web app. Which seems like a good idea. However, there seems to be a lot of contradictory thoughts on what the best scheme is for ReS...

Why does StyleCop recommend prefixing method or property calls with "this"?

I have been trying to follow StyleCop's guidelines on a project, to see if the resulting code was better in the end. Most rules are reasonable or a matter of opinion on coding standard, but there is one rule which puzzles me, because I haven't seen anyone else recommend it, and because I don't see a clear benefit to it: SA1101: The c...

Coding style: function and procedures coding standard

Ch 7.6 of Code Complete 2 is confusing me, I've attached some sample code (in php) mind telling me which style is the best? or suggest something better? thanks Style 1 public function register($user, $pass) { if($this->model->isRegistered($user) { return false; } else if($this->twitter->login($user, $pass)) { return $this->mod...

Guideline: while vs for

Disclaimer: I tried to search for similar question, however this returned about every C++ question... Also I would be grateful to anyone that could suggest a better title. There are two eminent loop structure in C++: while and for. I purposefully ignore the do ... while construct, it is kind of unparalleled I know of std::for_each and...

is it a bad practice to declare objects as 'null'

So I just came back from a 'meting' about a fix that we had to do which would fix an issue we had in production. Before the code goes out, it has to be presented to all these bunch of people. hate it! Broken code (pseudo): SomeClassA object1 = null while loop { if (some condition){ // do something } else { objec...

Should query languages have priority of operator OR higher than priority of AND ?

Traditionally most programming languages have priority of AND higher than priority of OR so that expression "a OR b AND c" is treated as "a OR (b AND c)". Following that idea search engines and query/addressing languages (css,xpath,sql,...) used the same prioritization. Wasn't it mistake ? When dealing with large enough data, that prior...

Oracle Coding Standards Feature Implementation

Okay, I have reached a sort of an impasse. In my open source project, a .NET-based Oracle database browser, I've implemented a bunch of refactoring tools. So far, so good. The one feature I was really hoping to implement was a big "Global Reformat" that would make the code (scripts, functions, procedures, packages, views, etc.) standard...

Besides "treat warnings as errors" and fixing memory leaks, what other ideas should we implement as part of our coding standards?

First let me say, I am not a coder but I help manage a coding team. No one on the team has more than about 5 years experience, and most of them have only worked for this company.. So we are flying a bit blind, hence the question. We are trying to make our software more stable and are looking to implement some "best practices" and codin...

what to do about Procedural code, business logic and queries in PHP

I have been tasked with supporting and maintaining several PHP/MySQL web apps (I use the term 'app' lossely) that seem to defy every known coding standard. The PHP code contains routines, procedures, business logic, and even queries - it's all in the code. There is no object-orientated programming, not even MVC, and certainly no separ...