coding-standards

Python coding standards/best practices

In python do you generally use PEP 8 -- Style Guide for Python Code as your coding standards/guidelines? Are there any other formalized standards that you prefer? ...

What does a good programmer's code look like?

I am a hobbyist programmer (started with VBA to make excel quicker) and have been working with VB.NET / C#.NET and am trying to learn ADO.NET. This is my first post and I apologise for the subjective nature of the question. A facet of programming that has always frustrated me is what does 'good' look like? I am not a professional so hav...

Do you use the TR 24731 'safe' functions in your C code?

The ISO C committee (ISO/IEC JTC1/SC21/WG14) has published TR 24731-1 and is working on TR 24731-2 (the second part is still under development). From the web site: TR 24731-1: Extensions to the C Library Part I: Bounds-checking interfaces WG14 is working on a TR on safer C library functions. This TR is oriented towards modifying exi...

Should I use get_/set_ prefixes in Python method names?

In Python properties are used instead of the Java-style getters, setters. So one rarely sees get... or set.. methods in the public interfaces of classes. But in cases were a property is not appropriate one might still end up with methods that behave like getters or setters. Now my questions: Should these method names start with get_ / s...

Do you have coding standards? If so, how is it being enforced?

I've worked on a couple of projects where we have spent a great deal of time discussing and writing elaborate coding standards covering everything from syntax layout to actual best practices. However, I have also found that these are rarely followed to the full extend. Many developers seem to hesitate to reject a code review based on cod...

C# coding conventions

Duplicate of: Naming Conventions in C# Where can I find the most common and up to date coding conventions for C#? ...

Organizing using directives

I've been using ReSharper for the past months and, advertising aside, I can't see myself coding without it. Since I love living on the bleeding "What the hell just went wrong" edge, I decided to try my luck w/ the latest ReSharper 4.5 nightly builds. It's all nice. However, I've noticed that the using directives grouping format has chan...

Preventive vs Reactive C# programming

I've always been one to err on the side of preventing exception conditions by never taking an action unless I am certain that there will be no errors. I learned to program in C and this was the only way to really do things. Working with C# I frequently see more reactive programing - try to do something and handle exceptions. To me thi...

Naming convention for Qt widgets

I'm working with a group of other programmers on an open source project built using C++ and Qt. Now, we need a naming convention for widgets (and other variables generally) to use it as a standard in all of our code so that, the code gets better readability and we get better coordination between programmers. Any advice? EDIT: Am not t...

How to properly document an extension method

So, I have a few extension methods, for commonly used stuff, and in documenting them, it's occurred to me that I have no idea how to consistently write the summary tag in the XML comments. For example: /// <summary> /// Gets a subset of characters from the left-hand side of a string. /// </summary> public static stri...

Best resource to learn application programming? (.Net/Cocoa/etc)

I'm an embedded programmer - primarily very small systems where I deal with data as bits, not objects. I'd like to learn how to program for Mac and PC using their native libraries (Cocoa and .Net). I've hacked a few things together in Xcode and Visual Studio, but I feel like I'm hacking, not programming. I put things in AwakeFromNib wit...

Exposing a null Object Instance as a Property

Today I was looking at some code atually from Nikhil Kothari's Facebook.NET API. I just wanted to check out how he was doing some things in there for ideas. One of the things I came across was a Property that just seemed really weird to me. check this out: FacebookRequest.cs defines a property and sets it in the constructor to a new ...

Are there any HTML coding conventions/style/standard

I mean to name ids, names, values, etc? ...

Use of the String(String) constructor in Java

I've read on articles and books that the use of String s = new String("..."); should be avoided pretty much all the time. I understand why that is, but is there any use for using the String(String) constructor whatsoever? I don't think there is, and don't see any evidence otherwise, but I'm wondering if anyone in the SO commmunity know...

The "Should be easy for a junior developer to understand" argument

Does anyone actually think this is a good reason to "Dumb down" your code? When a manager asks you to make your code simple (in terms of technology skills required to understand it) at the cost of more verbose cluttered code what should you do? ...

When is it best to change code to match standards?

I have recently been put in charge of debugging two different programs which will eventually need to share an XML parsing script, at the minimum. One was written with PureMVC, and another was built from scratch. While it made sence, originally, to write the one from scratch (it saved a good deal of memory, but the memory problems have ...

When is a function too long?

35 lines, 55 lines, 100 lines, 300 lines? When you should start to break it apart? I'm asking because I have a function with 60 lines (including comments) and was thinking about breaking it apart. long_function(){ ... } into: small_function_1(){...} small_function_2(){...} small_function_3(){...} The functions are not going to be u...

Inheriting applications at a new job...

When inheriting applications at a new job do you tend to stick to the original developers coding practices or do you start applying your own? I work in a small shop with no guidelines and always wondered what the rule was here. Some applications are written very well but do not follow the standards I use (variable names etc...) and I d...

What is the cleanest way to write this if..then logic?

They both do the same thing. Is one way better? Obviously if I write the code I'll know what I did, but how about someone else reading it? if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } return RedirectToAction("Open", "ServiceCall"); OR if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUr...

What is the most DRY way to get data out of my database?

I have to write an ASP.NET application that connects to our legacy IBM Universe Database and we are using a product called mv.net which allows us to connect, read, write, select, run server side programs, etc. I want as little code repetition as possible but I also want as little data transfer as possible as well. In order to open ...