Hello all,
I would like to know the meaning of the below written lines with an example. I'm unable to understand what the lines actually mean. The lines are from google's objective-c coding guidelines.
Initialization
Don't initialize variables to 0 or nil in the init method; it's redundant.
All memory for a newly allocated ob...
I've been programming in Java for about 4 years now, but what I've learned was self-taught--I've never taken a formal class for the language. Recently at my job I heard two guys arguing over something called the "java standard" of programming that "99% of all professional java developers use." I've never heard of nor intentionally used t...
I like clean and well written code, but I don't have the experience or the knowledge (yet) to write code at his best; so, I was wondering if there's a site (like SO) where people can submit snippets, clases, implementations, etc., to be reviewed and posibly improved by other experiencied people, so everybody could learn from their modifi...
Working in a team environment how would you handle a developer that refuses to follow team defined standards?
1) Developer is at a junior level
2) Developer is at a peer level
3) Developer is at a senior level
I know this is suggestive but I feel that it would benefit developers by making them more professional. Thanks!
...
In the below shown examples, the former approach instantiates an object of type SearchResult for each iteration whereas the latter one instantiates the object only once and uses it for all the iterations.
using (DbDataReader reader = (DbDataReader)dbObject.ExecuteReader(command))
{
if (reader.HasRows)
{
...
We have tried many methods such as
Code review required before check-in (hard to enforce)
Monthly code review sessions (tend to side-track, time consuming, too high level)
One or two devs with free cycles review changesets as they are added (low participation)
We use TFS and could write a tool to leverage the API or build a workflow ...
I have a page with three HTML labels and their corresponding ASP.NET gridviews contained within divs. Now while learning jQuery, I am trying to achieve two things:
1. Change the css class of the lables upon mouse hover/out.
2. Slide up/down the grid div upon clicking of the labels.
It looks to be working as expected, but I wish to know i...
Hello,
Class could have static, private, protected, public methods. Each method is made for modifying, adding, removing etc.
How do you group functions in class's code to make it clean to read? What is the best practices?
Thank you.
...
Hi guys,
Do you know of a good style guide about coding? Particularly about how to comment code?
In the last years I've seen the way you code and the naming conventions you use are very influenced by the language you use. Is that applicable for comments?
I know there's not a unique way of doing things and, after all, comments are igno...
I was recently told it was bad practice to haved marked a number of methods in our code with the [Obsolete] attribute. These methods were internal to our codebase, rather than being on an API. The methods handled an older encryption function.
I felt it was a quick and safe way to denote to the rest of the team that these methods should ...
I saw there is an answered question about whether there is a difference between using $(document).ready(function(){}) and $(function(){}) (there isn't), but my question is which is the preferred syntax and why.
I've been using jQuery for about a year and have always used the $(document).ready() syntax; but lately on SO and in some other...
Which is the better convention of declaring pointers in C++?
MyClass* ptr
(or)
MyClass *ptr
I find the first one meaningful, because i feel like declaring MyClass pointer rather than a MyClass and specifying a type modifier. But i see a lot of books recommending the later convention. Can you give the rational behind the convention...
We have a team of 40+ engineers working on a common code base. We're using resharper, and have been sharing our suggested settings by having a 'definitive' configuration file emailed out which people can import.
However, as time goes on we wish to tighten up on various things on new versions and new work, without requiring refactoring o...
If you've got a codebase which is a bit messy in respect to coding standards - a mix of different conventions from different people - is it reasonable to give one person the task of going through every file and bringing it up to meet standards?
As well as being tremendously dull, you're going to get a mass of changes in SVN (or whatever...
Sorry to post this mundane question here, but I need help!
I have to do a 1 hour Software Best Practices Training for some
programmers in my company. Audience are Freshers to couple of years
experience guys.
Can you guys please suggest some relevant topics I can cover?
I could think of the following:
1) Importance of following codin...
Consider the following code snippet from .NET 4.0 library:
private T[] array;
private static T[] emptyArray;
private int size;
private int version;
static Stack()
{
Stack<T>.emptyArray = new T[0];
}
public Stack()
{
array = Stack<T>.emptyArray;
size = 0;
version = 0;
}
Is there any reason behind initiali...
Why is it convention to place getters and setters after constructors within classes?
I would rather see them placed immediately after class fields, before the constructors, in order to see which of the private fields are accessible via getter & setter methods. Especially if the methods' bodies are single return or assignment statements...
Hi Folks,
I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?
For that, is ther...
I wanted some tool which could check all the standard violations that I make while I write code. After some search I found Eclipse Checkstyle Plugin suitable to my requirement.
I have not yet tried out using this. Information about this tool was found in this site
http://checkstyle.sourceforge.net/
Can some on who has used this tool t...
Hi,
I've been using innerHTML and innerText for a while to change elements and text on web pages and I've just discovered that they are not W3C standard.
I've now found that innerHTML can be replaced with createElement, setAttribute and a few others but what is the best method for changing text inside an element?
I found a textContent...